Compare commits
1 Commits
master
...
origin/251001
| Author | SHA1 | Date |
|---|---|---|
|
|
18261b1682 |
|
|
@ -0,0 +1,141 @@
|
|||
package com.api.kq.browser.service.impl;
|
||||
|
||||
import com.api.browser.bean.ListHeadBean;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SplitTableBean;
|
||||
import com.api.browser.bean.SplitTableColBean;
|
||||
import com.api.browser.service.BrowserService;
|
||||
import com.api.browser.util.BoolAttr;
|
||||
import com.api.browser.util.BrowserConstant;
|
||||
import com.api.browser.util.BrowserDataType;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
import com.api.browser.util.ConditionType;
|
||||
import com.api.browser.util.SplitTableUtil;
|
||||
import com.api.browser.util.SqlUtils;
|
||||
import com.engine.kq.util.TransMethod;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.interfaces.WfToModeTransmethod;
|
||||
import weaver.general.Util;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 考勤流程设置 浏览按钮
|
||||
* type : KQAttSet
|
||||
*/
|
||||
public class KQAttSetBrowserService extends BrowserService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
String workflowname = Util.null2String(params.get("workflowname"));
|
||||
String kqtype = Util.null2String(params.get("kqtype"));
|
||||
String sqlwhere = " where 1=1 ";
|
||||
if(!workflowname.equals("")){
|
||||
String sql = " select id from workflow_base where workflowname like '%"+workflowname+"%' ";
|
||||
sqlwhere += " and field001 in("+sql+")";
|
||||
}
|
||||
if(!kqtype.equals("")){
|
||||
sqlwhere += " and field006 in ("+kqtype+")";
|
||||
}
|
||||
|
||||
sqlwhere = SqlUtils.replaceFirstAnd(sqlwhere);
|
||||
// 设置好搜索条件
|
||||
String backFields = " field001 as id ,field001, field006 ";
|
||||
String fromSql = " kq_att_proc_set ";
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true","id"));
|
||||
cols.add(new SplitTableColBean("50%",SystemEnv.getHtmlLabelName(18104, user.getLanguage()),"field001","field001","weaver.formmode.interfaces.WfToModeTransmethod.getWorkflowNameBlank",""+user.getLanguage()).setIsInputCol(BoolAttr.TRUE).setShowType(1));
|
||||
cols.add(new SplitTableColBean("50%",SystemEnv.getHtmlLabelName(16070,user.getLanguage()),"field006","field006","com.engine.kq.util.TransMethod.getFlowTypeName",""+user.getLanguage()).setShowType(0));
|
||||
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields,fromSql,sqlwhere,"id","id","asc",cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 18104, "workflowname", true));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMultBrowserDestData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<Map<String,Object>> datas = new ArrayList<Map<String,Object>>();
|
||||
String selectids = Util.null2String(params.get(BrowserConstant.BROWSER_MULT_DEST_SELECTIDS));
|
||||
if(user==null||"".equals(selectids)){
|
||||
return apidatas;
|
||||
}
|
||||
WfToModeTransmethod wfToModeTransmethod = new WfToModeTransmethod();
|
||||
TransMethod transMethod = new TransMethod();
|
||||
RecordSet recordSet = new RecordSet();
|
||||
String tempSql = " select field001 as id ,field001, field006 from kq_att_proc_set where 1=1 and field001 in ("+selectids+") ";
|
||||
recordSet.executeQuery(tempSql);
|
||||
while (recordSet.next()){
|
||||
String kqtype = Util.null2String(recordSet.getString("kqtype"));
|
||||
String kqtypeShow = transMethod.getKQTypeName(kqtype,""+user.getLanguage());
|
||||
|
||||
Map<String,Object> item = new HashMap<String,Object>();
|
||||
item.put("id", recordSet.getString("id"));
|
||||
item.put("field001", wfToModeTransmethod.getWorkflowNameBlank(recordSet.getString("field001"),user.getLanguage()+""));
|
||||
item.put("field006", new TransMethod().getFlowTypeName(recordSet.getString("field006"), ""+user.getLanguage()));
|
||||
datas.add(item);
|
||||
}
|
||||
List<ListHeadBean> tableHeadColumns = new ArrayList<ListHeadBean>();
|
||||
tableHeadColumns.add(new ListHeadBean("id",BoolAttr.TRUE));
|
||||
tableHeadColumns.add(new ListHeadBean("field001","",1,BoolAttr.TRUE));
|
||||
tableHeadColumns.add(new ListHeadBean("field006","",0));
|
||||
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_COLUMN, tableHeadColumns);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_DATA, datas);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_TYPE, BrowserDataType.LIST_ALL_DATA.getTypeid());
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> browserAutoComplete(
|
||||
HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
String workflowname=request.getParameter("q");
|
||||
String kqtype = Util.null2String(request.getParameter("kqtype"));
|
||||
RecordSet rs=new RecordSet();
|
||||
String sqlwhere = " where 1=1 ";
|
||||
if(!workflowname.equals("")){
|
||||
String sql = " select id from workflow_base where workflowname like '%"+workflowname+"%' ";
|
||||
sqlwhere += " and field001 in("+sql+")";
|
||||
}
|
||||
if(!kqtype.equals("")){
|
||||
sqlwhere += " and field006 in ("+kqtype+")";
|
||||
}
|
||||
// 设置好搜索条件
|
||||
String backFields = " field001 as id ,field001, field006 ";
|
||||
String fromSql = " kq_att_proc_set ";
|
||||
String sql = "select "+backFields+" from "+fromSql+sqlwhere;
|
||||
|
||||
WfToModeTransmethod wfToModeTransmethod = new WfToModeTransmethod();
|
||||
rs.executeQuery(sql);
|
||||
List<Map<String,String>> datas = new ArrayList<Map<String,String>>();
|
||||
while(rs.next()){
|
||||
Map<String,String> item = new HashMap<String,String>();
|
||||
item.put("id", Util.null2String(rs.getString("field001")));
|
||||
String name = Util.null2String(wfToModeTransmethod.getWorkflowNameBlank(rs.getString("field001"),user.getLanguage()+""));
|
||||
item.put("name", name);
|
||||
datas.add(item);
|
||||
}
|
||||
apidatas.put("datas",datas);
|
||||
return apidatas;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,230 @@
|
|||
package com.api.kq.browser.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.api.browser.bean.*;
|
||||
import com.api.browser.service.BrowserService;
|
||||
import com.api.browser.util.*;
|
||||
import com.engine.kq.util.TransMethod;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.moduledetach.ManageDetachComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import weaver.systeminfo.systemright.CheckSubCompanyRight;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 假期类型浏览按钮
|
||||
* type : KQLeaveType
|
||||
*/
|
||||
public class KQDeductTiaoxiuBrowserService extends BrowserService {
|
||||
private BaseBean log = new BaseBean();
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) throws Exception {
|
||||
String advance = Util.null2String(params.get("advance"));
|
||||
if("".equals(advance) || "0".equals(advance))
|
||||
return getBasicData(params);
|
||||
return getAdvanceData(params);
|
||||
}
|
||||
|
||||
private Map<String, Object> getBasicData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
String groupname = Util.null2String(params.get("name"));
|
||||
String sqlWhere = Util.null2String(params.get("sqlWhere"));
|
||||
String sqlwhere = " where 1=1 ";
|
||||
if(!groupname.equals("")){
|
||||
sqlwhere += " and name like '%";
|
||||
sqlwhere += Util.fromScreen2(groupname,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
// if(!sqlWhere.equals("")){
|
||||
// sqlwhere += " and "+sqlWhere;
|
||||
// }
|
||||
|
||||
sqlwhere = SqlUtils.replaceFirstAnd(sqlwhere);
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,name ";
|
||||
String fromSql = " kq_deduct_tiaoxiu ";
|
||||
log.writeLog("1.name="+groupname+",sqlwhere="+sqlwhere);
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true","id"));
|
||||
cols.add(new SplitTableColBean("100%",SystemEnv.getHtmlLabelName(17666, user.getLanguage()),"name","name").setIsInputCol(BoolAttr.TRUE).setShowType(1));
|
||||
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields,fromSql,sqlwhere,"id","id","asc",cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
private Map<String, Object> getAdvanceData(Map<String, Object> params) throws Exception {
|
||||
CheckSubCompanyRight checkSubCompanyRight = new CheckSubCompanyRight();
|
||||
ManageDetachComInfo manageDetachComInfo = new ManageDetachComInfo();
|
||||
boolean hrmdetachable = manageDetachComInfo.isUseHrmManageDetach();//是否开启了人力资源模块的管理分权
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
String groupname = Util.null2String(params.get("name"));
|
||||
String sqlWhere = Util.null2String(params.get("sqlWhere"));
|
||||
String sqlwhere = " where 1=1 ";
|
||||
if(!groupname.equals("")){
|
||||
sqlwhere += " and name like '%";
|
||||
sqlwhere += Util.fromScreen2(groupname,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!sqlWhere.equals("")){
|
||||
sqlwhere += " and "+sqlWhere;
|
||||
}
|
||||
|
||||
sqlwhere = SqlUtils.replaceFirstAnd(sqlwhere);
|
||||
// 设置好搜索条件
|
||||
String backFields = " id,id as id1,id as id2,name ";
|
||||
String fromSql = " kq_deduct_tiaoxiu ";
|
||||
|
||||
log.writeLog("2.name="+groupname+",sqlwhere="+sqlwhere);
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true","id"));
|
||||
cols.add(new SplitTableColBean("100%",SystemEnv.getHtmlLabelName(17666, user.getLanguage()),"name","name", "", "column:id+++" + user.getLanguage()).setIsInputCol(BoolAttr.TRUE).setShowType(1));
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields,fromSql,sqlwhere,"id","id","asc",cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
String advance = Util.null2String(params.get("advance"));
|
||||
if("".equals(advance) || "0".equals(advance))
|
||||
return getBasicBrowserConditionInfo(params);
|
||||
return getAdvanceBrowserConditionInfo(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getBasicBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 17666, "name", true));
|
||||
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
public Map<String, Object> getAdvanceBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 17666, "name"));
|
||||
|
||||
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMultBrowserDestData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<Map<String,Object>> datas = new ArrayList<Map<String,Object>>();
|
||||
String selectids = Util.null2String(params.get(BrowserConstant.BROWSER_MULT_DEST_SELECTIDS));
|
||||
if(user==null||"".equals(selectids)){
|
||||
return apidatas;
|
||||
}
|
||||
TransMethod transMethod = new TransMethod();
|
||||
String tmp_order = Util.null2String(selectids);
|
||||
Map<String,Object> item = null;
|
||||
if(tmp_order.length()>0){
|
||||
String[] orders = tmp_order.split(",");
|
||||
if(null != orders && orders.length>0){
|
||||
for (int i = 0; i < orders.length; i++) {
|
||||
item = new HashMap<String,Object>();
|
||||
if("1".equals(orders[i])){
|
||||
item.put("id", "1");
|
||||
item.put("name", "节假日");
|
||||
datas.add(item);
|
||||
}else if("2".equals(orders[i])){
|
||||
item.put("id", "2");
|
||||
item.put("name", "工作日");
|
||||
datas.add(item);
|
||||
}else if("3".equals(orders[i])){
|
||||
item.put("id", "3");
|
||||
item.put("name", "休息日");
|
||||
datas.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RecordSet recordSet = new RecordSet();
|
||||
String tempSql = " select id,name from kq_deduct_tiaoxiu where 1=1 and id in ("+selectids+") ";
|
||||
log.writeLog("3.selectids="+selectids+",datas="+ JSONObject.toJSONString(datas));
|
||||
// recordSet.executeQuery(tempSql);
|
||||
// while (recordSet.next()){
|
||||
// String id = recordSet.getString("id");
|
||||
// if(tmp_order.length()>0){
|
||||
// String[] orders = tmp_order.split(",");
|
||||
// if(null != orders && orders.length>0){
|
||||
// for (int i = 0; i < orders.length; i++) {
|
||||
// item = new HashMap<String,Object>();
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
List<ListHeadBean> tableHeadColumns = new ArrayList<ListHeadBean>();
|
||||
tableHeadColumns.add(new ListHeadBean("id",BoolAttr.TRUE));
|
||||
tableHeadColumns.add(new ListHeadBean("name","",1,BoolAttr.TRUE));
|
||||
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_COLUMN, tableHeadColumns);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_DATA, datas);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_TYPE, BrowserDataType.LIST_ALL_DATA.getTypeid());
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> browserAutoComplete(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
String outSqlWhere=request.getParameter("sqlWhere");
|
||||
String groupname=request.getParameter("q");
|
||||
String includeAll=request.getParameter("includeAll");
|
||||
RecordSet rs=new RecordSet();
|
||||
String sqlwhere = " where 1=1 ";
|
||||
|
||||
if(!groupname.equals("")){
|
||||
sqlwhere += " and name like '%";
|
||||
sqlwhere += Util.fromScreen2(groupname,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!outSqlWhere.equals("")){
|
||||
sqlwhere += " and "+outSqlWhere;
|
||||
}
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,name ";
|
||||
String fromSql = " kq_deduct_tiaoxiu ";
|
||||
String sql = "select "+backFields+" from "+fromSql+sqlwhere;
|
||||
|
||||
log.writeLog("4.sql="+sql);
|
||||
rs.executeQuery(sql);
|
||||
List<Map<String,String>> datas = new ArrayList<Map<String,String>>();
|
||||
while(rs.next()){
|
||||
Map<String,String> item = new HashMap<String,String>();
|
||||
item.put("id", Util.null2String(rs.getString("id")));
|
||||
String name = Util.null2String(rs.getString("name"));
|
||||
item.put("name", name);
|
||||
datas.add(item);
|
||||
}
|
||||
apidatas.put("datas",datas);
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,334 @@
|
|||
package com.api.kq.browser.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.api.browser.bean.*;
|
||||
import com.api.browser.service.BrowserService;
|
||||
import com.api.browser.util.*;
|
||||
import com.api.hrm.bean.HrmFieldBean;
|
||||
import com.engine.kq.biz.KQGroupMemberComInfo;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.TransMethod;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.moduledetach.ManageDetachComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import weaver.systeminfo.systemright.CheckSubCompanyRight;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 考勤组浏览按钮
|
||||
* type : KQGroup
|
||||
*/
|
||||
public class KQGroupBrowserService extends BrowserService {
|
||||
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) throws Exception {
|
||||
String advance = Util.null2String(params.get("advance"));
|
||||
if("".equals(advance) || "0".equals(advance))
|
||||
return getBasicData(params);
|
||||
return getAdvanceData(params);
|
||||
}
|
||||
|
||||
private Map<String, Object> getBasicData(Map<String, Object> params) throws Exception {
|
||||
kqLog.info("params:::::::::::"+ JSON.toJSONString(params));
|
||||
|
||||
CheckSubCompanyRight checkSubCompanyRight = new CheckSubCompanyRight();
|
||||
ManageDetachComInfo manageDetachComInfo = new ManageDetachComInfo();
|
||||
boolean hrmdetachable = manageDetachComInfo.isUseHrmManageDetach();//是否开启了人力资源模块的管理分权
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
boolean isBindGroup = "1".equals(Util.null2String(params.get("isBindGroup"))); // 0:未绑定考勤组; 1:绑定了考勤组
|
||||
|
||||
String groupname = Util.null2String(params.get("groupname"));
|
||||
String kqtype = Util.null2String(params.get("kqtype"));
|
||||
String sqlWhere = Util.null2String(params.get("sqlWhere"));
|
||||
String sqlwhere = " where 1=1 and (isdelete is null or isdelete <> '1') ";
|
||||
|
||||
if(isBindGroup) {
|
||||
String resourceId = Util.null2String(params.get("resourceId"));
|
||||
String fromDate = Util.null2String(params.get("fromDate"));
|
||||
if(fromDate.length() == 0){
|
||||
fromDate = DateUtil.getCurrentDate();
|
||||
}
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
String groupIds = kqGroupMemberComInfo.getKQGroupIds(resourceId, fromDate);
|
||||
if(!"".equals(groupIds)) {
|
||||
kqtype = "2";
|
||||
sqlwhere += " and id in("+groupIds+") ";
|
||||
} else {
|
||||
sqlwhere = " where 1=2 ";
|
||||
}
|
||||
}
|
||||
|
||||
if(!groupname.equals("")){
|
||||
sqlwhere += " and groupname like '%";
|
||||
sqlwhere += Util.fromScreen2(groupname,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!kqtype.equals("")){
|
||||
sqlwhere += " and kqtype ="+kqtype;
|
||||
}
|
||||
|
||||
if(hrmdetachable){
|
||||
int[] arrSubcompanyids = checkSubCompanyRight.getSubComByUserRightId(user.getUID(),"HrmKQGroup:Add");
|
||||
String subcompanyids = "";
|
||||
if(user.getUID() != 1){
|
||||
for(int i=0;arrSubcompanyids!=null&&i<arrSubcompanyids.length;i++){
|
||||
if(subcompanyids.length()>0)subcompanyids+=",";
|
||||
subcompanyids += arrSubcompanyids[i];
|
||||
}
|
||||
if(subcompanyids.length() > 0 ){
|
||||
sqlwhere += " and subcompanyid in("+subcompanyids+")";
|
||||
}else{
|
||||
sqlwhere += " and 1=2 ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!sqlWhere.equals("")){
|
||||
sqlwhere += " and "+sqlWhere;
|
||||
}
|
||||
|
||||
sqlwhere = SqlUtils.replaceFirstAnd(sqlwhere);
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,groupname, kqtype ";
|
||||
String fromSql = " kq_group ";
|
||||
|
||||
String sql = "select "+backFields+" from "+fromSql+" "+sqlwhere;
|
||||
kqLog.info("sql:::::::::"+sql);
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true","id"));
|
||||
cols.add(new SplitTableColBean("50%",SystemEnv.getHtmlLabelName(388700, user.getLanguage()),"groupname","groupname").setIsInputCol(BoolAttr.TRUE).setShowType(1));
|
||||
cols.add(new SplitTableColBean("50%",SystemEnv.getHtmlLabelName(388704,user.getLanguage()),"kqtype","kqtype","com.engine.kq.util.TransMethod.getKQTypeName",""+user.getLanguage()).setShowType(0));
|
||||
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields,fromSql,sqlwhere,"id","id","asc",cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
private Map<String, Object> getAdvanceData(Map<String, Object> params) throws Exception {
|
||||
CheckSubCompanyRight checkSubCompanyRight = new CheckSubCompanyRight();
|
||||
ManageDetachComInfo manageDetachComInfo = new ManageDetachComInfo();
|
||||
boolean hrmdetachable = manageDetachComInfo.isUseHrmManageDetach();//是否开启了人力资源模块的管理分权
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
String groupname = Util.null2String(params.get("groupname"));
|
||||
String kqtype = Util.null2String(params.get("kqtype"));
|
||||
String sqlWhere = Util.null2String(params.get("sqlWhere"));
|
||||
String sqlwhere = " where 1=1 and (isdelete is null or isdelete <> '1') ";
|
||||
if(!groupname.equals("")){
|
||||
sqlwhere += " and groupname like '%";
|
||||
sqlwhere += Util.fromScreen2(groupname,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!kqtype.equals("")){
|
||||
sqlwhere += " and kqtype ="+kqtype;
|
||||
}
|
||||
|
||||
if(!sqlWhere.equals("")){
|
||||
sqlwhere += " and "+sqlWhere;
|
||||
}
|
||||
|
||||
if(hrmdetachable){
|
||||
int[] arrSubcompanyids = checkSubCompanyRight.getSubComByUserRightId(user.getUID(),"HrmKQGroup:Add");
|
||||
String subcompanyids = "";
|
||||
if(user.getUID() != 1){
|
||||
for(int i=0;arrSubcompanyids!=null&&i<arrSubcompanyids.length;i++){
|
||||
if(subcompanyids.length()>0)subcompanyids+=",";
|
||||
subcompanyids += arrSubcompanyids[i];
|
||||
}
|
||||
if(subcompanyids.length() > 0 ){
|
||||
sqlwhere += " and subcompanyid in("+subcompanyids+")";
|
||||
}else{
|
||||
sqlwhere += " and 1=2 ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sqlwhere = SqlUtils.replaceFirstAnd(sqlwhere);
|
||||
// 设置好搜索条件
|
||||
String backFields = " id,id as id1,id as id2,groupname,subcompanyid,kqtype,excludeid,signintype,ipscope,locationcheck,locationcheckscope,wificheck,isdelete ";
|
||||
String fromSql = " kq_group ";
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true","id"));
|
||||
cols.add(new SplitTableColBean("30%",SystemEnv.getHtmlLabelName(388700, user.getLanguage()),"groupname","groupname", "com.engine.kq.util.TransMethod.getKQGroupName", "column:id+++" + user.getLanguage()).setIsInputCol(BoolAttr.TRUE).setShowType(1));
|
||||
cols.add(new SplitTableColBean("20%",SystemEnv.getHtmlLabelName(1859, user.getLanguage()),"id1",null, "com.engine.kq.util.TransMethod.getGroupUserCount"));
|
||||
cols.add(new SplitTableColBean("20%",SystemEnv.getHtmlLabelName(63,user.getLanguage()),"kqtype","kqtype","com.engine.kq.util.TransMethod.getKQTypeName",""+user.getLanguage()).setShowType(0));
|
||||
cols.add(new SplitTableColBean("30%",SystemEnv.getHtmlLabelName(27961, user.getLanguage()),"id2",null, "com.engine.kq.util.TransMethod.getKQGroupDetial", "column:kqtype+"+user.getLanguage()));
|
||||
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields,fromSql,sqlwhere,"id","id","asc",cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
String advance = Util.null2String(params.get("advance"));
|
||||
if("".equals(advance) || "0".equals(advance))
|
||||
return getBasicBrowserConditionInfo(params);
|
||||
return getAdvanceBrowserConditionInfo(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getBasicBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 388700, "groupname", true));
|
||||
|
||||
List<SearchConditionOption> options = new ArrayList<SearchConditionOption>();
|
||||
options.add(new SearchConditionOption("",""));
|
||||
options.add(new SearchConditionOption("1",SystemEnv.getHtmlLabelName(389127, user.getLanguage())));
|
||||
options.add(new SearchConditionOption("2",SystemEnv.getHtmlLabelName(389128, user.getLanguage())));
|
||||
options.add(new SearchConditionOption("3",SystemEnv.getHtmlLabelName(389129, user.getLanguage())));
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.SELECT, 388704, "kqtype", options));
|
||||
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
public Map<String, Object> getAdvanceBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 388700, "groupname"));
|
||||
|
||||
List<SearchConditionOption> options = new ArrayList<SearchConditionOption>();
|
||||
options.add(new SearchConditionOption("",""));
|
||||
options.add(new SearchConditionOption("1",SystemEnv.getHtmlLabelName(389127, user.getLanguage())));
|
||||
options.add(new SearchConditionOption("2",SystemEnv.getHtmlLabelName(389128, user.getLanguage())));
|
||||
options.add(new SearchConditionOption("3",SystemEnv.getHtmlLabelName(389129, user.getLanguage())));
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.SELECT, 388704, "kqtype", options));
|
||||
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMultBrowserDestData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<Map<String,Object>> datas = new ArrayList<Map<String,Object>>();
|
||||
String selectids = Util.null2String(params.get(BrowserConstant.BROWSER_MULT_DEST_SELECTIDS));
|
||||
if(user==null||"".equals(selectids)){
|
||||
return apidatas;
|
||||
}
|
||||
TransMethod transMethod = new TransMethod();
|
||||
RecordSet recordSet = new RecordSet();
|
||||
String tempSql = " select id,groupname, kqtype from kq_group where 1=1 and (isdelete is null or isdelete <> '1') and id in ("+selectids+") ";
|
||||
recordSet.executeQuery(tempSql);
|
||||
while (recordSet.next()){
|
||||
String kqtype = Util.null2String(recordSet.getString("kqtype"));
|
||||
String kqtypeShow = transMethod.getKQTypeName(kqtype,""+user.getLanguage());
|
||||
|
||||
Map<String,Object> item = new HashMap<String,Object>();
|
||||
item.put("id", recordSet.getString("id"));
|
||||
item.put("groupname", Util.null2String(recordSet.getString("groupname")));
|
||||
item.put("kqtype", kqtypeShow);
|
||||
datas.add(item);
|
||||
}
|
||||
List<ListHeadBean> tableHeadColumns = new ArrayList<ListHeadBean>();
|
||||
tableHeadColumns.add(new ListHeadBean("id",BoolAttr.TRUE));
|
||||
tableHeadColumns.add(new ListHeadBean("groupname","",1,BoolAttr.TRUE));
|
||||
tableHeadColumns.add(new ListHeadBean("kqtype","",0));
|
||||
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_COLUMN, tableHeadColumns);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_DATA, datas);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_TYPE, BrowserDataType.LIST_ALL_DATA.getTypeid());
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> browserAutoComplete(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
String isBindGroup=Util.null2s(request.getParameter("isBindGroup"),"");
|
||||
|
||||
String outSqlWhere=Util.null2s(request.getParameter("sqlWhere"),"");
|
||||
String groupname=Util.null2s(request.getParameter("q"),"");
|
||||
String includeAll=Util.null2s(request.getParameter("includeAll"),"");
|
||||
RecordSet rs=new RecordSet();
|
||||
String sqlwhere = " where 1=1 and (isdelete is null or isdelete <> '1') ";
|
||||
if("1".equals(isBindGroup)) {
|
||||
String resourceId=Util.null2s(request.getParameter("resourceId"),"");
|
||||
String fromDate=Util.null2s(request.getParameter("fromDate"),"");
|
||||
if(fromDate.length() == 0){
|
||||
fromDate = DateUtil.getCurrentDate();
|
||||
}
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
String groupIds = kqGroupMemberComInfo.getKQGroupIds(resourceId, fromDate);
|
||||
if(!"".equals(groupIds)) {
|
||||
sqlwhere += " and id in("+groupIds+") and kqType=2 ";
|
||||
} else {
|
||||
sqlwhere = " where 1=2 ";
|
||||
}
|
||||
} else {
|
||||
sqlwhere += " and kqType <>3 ";
|
||||
}
|
||||
//String groupids = getSettedGroupIds();
|
||||
// if(groupids.length()>0 && "".equals(includeAll)){
|
||||
// sqlwhere+=" and id not in ( "+groupids+" ) ";
|
||||
// }
|
||||
if(!groupname.equals("")){
|
||||
sqlwhere += " and groupname like '%";
|
||||
sqlwhere += Util.fromScreen2(groupname,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!outSqlWhere.equals("")){
|
||||
sqlwhere += " and "+outSqlWhere;
|
||||
}
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,groupname, kqtype ";
|
||||
String fromSql = " kq_group ";
|
||||
String sql = "select "+backFields+" from "+fromSql+sqlwhere;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
List<Map<String,String>> datas = new ArrayList<Map<String,String>>();
|
||||
while(rs.next()){
|
||||
Map<String,String> item = new HashMap<String,String>();
|
||||
item.put("id", Util.null2String(rs.getString("id")));
|
||||
String name = Util.null2String(rs.getString("groupname"));
|
||||
item.put("name", name);
|
||||
datas.add(item);
|
||||
}
|
||||
apidatas.put("datas",datas);
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已经设置过加班规则得考勤组ids
|
||||
* @return
|
||||
*/
|
||||
private String getSettedGroupIds(){
|
||||
RecordSet rs = new RecordSet();
|
||||
String settedGroupIds = "";
|
||||
try{
|
||||
rs.executeQuery("select groupids from kq_OvertimeRules where isdelete is null or isdelete <>'1'");
|
||||
while(rs.next()){
|
||||
String groupids = Util.null2String(rs.getString("groupids"));
|
||||
if(groupids.length()>0){
|
||||
if(settedGroupIds.length()>0)settedGroupIds+=",";
|
||||
settedGroupIds+=groupids;
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
rs.writeLog(e);
|
||||
}
|
||||
return settedGroupIds;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.api.kq.browser.service.impl;
|
||||
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
import com.api.browser.bean.SplitTableBean;
|
||||
import com.api.browser.bean.SplitTableColBean;
|
||||
import com.api.browser.service.BrowserService;
|
||||
import com.api.browser.util.*;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 假期浏览按钮
|
||||
*/
|
||||
public class KQLeaveBrowserService extends BrowserService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
String resourceId = Util.null2String(params.get("resourceId"));//人员ID
|
||||
String leaveName = Util.null2String(params.get("leaveName"));//假期名称
|
||||
String minimumUnit = Util.null2String(params.get("minimumUnit"));//请假单位
|
||||
String computingMode = Util.null2String(params.get("computingMode"));//计算请假时长方式
|
||||
|
||||
String backFields = " * ";
|
||||
String sqlFrom = " kq_leaveRules ";
|
||||
String sqlWhere = " where (isdelete is null or isdelete!=1) ";
|
||||
if (!leaveName.equals("")) {
|
||||
sqlWhere += " and leaveName like '%" + leaveName + "%'";
|
||||
}
|
||||
if (!minimumUnit.equals("") && !minimumUnit.equals("0")) {
|
||||
sqlWhere += " and minimumUnit=" + minimumUnit;
|
||||
}
|
||||
if (!computingMode.equals("") && !computingMode.equals("0")) {
|
||||
sqlWhere += " and computingMode=" + computingMode;
|
||||
}
|
||||
if (resourceId.equals("")) {
|
||||
sqlWhere += " and 1=2 ";
|
||||
} else {
|
||||
try{
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
sqlWhere += " and organizationType=1 and organizationId=" + resourceComInfo.getSubCompanyID(resourceId) +
|
||||
" union select * from kq_leaveRules " + sqlWhere + " and organizationType=0 " +
|
||||
" and leaveName not in (select leaveName from kq_leaverules where organizationType=1 and organizationId=" + resourceComInfo.getSubCompanyID(resourceId) + ")";
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true", "id"));
|
||||
cols.add(new SplitTableColBean("25%", SystemEnv.getHtmlLabelName(388883, user.getLanguage()), "leaveName").setIsInputCol(BoolAttr.TRUE));
|
||||
cols.add(new SplitTableColBean("25%", SystemEnv.getHtmlLabelName(388884, user.getLanguage()), "minimumUnit", "", "com.engine.kq.util.KQTransMethod.getMinimumUnitName", "" + user.getLanguage()));
|
||||
cols.add(new SplitTableColBean("25%", SystemEnv.getHtmlLabelName(388888, user.getLanguage()), "computingMode", "", "com.engine.kq.util.KQTransMethod.getComputingModeName", "" + user.getLanguage()));
|
||||
cols.add(new SplitTableColBean("25%", SystemEnv.getHtmlLabelName(388892, user.getLanguage()), "distributionMode", "", "com.engine.kq.util.KQTransMethod.getDistributionModName", "column:balanceEnable+" + user.getLanguage()));
|
||||
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields, sqlFrom, sqlWhere, "", "id", "asc", cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
/*假期名称*/
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 388883, "leaveName", true));
|
||||
|
||||
/*请假单位*/
|
||||
List<SearchConditionOption> optionsList = new ArrayList<SearchConditionOption>();
|
||||
optionsList.add(new SearchConditionOption("0", SystemEnv.getHtmlLabelName(337, user.getLanguage())));
|
||||
optionsList.add(new SearchConditionOption("1", SystemEnv.getHtmlLabelName(388885, user.getLanguage())));
|
||||
optionsList.add(new SearchConditionOption("2", SystemEnv.getHtmlLabelName(388886, user.getLanguage())));
|
||||
optionsList.add(new SearchConditionOption("3", SystemEnv.getHtmlLabelName(388887, user.getLanguage())));
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.SELECT, 388884, "minimumUnit", optionsList));
|
||||
|
||||
/*计算请假时长方式*/
|
||||
optionsList = new ArrayList<SearchConditionOption>();
|
||||
optionsList.add(new SearchConditionOption("0", SystemEnv.getHtmlLabelName(337, user.getLanguage())));
|
||||
optionsList.add(new SearchConditionOption("1", SystemEnv.getHtmlLabelName(388890, user.getLanguage())));
|
||||
optionsList.add(new SearchConditionOption("2", SystemEnv.getHtmlLabelName(388889, user.getLanguage())));
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.SELECT, 388884, "computingMode", optionsList));
|
||||
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
return apidatas;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
package com.api.kq.browser.service.impl;
|
||||
|
||||
import com.api.browser.bean.*;
|
||||
import com.api.browser.service.BrowserService;
|
||||
import com.api.browser.util.*;
|
||||
import com.engine.kq.biz.KQLeaveRulesComInfo;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.moduledetach.ManageDetachComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import weaver.systeminfo.systemright.CheckSubCompanyRight;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 假期类型浏览按钮
|
||||
* type : KQLeaveType
|
||||
*/
|
||||
public class KQLeaveTypeBrowserService extends BrowserService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) throws Exception {
|
||||
String advance = Util.null2String(params.get("advance"));
|
||||
if("".equals(advance) || "0".equals(advance))
|
||||
return getBasicData(params);
|
||||
return getAdvanceData(params);
|
||||
}
|
||||
|
||||
private Map<String, Object> getBasicData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
String groupname = Util.null2String(params.get("leavename"));
|
||||
String sqlWhere = Util.null2String(params.get("sqlWhere"));
|
||||
String sqlwhere = " where 1=1 and (isdelete is null or isdelete <> '1') and isEnable=1 and balanceEnable=1 ";
|
||||
if(!groupname.equals("")){
|
||||
sqlwhere += " and leavename like '%";
|
||||
sqlwhere += Util.fromScreen2(groupname,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!sqlWhere.equals("")){
|
||||
sqlwhere += " and "+sqlWhere;
|
||||
}
|
||||
|
||||
sqlwhere = SqlUtils.replaceFirstAnd(sqlwhere);
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,leavename ";
|
||||
String fromSql = " kq_leaverules ";
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true","id"));
|
||||
cols.add(new SplitTableColBean("100%",SystemEnv.getHtmlLabelName(388883, user.getLanguage()),"leavename","leavename").setIsInputCol(BoolAttr.TRUE).setShowType(1));
|
||||
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields,fromSql,sqlwhere,"id","id","asc",cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
private Map<String, Object> getAdvanceData(Map<String, Object> params) throws Exception {
|
||||
CheckSubCompanyRight checkSubCompanyRight = new CheckSubCompanyRight();
|
||||
ManageDetachComInfo manageDetachComInfo = new ManageDetachComInfo();
|
||||
boolean hrmdetachable = manageDetachComInfo.isUseHrmManageDetach();//是否开启了人力资源模块的管理分权
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
String groupname = Util.null2String(params.get("leavename"));
|
||||
String sqlWhere = Util.null2String(params.get("sqlWhere"));
|
||||
String sqlwhere = " where 1=1 and (isdelete is null or isdelete <> '1') and isEnable=1 and balanceEnable=1 ";
|
||||
if(!groupname.equals("")){
|
||||
sqlwhere += " and leavename like '%";
|
||||
sqlwhere += Util.fromScreen2(groupname,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!sqlWhere.equals("")){
|
||||
sqlwhere += " and "+sqlWhere;
|
||||
}
|
||||
|
||||
sqlwhere = SqlUtils.replaceFirstAnd(sqlwhere);
|
||||
// 设置好搜索条件
|
||||
String backFields = " id,id as id1,id as id2,leavename,isdelete ";
|
||||
String fromSql = " kq_leaverules ";
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true","id"));
|
||||
cols.add(new SplitTableColBean("100%",SystemEnv.getHtmlLabelName(388883, user.getLanguage()),"leavename","leavename", "", "column:id+++" + user.getLanguage()).setIsInputCol(BoolAttr.TRUE).setShowType(1));
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields,fromSql,sqlwhere,"id","id","asc",cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
String advance = Util.null2String(params.get("advance"));
|
||||
if("".equals(advance) || "0".equals(advance))
|
||||
return getBasicBrowserConditionInfo(params);
|
||||
return getAdvanceBrowserConditionInfo(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getBasicBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 388883, "leavename", true));
|
||||
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
public Map<String, Object> getAdvanceBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 388883, "leavename"));
|
||||
|
||||
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMultBrowserDestData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<Map<String,Object>> datas = new ArrayList<Map<String,Object>>();
|
||||
String selectids = Util.null2String(params.get(BrowserConstant.BROWSER_MULT_DEST_SELECTIDS));
|
||||
if(user==null||"".equals(selectids)){
|
||||
return apidatas;
|
||||
}
|
||||
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
|
||||
String tmp_order = Util.null2String(selectids);
|
||||
Map<String,Object> item = null;
|
||||
if(tmp_order.length()>0){
|
||||
String[] orders = tmp_order.split(",");
|
||||
if(null != orders && orders.length>0){
|
||||
for (int i = 0; i < orders.length; i++) {
|
||||
item = new HashMap<String,Object>();
|
||||
item.put("id", orders[i]);
|
||||
item.put("leavename", kqLeaveRulesComInfo.getLeaveName(orders[i]));
|
||||
datas.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
// RecordSet recordSet = new RecordSet();
|
||||
// String tempSql = " select id,leavename from kq_leaverules where (isdelete is null or isdelete <> '1') and isEnable=1 and id in ("+selectids+") ";
|
||||
// recordSet.executeQuery(tempSql);
|
||||
// while (recordSet.next()){
|
||||
//
|
||||
// Map<String,Object> item = new HashMap<String,Object>();
|
||||
// item.put("id", recordSet.getString("id"));
|
||||
// item.put("leavename", Util.null2String(recordSet.getString("leavename")));
|
||||
//
|
||||
// datas.add(item);
|
||||
// }
|
||||
List<ListHeadBean> tableHeadColumns = new ArrayList<ListHeadBean>();
|
||||
tableHeadColumns.add(new ListHeadBean("id",BoolAttr.TRUE));
|
||||
tableHeadColumns.add(new ListHeadBean("leavename","",1,BoolAttr.TRUE));
|
||||
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_COLUMN, tableHeadColumns);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_DATA, datas);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_TYPE, BrowserDataType.LIST_ALL_DATA.getTypeid());
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> browserAutoComplete(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
String outSqlWhere=request.getParameter("sqlWhere");
|
||||
String groupname=request.getParameter("q");
|
||||
String includeAll=request.getParameter("includeAll");
|
||||
RecordSet rs=new RecordSet();
|
||||
String sqlwhere = " where 1=1 and (isdelete is null or isdelete <> '1') and isEnable=1 and balanceEnable=1 ";
|
||||
|
||||
if(!groupname.equals("")){
|
||||
sqlwhere += " and leavename like '%";
|
||||
sqlwhere += Util.fromScreen2(groupname,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!outSqlWhere.equals("")){
|
||||
sqlwhere += " and "+outSqlWhere;
|
||||
}
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,leavename ";
|
||||
String fromSql = " kq_leaverules ";
|
||||
String sql = "select "+backFields+" from "+fromSql+sqlwhere;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
List<Map<String,String>> datas = new ArrayList<Map<String,String>>();
|
||||
while(rs.next()){
|
||||
Map<String,String> item = new HashMap<String,String>();
|
||||
item.put("id", Util.null2String(rs.getString("id")));
|
||||
String name = Util.null2String(rs.getString("leavename"));
|
||||
item.put("name", name);
|
||||
datas.add(item);
|
||||
}
|
||||
apidatas.put("datas",datas);
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
package com.api.kq.browser.service.impl;
|
||||
|
||||
import com.api.browser.bean.ListHeadBean;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SplitTableBean;
|
||||
import com.api.browser.bean.SplitTableColBean;
|
||||
import com.api.browser.service.BrowserService;
|
||||
import com.api.browser.util.BoolAttr;
|
||||
import com.api.browser.util.BrowserConstant;
|
||||
import com.api.browser.util.BrowserDataType;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
import com.api.browser.util.ConditionType;
|
||||
import com.api.browser.util.SplitTableUtil;
|
||||
import com.api.browser.util.SqlUtils;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.util.KQTransMethod;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import weaver.common.StringUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 加班浏览按钮
|
||||
* type : kqovertimerule
|
||||
*/
|
||||
public class KQOvertimeRuleBrowserService extends BrowserService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
String name = Util.null2String(params.get("name"));
|
||||
String sqlWhere = Util.null2String(params.get("sqlWhere"));
|
||||
String sqlwhere = " where (isdelete is null or isdelete <> '1') ";
|
||||
if(!name.equals("")){
|
||||
sqlwhere += " and name like '%";
|
||||
sqlwhere += Util.fromScreen2(name,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!sqlWhere.equals("")){
|
||||
sqlwhere += " and "+sqlWhere;
|
||||
}
|
||||
sqlwhere = SqlUtils.replaceFirstAnd(sqlwhere);
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,name,groupIds,id as aliasid ";
|
||||
String fromSql = " kq_overtimerules ";
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true","id"));
|
||||
cols.add(new SplitTableColBean("20%",SystemEnv.getHtmlLabelName(19829, user.getLanguage()),"name","name").setIsInputCol(BoolAttr.TRUE));
|
||||
cols.add(new SplitTableColBean("40%",SystemEnv.getHtmlLabelName(388832,user.getLanguage()),"aliasid","aliasid","com.engine.kq.util.KQTransMethod.getRuleContent",user.getLanguage()+""));
|
||||
cols.add(new SplitTableColBean("40%",SystemEnv.getHtmlLabelName(546281,user.getLanguage()),"groupIds","groupIds","com.engine.kq.util.KQTransMethod.getGroupName",user.getLanguage()+""));
|
||||
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields,fromSql,sqlwhere,"id","id","asc",cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, 19829, "name", true);
|
||||
searchConditionItem.setLabelcol(8);
|
||||
searchConditionItem.setFieldcol(16);
|
||||
conditions.add(searchConditionItem);
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMultBrowserDestData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<Map<String,Object>> datas = new ArrayList<Map<String,Object>>();
|
||||
String selectids = Util.null2String(params.get(BrowserConstant.BROWSER_MULT_DEST_SELECTIDS));
|
||||
if(user == null || "".equals(selectids)) {
|
||||
return apidatas;
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
String selSql = "select * from kq_overtimerules ";
|
||||
String sqlwhere = " where 1=1 ";
|
||||
String[] ids = Util.splitString(selectids, ",");
|
||||
if(selectids.length() > 0){
|
||||
sqlwhere += " and "+Util.getSubINClause(selectids, "id", "in");
|
||||
}
|
||||
rs.executeSql(selSql+sqlwhere);
|
||||
KQTransMethod kqTransMethod = new KQTransMethod();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
while (rs.next()){
|
||||
Map<String,Object> item = new HashMap<String,Object>();
|
||||
String id = rs.getString("id");
|
||||
item.put("id", id);
|
||||
item.put("aliasid", Util.null2String(kqTransMethod.getRuleContent(id, StringUtil.vString(user.getLanguage()))));
|
||||
item.put("name", Util.null2String(rs.getString("name")));
|
||||
datas.add(item);
|
||||
}
|
||||
|
||||
List<ListHeadBean> tableHeadColumns = new ArrayList<ListHeadBean>();
|
||||
tableHeadColumns.add(new ListHeadBean("id","").setHide(BoolAttr.TRUE));
|
||||
tableHeadColumns.add(new ListHeadBean("name",""));
|
||||
tableHeadColumns.add(new ListHeadBean("aliasid","",1,BoolAttr.TRUE));
|
||||
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_COLUMN, tableHeadColumns);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_DATA, datas);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_TYPE, BrowserDataType.LIST_ALL_DATA.getTypeid());
|
||||
return apidatas;
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> browserAutoComplete(
|
||||
HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
String name=Util.null2s(request.getParameter("q"),"");
|
||||
String outSqlWhere=Util.null2s(request.getParameter("sqlWhere"),"");
|
||||
RecordSet rs=new RecordSet();
|
||||
String sqlwhere = " where 1=1 ";
|
||||
if(!name.equals("")){
|
||||
sqlwhere += " and name like '%";
|
||||
sqlwhere += Util.fromScreen2(name,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!outSqlWhere.equals("")){
|
||||
sqlwhere += " and "+outSqlWhere;
|
||||
}
|
||||
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,name,id as aliasid ";
|
||||
String fromSql = " kq_overtimerules ";
|
||||
String sql = "select "+backFields+" from "+fromSql+sqlwhere;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
List<Map<String,String>> datas = new ArrayList<Map<String,String>>();
|
||||
while(rs.next()){
|
||||
Map<String,String> item = new HashMap<String,String>();
|
||||
item.put("id", Util.null2String(rs.getString("id")));
|
||||
String name1 = Util.null2String(rs.getString("name"));
|
||||
item.put("name", name1);
|
||||
datas.add(item);
|
||||
}
|
||||
apidatas.put("datas",datas);
|
||||
return apidatas;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
package com.api.kq.browser.service.impl;
|
||||
|
||||
import com.api.browser.bean.ListHeadBean;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SplitTableBean;
|
||||
import com.api.browser.bean.SplitTableColBean;
|
||||
import com.api.browser.service.BrowserService;
|
||||
import com.api.browser.util.BoolAttr;
|
||||
import com.api.browser.util.BrowserConstant;
|
||||
import com.api.browser.util.BrowserDataType;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
import com.api.browser.util.ConditionType;
|
||||
import com.api.browser.util.SplitTableUtil;
|
||||
import com.api.browser.util.SqlUtils;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 多班次浏览按钮
|
||||
* type : mkqshift
|
||||
*
|
||||
*/
|
||||
public class MutiShiftBrowserService extends BrowserService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
String serial = Util.null2String(params.get("serial"));
|
||||
String sqlwhere = " where 1=1 and (isdelete is null or isdelete <> '1') ";
|
||||
if(!serial.equals("")){
|
||||
sqlwhere += " and serial like '%";
|
||||
sqlwhere += Util.fromScreen2(serial,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
sqlwhere = SqlUtils.replaceFirstAnd(sqlwhere);
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,id as aliasid,serial ";
|
||||
String fromSql = " kq_ShiftManagement ";
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true","id"));
|
||||
cols.add(new SplitTableColBean("50%",SystemEnv.getHtmlLabelName(27961,user.getLanguage()),"aliasid","aliasid","com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit.getShiftOnOffWorkSections",user.getLanguage()+"").setIsInputCol(BoolAttr.TRUE));
|
||||
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields,fromSql,sqlwhere,"id","id","asc",cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 125818, "serial", true));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMultBrowserDestData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<Map<String,Object>> datas = new ArrayList<Map<String,Object>>();
|
||||
String selectids = Util.null2String(params.get(BrowserConstant.BROWSER_MULT_DEST_SELECTIDS));
|
||||
if(user == null || "".equals(selectids)) return apidatas;
|
||||
RecordSet rs = new RecordSet();
|
||||
String selSql = "select * from kq_ShiftManagement ";
|
||||
String sqlwhere = " where 1=1 ";
|
||||
String[] ids = Util.splitString(selectids, ",");
|
||||
if(selectids.length() > 0){
|
||||
sqlwhere += " and "+Util.getSubINClause(selectids, "id", "in");
|
||||
}
|
||||
rs.executeSql(selSql+sqlwhere);
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
while (rs.next()){
|
||||
Map<String,Object> item = new HashMap<String,Object>();
|
||||
String id = rs.getString("id");
|
||||
item.put("id", id);
|
||||
item.put("aliasid", Util.null2String(shiftManagementToolKit.getShiftOnOffWorkSections(id,user.getLanguage())));
|
||||
item.put("serial", Util.null2String(rs.getString("serial")));
|
||||
datas.add(item);
|
||||
}
|
||||
|
||||
List<ListHeadBean> tableHeadColumns = new ArrayList<ListHeadBean>();
|
||||
tableHeadColumns.add(new ListHeadBean("id","").setHide(BoolAttr.TRUE));
|
||||
tableHeadColumns.add(new ListHeadBean("serial",""));
|
||||
tableHeadColumns.add(new ListHeadBean("aliasid","",1,BoolAttr.TRUE));
|
||||
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_COLUMN, tableHeadColumns);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_DATA, datas);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_TYPE, BrowserDataType.LIST_ALL_DATA.getTypeid());
|
||||
return apidatas;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.api.kq.browser.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SplitTableBean;
|
||||
import com.api.browser.bean.SplitTableColBean;
|
||||
import com.api.browser.service.BrowserService;
|
||||
import com.api.browser.util.BoolAttr;
|
||||
import com.api.browser.util.BrowserConstant;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
import com.api.browser.util.ConditionType;
|
||||
import com.api.browser.util.SplitTableUtil;
|
||||
import com.api.browser.util.SqlUtils;
|
||||
import com.engine.kq.biz.KQGroupComInfo;
|
||||
import com.engine.kq.biz.KQGroupMemberComInfo;
|
||||
import com.engine.kq.entity.KQGroupEntity;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.engine.kq.log.KQLog;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 排班考勤流程使用的班次浏览按钮
|
||||
* type : kqshift
|
||||
*/
|
||||
public class ShiftBrowser4FlowService extends BrowserService {
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) throws Exception {
|
||||
kqLog.info("params:::::::::::"+JSON.toJSONString(params));
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
String serial = Util.null2String(params.get("serial"));
|
||||
String resourceId = Util.null2String(params.get("resourceId"));
|
||||
boolean isBindGroup = "1".equals(Util.null2String(params.get("isBindGroup"))); // 0:未绑定考勤组; 1:绑定了考勤组
|
||||
String fromDate = Util.null2String(params.get("fromDate"));
|
||||
if(fromDate.length() == 0){
|
||||
fromDate = DateUtil.getCurrentDate();
|
||||
}
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
|
||||
String sqlwhere = " where 1=1 and (isdelete is null or isdelete <> '1') ";
|
||||
if(!serial.equals("")){
|
||||
sqlwhere += " and serial like '%";
|
||||
sqlwhere += Util.fromScreen2(serial,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
KQGroupEntity kQGroupEntity = null;
|
||||
if(isBindGroup) {
|
||||
String groupId = Util.null2String(params.get("groupId"));
|
||||
if("".equals(groupId)) { // 绑定了考勤组,但是没有填写考勤组数据的话,返回空
|
||||
sqlwhere = " where 1=2 ";
|
||||
} else {
|
||||
kQGroupEntity = getUserKQGroupInfo(groupId);
|
||||
}
|
||||
} else {
|
||||
kQGroupEntity = kqGroupMemberComInfo.getUserKQGroupInfo(resourceId,fromDate,true);
|
||||
}
|
||||
if(kQGroupEntity == null){
|
||||
sqlwhere = " where 1=2 ";
|
||||
}else{
|
||||
writeLog("kQGroupEntity:"+JSON.toJSONString(kQGroupEntity));
|
||||
String kqtype = kQGroupEntity.getKqtype();
|
||||
if ("2".equalsIgnoreCase(kqtype)) {
|
||||
String serialids = kQGroupEntity.getSerialids();
|
||||
if (serialids.length() > 0) {
|
||||
sqlwhere += " and ( "+Util.getSubINClause(serialids, "id", "in")+" or id = -1 )";
|
||||
}else{
|
||||
sqlwhere += " and (1=2 or or id = -1)";
|
||||
}
|
||||
}else{
|
||||
sqlwhere = " where 1=2 ";
|
||||
}
|
||||
}
|
||||
|
||||
sqlwhere = SqlUtils.replaceFirstAnd(sqlwhere);
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,id as aliasid,serial ";
|
||||
String fromSql = " kq_ShiftManagement_view ";
|
||||
String sql = "select "+backFields+" from "+fromSql+" "+sqlwhere;
|
||||
kqLog.info("sql:::::::::"+sql);
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true","id"));
|
||||
cols.add(new SplitTableColBean("50%",SystemEnv.getHtmlLabelName(125818, user.getLanguage()),"serial","serial").setIsInputCol(BoolAttr.TRUE));
|
||||
cols.add(new SplitTableColBean("50%",SystemEnv.getHtmlLabelName(27961,user.getLanguage()),"aliasid","aliasid","com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit.getShiftOnOffWorkSections",user.getLanguage()+"").setIsInputCol(BoolAttr.FALSE));
|
||||
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields,fromSql,sqlwhere,"id","id","asc",cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 125818, "serial", true));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
private KQGroupEntity getUserKQGroupInfo(String groupid) {
|
||||
KQGroupEntity kqGroupEntity = null;
|
||||
KQGroupComInfo kqGroupComInfo = new KQGroupComInfo();
|
||||
try {
|
||||
if (groupid.length() > 0) {
|
||||
kqGroupEntity = new KQGroupEntity();
|
||||
kqGroupEntity.setId(groupid);
|
||||
kqGroupEntity.setGroupname(kqGroupComInfo.getGroupname(groupid));
|
||||
kqGroupEntity.setExcludeid(kqGroupComInfo.getExcludeid(groupid));
|
||||
kqGroupEntity.setSubcompanyid(kqGroupComInfo.getSubcompanyid(groupid));
|
||||
kqGroupEntity.setKqtype(kqGroupComInfo.getKqtype(groupid));
|
||||
kqGroupEntity.setSerialids(kqGroupComInfo.getSerialids(groupid));
|
||||
kqGroupEntity.setWeekday(kqGroupComInfo.getWeekday(groupid));
|
||||
kqGroupEntity.setSignstart(kqGroupComInfo.getSignstart(groupid));
|
||||
kqGroupEntity.setWorkhour(kqGroupComInfo.getWorkhour(groupid));
|
||||
kqGroupEntity.setIsdelete(kqGroupComInfo.getIsdelete(groupid));
|
||||
kqGroupEntity.setSignintype(kqGroupComInfo.getSignintype(groupid));
|
||||
kqGroupEntity.setIpscope(kqGroupComInfo.getIpscope(groupid));
|
||||
kqGroupEntity.setLocationcheck(kqGroupComInfo.getLocationcheck(groupid));
|
||||
kqGroupEntity.setLocationcheckscope(kqGroupComInfo.getLocationcheckscope(groupid));
|
||||
kqGroupEntity.setWificheck(kqGroupComInfo.getWificheck(groupid));
|
||||
kqGroupEntity.setOutsidesign(kqGroupComInfo.getOutsidesign(groupid));
|
||||
kqGroupEntity.setOutsignapprove(kqGroupComInfo.getOutsignApprove(groupid));
|
||||
kqGroupEntity.setCalmethod(kqGroupComInfo.getCalmethod(groupid));
|
||||
kqGroupEntity.setLocationshowaddress(kqGroupComInfo.getLocationshowaddress(groupid));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return kqGroupEntity;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
package com.api.kq.browser.service.impl;
|
||||
|
||||
import com.api.browser.bean.ListHeadBean;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SplitTableBean;
|
||||
import com.api.browser.bean.SplitTableColBean;
|
||||
import com.api.browser.service.BrowserService;
|
||||
import com.api.browser.util.BoolAttr;
|
||||
import com.api.browser.util.BrowserConstant;
|
||||
import com.api.browser.util.BrowserDataType;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
import com.api.browser.util.ConditionType;
|
||||
import com.api.browser.util.SplitTableUtil;
|
||||
import com.api.browser.util.SqlUtils;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 班次浏览按钮
|
||||
* type : kqshift
|
||||
*/
|
||||
public class ShiftBrowserService extends BrowserService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
String serial = Util.null2String(params.get("serial"));
|
||||
String sqlWhere = Util.null2String(params.get("sqlWhere"));
|
||||
String sqlwhere = " where 1=1 and (isdelete is null or isdelete <> '1') ";
|
||||
if(!serial.equals("")){
|
||||
sqlwhere += " and serial like '%";
|
||||
sqlwhere += Util.fromScreen2(serial,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!sqlWhere.equals("")){
|
||||
sqlwhere += " and "+sqlWhere;
|
||||
}
|
||||
sqlwhere = SqlUtils.replaceFirstAnd(sqlwhere);
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,id as aliasid,serial ";
|
||||
String fromSql = " kq_ShiftManagement ";
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true","id"));
|
||||
cols.add(new SplitTableColBean("50%",SystemEnv.getHtmlLabelName(125818, user.getLanguage()),"serial","serial").setIsInputCol(BoolAttr.TRUE));
|
||||
cols.add(new SplitTableColBean("50%",SystemEnv.getHtmlLabelName(27961,user.getLanguage()),"aliasid","aliasid","com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit.getShiftOnOffWorkSections",user.getLanguage()+""));
|
||||
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields,fromSql,sqlwhere,"id","id","asc",cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 125818, "serial", true));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMultBrowserDestData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<Map<String,Object>> datas = new ArrayList<Map<String,Object>>();
|
||||
String selectids = Util.null2String(params.get(BrowserConstant.BROWSER_MULT_DEST_SELECTIDS));
|
||||
if(user == null || "".equals(selectids)) return apidatas;
|
||||
RecordSet rs = new RecordSet();
|
||||
String selSql = "select * from kq_ShiftManagement ";
|
||||
String sqlwhere = " where 1=1 ";
|
||||
String[] ids = Util.splitString(selectids, ",");
|
||||
if(selectids.length() > 0){
|
||||
sqlwhere += " and "+Util.getSubINClause(selectids, "id", "in");
|
||||
}
|
||||
rs.executeSql(selSql+sqlwhere);
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
while (rs.next()){
|
||||
Map<String,Object> item = new HashMap<String,Object>();
|
||||
String id = rs.getString("id");
|
||||
item.put("id", id);
|
||||
item.put("aliasid", Util.null2String(shiftManagementToolKit.getShiftOnOffWorkSections(id,user.getLanguage())));
|
||||
item.put("serial", Util.null2String(rs.getString("serial")));
|
||||
datas.add(item);
|
||||
}
|
||||
|
||||
List<ListHeadBean> tableHeadColumns = new ArrayList<ListHeadBean>();
|
||||
tableHeadColumns.add(new ListHeadBean("id","").setHide(BoolAttr.TRUE));
|
||||
tableHeadColumns.add(new ListHeadBean("serial",""));
|
||||
tableHeadColumns.add(new ListHeadBean("aliasid","",1,BoolAttr.TRUE));
|
||||
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_COLUMN, tableHeadColumns);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_DATA, datas);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_TYPE, BrowserDataType.LIST_ALL_DATA.getTypeid());
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> browserAutoComplete(
|
||||
HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
String serial=Util.null2s(request.getParameter("q"),"");
|
||||
String outSqlWhere=Util.null2s(request.getParameter("sqlWhere"),"");
|
||||
RecordSet rs=new RecordSet();
|
||||
String sqlwhere = " where 1=1 ";
|
||||
if(!serial.equals("")){
|
||||
sqlwhere += " and serial like '%";
|
||||
sqlwhere += Util.fromScreen2(serial,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!outSqlWhere.equals("")){
|
||||
sqlwhere += " and "+outSqlWhere;
|
||||
}
|
||||
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,id as aliasid,serial ";
|
||||
String fromSql = " kq_ShiftManagement ";
|
||||
String sql = "select "+backFields+" from "+fromSql+sqlwhere;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
List<Map<String,String>> datas = new ArrayList<Map<String,String>>();
|
||||
while(rs.next()){
|
||||
Map<String,String> item = new HashMap<String,String>();
|
||||
item.put("id", Util.null2String(rs.getString("id")));
|
||||
String name = Util.null2String(rs.getString("serial"));
|
||||
item.put("name", name);
|
||||
datas.add(item);
|
||||
}
|
||||
apidatas.put("datas",datas);
|
||||
return apidatas;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.api.kq.browser.service.impl.jucailin;
|
||||
|
||||
import com.api.browser.bean.*;
|
||||
import com.api.browser.service.BrowserService;
|
||||
import com.api.browser.util.*;
|
||||
import com.engine.kq.util.TransMethod;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.moduledetach.ManageDetachComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import weaver.systeminfo.systemright.CheckSubCompanyRight;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 周期设置浏览按钮
|
||||
* type : KQGroup
|
||||
*/
|
||||
public class KQCycleSetBrowserService extends BrowserService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
String cyclename = Util.null2String(params.get("cyclename"));
|
||||
|
||||
String sqlWhere = Util.null2String(params.get("sqlWhere"));
|
||||
String sqlwhere = " where 1=1 and (isdelete is null or isdelete <> '1') ";
|
||||
if(!cyclename.equals("")){
|
||||
sqlwhere += " and cyclename like '%";
|
||||
sqlwhere += Util.fromScreen2(cyclename,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
if(!sqlWhere.equals("")){
|
||||
sqlwhere += " and "+sqlWhere;
|
||||
}
|
||||
|
||||
sqlwhere = SqlUtils.replaceFirstAnd(sqlwhere);
|
||||
// 设置好搜索条件
|
||||
String backFields = " id ,cyclename ";
|
||||
String fromSql = " kq_cycle_setting ";
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
cols.add(new SplitTableColBean("true","id"));
|
||||
cols.add(new SplitTableColBean("100%",SystemEnv.getHtmlLabelName(388722, user.getLanguage()),"cyclename","cyclename").setIsInputCol(BoolAttr.TRUE).setShowType(1));
|
||||
|
||||
SplitTableBean tableBean = new SplitTableBean(backFields,fromSql,sqlwhere,"id","id","asc",cols);
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 388722, "cyclename", true));
|
||||
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMultBrowserDestData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<Map<String,Object>> datas = new ArrayList<Map<String,Object>>();
|
||||
String selectids = Util.null2String(params.get(BrowserConstant.BROWSER_MULT_DEST_SELECTIDS));
|
||||
if(user==null||"".equals(selectids)){
|
||||
return apidatas;
|
||||
}
|
||||
RecordSet recordSet = new RecordSet();
|
||||
String tempSql = " select id,cyclename from kq_cycle_setting where 1=1 and (isdelete is null or isdelete <> '1') and id in ("+selectids+") ";
|
||||
recordSet.executeQuery(tempSql);
|
||||
while (recordSet.next()){
|
||||
Map<String,Object> item = new HashMap<String,Object>();
|
||||
item.put("id", recordSet.getString("id"));
|
||||
item.put("cyclename", Util.null2String(recordSet.getString("cyclename")));
|
||||
datas.add(item);
|
||||
}
|
||||
List<ListHeadBean> tableHeadColumns = new ArrayList<ListHeadBean>();
|
||||
tableHeadColumns.add(new ListHeadBean("id",BoolAttr.TRUE));
|
||||
tableHeadColumns.add(new ListHeadBean("cyclename","",1,BoolAttr.TRUE));
|
||||
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_COLUMN, tableHeadColumns);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_DATA, datas);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_TYPE, BrowserDataType.LIST_ALL_DATA.getTypeid());
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* Excel导入记录
|
||||
*/
|
||||
@Path("kq/importlog")
|
||||
public class ImportLogAction extends com.engine.kq.web.ImportLogAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/attendanceButton")
|
||||
public class KQAttendanceButtonAction extends com.engine.kq.web.KQAttendanceButtonAction{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/attendanceEvent")
|
||||
public class KQAttendanceEventAction extends com.engine.kq.web.KQAttendanceEventAction {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/kq/wfSetting/statesShedule")
|
||||
public class KQAttendanceSetAction extends com.engine.kq.web.KQAttendanceSetAction{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 加班调休
|
||||
* 单独为客户改造
|
||||
*/
|
||||
@Path("/kq/balancedetail")
|
||||
public class KQBalanceDetailAction extends com.engine.kq.web.KQBalanceDetailAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 假期余额
|
||||
*/
|
||||
@Path("/kq/balanceofleave")
|
||||
public class KQBalanceOfLeaveAction extends com.engine.kq.web.KQBalanceOfLeaveAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 员工假期余额报表
|
||||
*/
|
||||
@Path("/kq/balanceofleaverp")
|
||||
public class KQBalanceOfLeaveRpAction extends com.engine.kq.web.KQBalanceOfLeaveRpAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/group")
|
||||
public class KQGroupAction extends com.engine.kq.web.KQGroupAction {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/grouplocation")
|
||||
public class KQGroupLocationAction extends com.engine.kq.web.KQGroupLocationAction {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/groupmember")
|
||||
public class KQGroupMemberAction extends com.engine.kq.web.KQGroupMemberAction {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/groupwifi")
|
||||
public class KQGroupWifiAction extends com.engine.kq.web.KQGroupWifiAction {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/kq/holidayset")
|
||||
public class KQHolidaySetAction extends com.engine.kq.web.KQHolidaySetAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 假期规则
|
||||
*/
|
||||
@Path("/kq/leaveparental")
|
||||
public class KQLeaveParentalAction extends com.engine.kq.web.KQLeaveParentalAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 假期规则
|
||||
*/
|
||||
@Path("/kq/leaverules")
|
||||
public class KQLeaveRulesAction extends com.engine.kq.web.KQLeaveRulesAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @Auther: Administrator
|
||||
* @Date: 2019-03-12 11:22
|
||||
* @Description:
|
||||
*/
|
||||
@Path("/kq/leavetypes")
|
||||
public class KQLeaveTypesAction extends com.engine.kq.web.KQLeaveTypesAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 前台--人事--我的考勤
|
||||
*/
|
||||
@Path("/kq/myattendance")
|
||||
public class KQMyAttendanceAction extends com.engine.kq.web.KQMyAttendanceAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 原始打卡记录报表
|
||||
*/
|
||||
@Path("/kq/originalpunchrp")
|
||||
public class KQOriginalPunchRpAction extends com.engine.kq.web.KQOriginalPunchRpAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 加班规则
|
||||
*/
|
||||
@Path("/kq/overtimerules")
|
||||
public class KQOvertimeRulesAction extends com.engine.kq.web.KQOvertimeRulesAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/abnormalremindMsg")
|
||||
public class KQRemindMsgAction extends com.engine.kq.web.KQRemindMsgAction{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 考勤提醒
|
||||
* 登录PC端后的弹窗提醒
|
||||
*/
|
||||
@Path("/kq/remindOnPC")
|
||||
public class KQRemindOnPCAction extends com.engine.kq.web.KQRemindOnPCAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/report4e")
|
||||
public class KQReport4EAction extends com.engine.kq.web.KQReport4EAction{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 考勤报表
|
||||
*/
|
||||
@Path("/kq/report")
|
||||
public class KQReportAction extends com.engine.kq.web.KQReportAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 考勤报表明细
|
||||
*/
|
||||
@Path("/kq/report/detail/")
|
||||
public class KQReportDetailAction extends com.engine.kq.web.KQReportDetailAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 勤报表展示列支持定制
|
||||
*/
|
||||
@Path("/hrm/kq/reportFieldDefine")
|
||||
public class KQReportFieldDefineAction extends com.engine.kq.web.KQReportFieldDefineAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 考勤报表权限共享
|
||||
*/
|
||||
@Path("/kq/reportshare")
|
||||
public class KQReportShareAction extends com.engine.kq.web.KQReportShareAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/schedulecode")
|
||||
public class KQScheduleCodeAction extends com.engine.kq.web.KQScheduleCodeAction {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/schedulesignimport")
|
||||
public class KQScheduleSignImportAction extends com.engine.kq.web.KQScheduleSignImportAction {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 考勤-应用设置
|
||||
*/
|
||||
@Path("/kq/settings")
|
||||
public class KQSettingsAction extends com.engine.kq.web.KQSettingsAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 一键开启考勤
|
||||
*/
|
||||
@Path("/kq/setupwizard")
|
||||
public class KQSetupWizardAction extends com.engine.kq.web.KQSetupWizardAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/shiftManagement")
|
||||
public class KQShiftManagementAction extends com.engine.kq.web.KQShiftManagementAction {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/shiftschedulce")
|
||||
public class KQShiftScheduleAction extends com.engine.kq.web.KQShiftScheduleAction{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 出差规则
|
||||
*/
|
||||
@Path("/kq/travelrules")
|
||||
public class KQTravelRulesAction extends com.engine.kq.web.KQTravelRulesAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/hrm/kq/upgrade")
|
||||
public class KQUpgradeAction extends com.engine.kq.web.KQUpgradeAction {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.api.kq.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/kq/resful/")
|
||||
public class KqPunchButton4EAction extends com.engine.kq.web.KqPunchButton4EAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.api.kq.web.jucailin;
|
||||
|
||||
import com.engine.kq.jucailin.web.KQCalendarSettingAction;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @Author: sy
|
||||
* @Description:
|
||||
* @Date: 2024/2/27
|
||||
**/
|
||||
|
||||
@Path("/hrm/kq/jucailin/calendarsetting")
|
||||
@Slf4j
|
||||
public class KQCalendarSettingActionApi extends KQCalendarSettingAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.api.kq.web.jucailin;
|
||||
|
||||
|
||||
import com.engine.kq.jucailin.web.KQCommonAction;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
|
||||
@Path("/hrm/kq/jucailin/common")
|
||||
@Slf4j
|
||||
public class KQCommonActionApi extends KQCommonAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.api.kq.web.jucailin;
|
||||
|
||||
import com.engine.kq.jucailin.web.KQCycleSettingAction;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
|
||||
@Path("/hrm/kq/jucailin/cyclesetting")
|
||||
@Slf4j
|
||||
public class KQCycleSettingActionApi extends KQCycleSettingAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.api.kq.web.jucailin;
|
||||
|
||||
import com.engine.kq.jucailin.web.KQPersonGroupAction;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
|
||||
@Path("/hrm/kq/jucailin/persongroup")
|
||||
@Slf4j
|
||||
public class KQPersonGroupActionApi extends KQPersonGroupAction {
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
/**
|
||||
* 考勤外部数据同步配置信息
|
||||
*/
|
||||
public class ImportSetting {
|
||||
String datasourceid = "";
|
||||
String loginid = "";
|
||||
String workcode = "";
|
||||
String lastname = "";
|
||||
String signdate = "";
|
||||
String signtime = "";
|
||||
String tablename = "";
|
||||
String clientaddress = "";
|
||||
String longitude = "";
|
||||
String latitude = "";
|
||||
String addr = "";
|
||||
String memo = "";
|
||||
|
||||
public String getLoginid() {
|
||||
return loginid;
|
||||
}
|
||||
|
||||
public void setLoginid(String loginid) {
|
||||
this.loginid = loginid;
|
||||
}
|
||||
|
||||
public String getDatasourceid() {
|
||||
return datasourceid;
|
||||
}
|
||||
|
||||
public void setDatasourceid(String datasourceid) {
|
||||
this.datasourceid = datasourceid;
|
||||
}
|
||||
|
||||
public String getWorkcode() {
|
||||
return workcode;
|
||||
}
|
||||
|
||||
public void setWorkcode(String workcode) {
|
||||
this.workcode = workcode;
|
||||
}
|
||||
|
||||
public String getLastname() {
|
||||
return lastname;
|
||||
}
|
||||
|
||||
public void setLastname(String lastname) {
|
||||
this.lastname = lastname;
|
||||
}
|
||||
|
||||
public String getSigndate() {
|
||||
return signdate;
|
||||
}
|
||||
|
||||
public void setSigndate(String signdate) {
|
||||
this.signdate = signdate;
|
||||
}
|
||||
|
||||
public String getSigntime() {
|
||||
return signtime;
|
||||
}
|
||||
|
||||
public void setSigntime(String signtime) {
|
||||
this.signtime = signtime;
|
||||
}
|
||||
|
||||
public String getTablename() {
|
||||
return tablename;
|
||||
}
|
||||
|
||||
public void setTablename(String tablename) {
|
||||
this.tablename = tablename;
|
||||
}
|
||||
|
||||
public String getClientaddress() {
|
||||
return clientaddress;
|
||||
}
|
||||
|
||||
public void setClientaddress(String clientaddress) {
|
||||
this.clientaddress = clientaddress;
|
||||
}
|
||||
|
||||
public String getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(String longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public String getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(String latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public String getAddr() {
|
||||
return addr;
|
||||
}
|
||||
|
||||
public void setAddr(String addr) {
|
||||
this.addr = addr;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public void setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,395 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
import com.engine.kq.biz.*;
|
||||
import com.engine.kq.entity.KQUsageHistoryEntity;
|
||||
import com.engine.kq.jucailin.util.KQDateUtil;
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.file.Prop;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.common.database.dialect.DialectUtil;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 用于调休明细的导入
|
||||
*/
|
||||
public class KQBalanceDetail extends BaseBean {
|
||||
|
||||
/**
|
||||
* 人员ID
|
||||
*/
|
||||
private String resourceId;
|
||||
/**
|
||||
* 人员姓名
|
||||
*/
|
||||
private String lastName;
|
||||
/**
|
||||
* 工号
|
||||
*/
|
||||
private String workCode;
|
||||
/**
|
||||
* 年份
|
||||
*/
|
||||
private String belongYear;
|
||||
/**
|
||||
* 月份
|
||||
*/
|
||||
private String belongMonth;
|
||||
/**
|
||||
* 假期类型ID
|
||||
*/
|
||||
private String leaveRulesId;
|
||||
/**
|
||||
* 操作类型:
|
||||
* 3--加班流程生成调休
|
||||
* 4--打卡数据生成调休
|
||||
* 7--管理员Excel导入
|
||||
*/
|
||||
private String overtimeType = "7";
|
||||
/**
|
||||
* 总数
|
||||
*/
|
||||
private String totalAmount;
|
||||
/**
|
||||
* 已休
|
||||
*/
|
||||
private String usedAmount;
|
||||
/**
|
||||
* 生效日期
|
||||
*/
|
||||
private String effectiveDate;
|
||||
/**
|
||||
* 失效日期
|
||||
*/
|
||||
private String expirationDate;
|
||||
/**
|
||||
* 用户语言
|
||||
*/
|
||||
private int userLanguage = 7;
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyField;
|
||||
/**
|
||||
* 操作者
|
||||
*/
|
||||
private String operator;
|
||||
|
||||
/**
|
||||
* 验证模板数据有效性
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String valExcelData() {
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String allow_negative = Util.null2String(kqSettingsComInfo.getMain_val("allow_negative"),"0");
|
||||
String errorInfo = "";
|
||||
if (!isExist()) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(83535, userLanguage);//人员未找到
|
||||
return errorInfo;
|
||||
}
|
||||
if (this.belongYear == null || this.belongYear.equals("")) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005283,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
Pattern p_belongYear = Pattern.compile("^\\d{4}$");
|
||||
Matcher m_belongYear = p_belongYear.matcher(this.belongYear);
|
||||
if (!m_belongYear.matches()) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005284,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
if (this.belongMonth == null || this.belongMonth.equals("")) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005285,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
Pattern p_belongMonth = Pattern.compile("^01|02|03|04|05|06|07|08|09|10|11|12$");
|
||||
Matcher m_belongMonth = p_belongMonth.matcher(this.belongMonth);
|
||||
if (!m_belongMonth.matches()) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005286,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
double _totalAmount = Util.getDoubleValue(this.totalAmount, 0.00);
|
||||
if (!"1".equals(allow_negative) && _totalAmount < 0) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005287,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
double _usedAmount = Util.getDoubleValue(this.usedAmount, 0.00);
|
||||
if (_usedAmount < 0) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005288,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
if (!"1".equals(allow_negative) && (_totalAmount < _usedAmount)) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(508124,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
if (this.leaveRulesId.equals("")) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005289,weaver.general.ThreadVarLanguage.getLang())+"ID";
|
||||
return errorInfo;
|
||||
}
|
||||
if (this.effectiveDate == null || this.effectiveDate.equals("")) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005290,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
Pattern p = Pattern.compile("^\\d{4}\\-\\d{2}\\-\\d{2}$");
|
||||
Matcher m = p.matcher(this.effectiveDate);
|
||||
if (!m.matches()) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005291,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
if (this.expirationDate == null || this.effectiveDate.equals("")) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005292,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
m = p.matcher(this.expirationDate);
|
||||
if (!m.matches()) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005293,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
if (this.effectiveDate.compareTo(this.expirationDate) > 0) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005294,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
if(checkDate(this.expirationDate)){
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005293,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
if(checkDate(this.effectiveDate)){
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005291,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断ID和姓名是否匹配,系统中是否存在此人员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isExist() {
|
||||
String sql = "select 1 from HrmResource where id=? ";
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeQuery(sql, resourceId);
|
||||
if (recordSet.next()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 判断日期字段是否符合正常
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean checkDate(String expirationDate) {
|
||||
try {
|
||||
LocalDate localDate = LocalDate.parse(expirationDate);
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String save() {
|
||||
String resultStr = "false";
|
||||
try {
|
||||
/*获取当前日期,当前时间*/
|
||||
Calendar today = Calendar.getInstance();
|
||||
String currentDate = Util.add0(today.get(Calendar.YEAR), 4) + "-" +
|
||||
Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" +
|
||||
Util.add0(today.get(Calendar.DAY_OF_MONTH), 2);
|
||||
String currentTime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" +
|
||||
Util.add0(today.get(Calendar.MINUTE), 2) + ":" +
|
||||
Util.add0(today.get(Calendar.SECOND), 2);
|
||||
|
||||
KQLeaveRulesComInfo rulesComInfo = new KQLeaveRulesComInfo();
|
||||
KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
String subCompanyId = resourceComInfo.getSubCompanyID(resourceId);
|
||||
String departmentId = resourceComInfo.getDepartmentID(resourceId);
|
||||
String minimumUnit = rulesComInfo.getMinimumUnit(this.leaveRulesId);
|
||||
|
||||
int changeType = KQOvertimeRulesBiz.getChangeType(this.resourceId, this.effectiveDate);
|
||||
String order = KQBalanceOfLeaveBiz.getDeductOrder("" + changeType, detailComInfo.getId(leaveRulesId, subCompanyId, departmentId, resourceId));
|
||||
if(Util.getIntValue(order) <= 0){
|
||||
order = "";
|
||||
}
|
||||
|
||||
Timestamp date = KQDateUtil.getUpdateTimeStamp();
|
||||
String sql = "INSERT INTO KQ_BalanceOfLeave(resourceId,leaveRulesId,belongYear,belongMonth,overtimeType,baseAmount,extraAmount,usedAmount,effectiveDate,expirationDate,create_time,update_time,creator,changetype,deductorder) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
RecordSet recordSet = new RecordSet();
|
||||
if (recordSet.getDBType().equals("postgresql")) {
|
||||
sql = "INSERT INTO KQ_BalanceOfLeave(resourceId,leaveRulesId,belongYear,belongMonth,overtimeType,baseAmount,extraAmount,usedAmount,effectiveDate,expirationDate,create_time,update_time,creator,changetype,deductorder) VALUES(?,?,?,?,?,?,?,?,?,?,?::timestamp,?::timestamp,?,?,?)";
|
||||
}
|
||||
boolean flag = recordSet.executeUpdate(sql, this.resourceId, this.leaveRulesId, this.belongYear, this.belongMonth, this.overtimeType, 0, this.totalAmount, this.usedAmount, this.effectiveDate, this.expirationDate, date, date, Util.getIntValue(resourceId), changeType, order);
|
||||
resultStr = String.valueOf(flag);
|
||||
if (flag) {
|
||||
BigDecimal _totalAmount = new BigDecimal(this.totalAmount);
|
||||
BigDecimal _usedAmount = new BigDecimal(this.usedAmount);
|
||||
|
||||
/*员工假期余额变更记录*/
|
||||
KQUsageHistoryEntity usageHistoryEntity = new KQUsageHistoryEntity();
|
||||
List<KQUsageHistoryEntity> usageHistoryEntityList = new ArrayList<KQUsageHistoryEntity>();
|
||||
|
||||
/*员工假期余额变更记录*/
|
||||
usageHistoryEntity = new KQUsageHistoryEntity();
|
||||
usageHistoryEntity.setLeaveRulesId(this.leaveRulesId);
|
||||
usageHistoryEntity.setRelatedId(this.resourceId);
|
||||
usageHistoryEntity.setWfRequestId("");
|
||||
usageHistoryEntity.setOperator(this.operator);
|
||||
usageHistoryEntity.setOperateDate(currentDate);
|
||||
usageHistoryEntity.setOperateTime(currentTime);
|
||||
usageHistoryEntity.setOperateType("7");
|
||||
usageHistoryEntity.setInsertOrUpdate("INSERT");
|
||||
usageHistoryEntity.setBelongYear(this.belongYear);
|
||||
usageHistoryEntity.setOldExtraAmount("0");
|
||||
usageHistoryEntity.setNewExtraAmount(_totalAmount.subtract(_usedAmount).setScale(2, RoundingMode.HALF_UP).toPlainString());
|
||||
usageHistoryEntity.setOldMinimumUnit(minimumUnit);
|
||||
usageHistoryEntity.setNewMinimumUnit(minimumUnit);
|
||||
usageHistoryEntityList.add(usageHistoryEntity);
|
||||
KQUsageHistoryBiz usageHistoryBiz = new KQUsageHistoryBiz();
|
||||
flag = usageHistoryBiz.save(usageHistoryEntityList);
|
||||
|
||||
resultStr = String.valueOf(flag);
|
||||
/*员工假期余额变更记录*/
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
public String getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
public void setResourceId(String resourceId) {
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getWorkCode() {
|
||||
return workCode;
|
||||
}
|
||||
|
||||
public void setWorkCode(String workCode) {
|
||||
this.workCode = workCode;
|
||||
}
|
||||
|
||||
public String getBelongYear() {
|
||||
return belongYear;
|
||||
}
|
||||
|
||||
public void setBelongYear(String belongYear) {
|
||||
this.belongYear = belongYear;
|
||||
}
|
||||
|
||||
public String getBelongMonth() {
|
||||
return belongMonth;
|
||||
}
|
||||
|
||||
public void setBelongMonth(String belongMonth) {
|
||||
this.belongMonth = belongMonth;
|
||||
}
|
||||
|
||||
public String getLeaveRulesId() {
|
||||
return leaveRulesId;
|
||||
}
|
||||
|
||||
public void setLeaveRulesId(String leaveRulesId) {
|
||||
this.leaveRulesId = leaveRulesId;
|
||||
}
|
||||
|
||||
public String getOvertimeType() {
|
||||
return overtimeType;
|
||||
}
|
||||
|
||||
public void setOvertimeType(String overtimeType) {
|
||||
this.overtimeType = overtimeType;
|
||||
}
|
||||
|
||||
public String getTotalAmount() {
|
||||
return totalAmount;
|
||||
}
|
||||
|
||||
public void setTotalAmount(String totalAmount) {
|
||||
BigDecimal _totalAmount = new BigDecimal(Util.getDoubleValue(totalAmount, 0));
|
||||
this.totalAmount = _totalAmount.setScale(2, RoundingMode.HALF_UP).toPlainString();
|
||||
}
|
||||
|
||||
public String getUsedAmount() {
|
||||
return usedAmount;
|
||||
}
|
||||
|
||||
public void setUsedAmount(String usedAmount) {
|
||||
BigDecimal _usedAmount = new BigDecimal(Util.getDoubleValue(usedAmount, 0));
|
||||
this.usedAmount = _usedAmount.setScale(2, RoundingMode.HALF_UP).toPlainString();
|
||||
}
|
||||
|
||||
public String getEffectiveDate() {
|
||||
return effectiveDate;
|
||||
}
|
||||
|
||||
public void setEffectiveDate(String effectiveDate) {
|
||||
this.effectiveDate = effectiveDate;
|
||||
}
|
||||
|
||||
public String getExpirationDate() {
|
||||
return expirationDate;
|
||||
}
|
||||
|
||||
public void setExpirationDate(String expirationDate) {
|
||||
this.expirationDate = expirationDate;
|
||||
}
|
||||
|
||||
public int getUserLanguage() {
|
||||
return userLanguage;
|
||||
}
|
||||
|
||||
public void setUserLanguage(int userLanguage) {
|
||||
this.userLanguage = userLanguage;
|
||||
}
|
||||
|
||||
public void setUserLanguage(String userLanguage) {
|
||||
this.userLanguage = Util.getIntValue(userLanguage, 7);
|
||||
}
|
||||
|
||||
public String getKeyField() {
|
||||
return keyField;
|
||||
}
|
||||
|
||||
public void setKeyField(String keyField) {
|
||||
this.keyField = keyField;
|
||||
}
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,360 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
import com.engine.kq.biz.KQLeaveRulesComInfo;
|
||||
import com.engine.kq.biz.KQLeaveRulesDetailComInfo;
|
||||
import com.engine.kq.biz.KQSettingsComInfo;
|
||||
import com.engine.kq.biz.KQUsageHistoryBiz;
|
||||
import com.engine.kq.entity.KQUsageHistoryEntity;
|
||||
import com.weaver.general.TimeUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 用于调休明细的导入
|
||||
*/
|
||||
public class KQBalanceDetail2 extends BaseBean {
|
||||
|
||||
/**
|
||||
* 人员ID
|
||||
*/
|
||||
private String resourceId;
|
||||
/**
|
||||
* 人员姓名
|
||||
*/
|
||||
private String lastName;
|
||||
/**
|
||||
* 工号
|
||||
*/
|
||||
private String workCode;
|
||||
/**
|
||||
* 年份
|
||||
*/
|
||||
private String belongYear;
|
||||
|
||||
/**
|
||||
* 假期类型ID
|
||||
*/
|
||||
private String leaveRulesId;
|
||||
/**
|
||||
* 操作类型:
|
||||
* 3--加班流程生成调休
|
||||
* 4--打卡数据生成调休
|
||||
* 7--管理员Excel导入
|
||||
*/
|
||||
private String overtimeType = "7";
|
||||
/**
|
||||
* 育儿假基数
|
||||
*/
|
||||
private String baseAmount;
|
||||
/**
|
||||
* 额外
|
||||
*/
|
||||
private String extraAmount;
|
||||
/**
|
||||
* 已休
|
||||
*/
|
||||
private String usedAmount;
|
||||
/**
|
||||
* 生效日期
|
||||
*/
|
||||
private String effectiveDate;
|
||||
|
||||
/**
|
||||
* 用户语言
|
||||
*/
|
||||
private int userLanguage = 7;
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyField;
|
||||
/**
|
||||
* 操作者
|
||||
*/
|
||||
private String operator;
|
||||
|
||||
public String getBaseAmount() {
|
||||
return baseAmount;
|
||||
}
|
||||
|
||||
public void setBaseAmount(String baseAmount) {
|
||||
this.baseAmount = baseAmount;
|
||||
}
|
||||
|
||||
public String getExtraAmount() {
|
||||
return extraAmount;
|
||||
}
|
||||
|
||||
public void setExtraAmount(String extraAmount) {
|
||||
this.extraAmount = extraAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证模板数据有效性
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String valExcelData() {
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String allow_negative = Util.null2String(kqSettingsComInfo.getMain_val("allow_negative"),"0");
|
||||
String errorInfo = "";
|
||||
if (!isExist()) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(83535, userLanguage);//人员未找到
|
||||
return errorInfo;
|
||||
}
|
||||
if (this.belongYear == null || this.belongYear.equals("")) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005283,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
double _baseAmount = Util.getDoubleValue(this.baseAmount, 0.00);
|
||||
if (!"1".equals(allow_negative) && _baseAmount < 0) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005287,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
if (this.leaveRulesId.equals("")) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005289,weaver.general.ThreadVarLanguage.getLang())+"ID";
|
||||
return errorInfo;
|
||||
}
|
||||
if (this.effectiveDate == null || this.effectiveDate.equals("")) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005290,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
Pattern p = Pattern.compile("^\\d{4}\\-\\d{2}\\-\\d{2}$");
|
||||
Matcher m = p.matcher(this.effectiveDate);
|
||||
if (!m.matches()) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005291,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
if (this.effectiveDate.equals("")) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005292,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
if(checkDate(this.effectiveDate)){
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005291,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断ID和姓名是否匹配,系统中是否存在此人员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isExist() {
|
||||
String sql = "select 1 from HrmResource where id=? ";
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeQuery(sql, resourceId);
|
||||
if (recordSet.next()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 判断日期字段是否符合正常
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean checkDate(String expirationDate) {
|
||||
try {
|
||||
LocalDate localDate = LocalDate.parse(expirationDate);
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String save() {
|
||||
String resultStr = "false";
|
||||
try {
|
||||
/*获取当前日期,当前时间*/
|
||||
Calendar today = Calendar.getInstance();
|
||||
String currentDate = Util.add0(today.get(Calendar.YEAR), 4) + "-" +
|
||||
Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" +
|
||||
Util.add0(today.get(Calendar.DAY_OF_MONTH), 2);
|
||||
String currentTime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" +
|
||||
Util.add0(today.get(Calendar.MINUTE), 2) + ":" +
|
||||
Util.add0(today.get(Calendar.SECOND), 2);
|
||||
|
||||
//假期规则缓存类
|
||||
KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
|
||||
KQLeaveRulesComInfo rulesComInfo = new KQLeaveRulesComInfo();
|
||||
String minimumUnit = rulesComInfo.getMinimumUnit(this.leaveRulesId);
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
|
||||
String subcompanyId = resourceComInfo.getSubCompanyID(this.resourceId);
|
||||
String departmentId = resourceComInfo.getDepartmentID(this.resourceId);
|
||||
int validityRule = Util.getIntValue(detailComInfo.getValidityRule(this.leaveRulesId, subcompanyId, departmentId, resourceId));
|
||||
String expirationDate = "2222-12-31";
|
||||
if (validityRule != 0) {
|
||||
expirationDate = TimeUtil.dateAdd(TimeUtil.yearAdd(this.effectiveDate, 1), -1);
|
||||
}
|
||||
String baseAmountValue=Util.null2s(this.baseAmount,"0");
|
||||
String extraAmountValue=Util.null2s(this.extraAmount,"0");
|
||||
String usedAmountValue=Util.null2s(this.usedAmount,"0");
|
||||
String sql = "INSERT INTO KQ_BalanceOfLeave(resourceId,leaveRulesId,belongYear,overtimeType,baseAmount,extraAmount,usedAmount,effectiveDate,expirationDate) VALUES(?,?,?,?,?,?,?,?,?)";
|
||||
RecordSet recordSet = new RecordSet();
|
||||
boolean flag = recordSet.executeUpdate(sql, this.resourceId, this.leaveRulesId, this.belongYear, this.overtimeType,baseAmountValue,extraAmountValue, usedAmountValue, this.effectiveDate, expirationDate);
|
||||
resultStr = String.valueOf(flag);
|
||||
if (flag) {
|
||||
BigDecimal _baseAmount = new BigDecimal(baseAmountValue);
|
||||
BigDecimal _extraAmount = new BigDecimal(extraAmountValue);
|
||||
BigDecimal _usedAmount = new BigDecimal(usedAmountValue);
|
||||
|
||||
/*员工假期余额变更记录*/
|
||||
KQUsageHistoryEntity usageHistoryEntity = new KQUsageHistoryEntity();
|
||||
List<KQUsageHistoryEntity> usageHistoryEntityList = new ArrayList<KQUsageHistoryEntity>();
|
||||
String balanceOfLeaveId = "";
|
||||
//获取刚才插入的调休明细的ID
|
||||
sql = "select max(id) from kq_balanceOfLeave where leaveRulesId=? and resourceId=? and belongYear=?";
|
||||
recordSet.executeQuery(sql, this.leaveRulesId, this.resourceId, this.belongYear);
|
||||
if (recordSet.next()) {
|
||||
balanceOfLeaveId = recordSet.getString(1);
|
||||
}
|
||||
|
||||
/*员工假期余额变更记录*/
|
||||
usageHistoryEntity = new KQUsageHistoryEntity();
|
||||
usageHistoryEntity.setLeaveRulesId(this.leaveRulesId);
|
||||
usageHistoryEntity.setRelatedId(this.resourceId);
|
||||
usageHistoryEntity.setWfRequestId("");
|
||||
usageHistoryEntity.setOperator(this.operator);
|
||||
usageHistoryEntity.setOperateDate(currentDate);
|
||||
usageHistoryEntity.setOperateTime(currentTime);
|
||||
usageHistoryEntity.setOperateType("7");
|
||||
usageHistoryEntity.setInsertOrUpdate("INSERT");
|
||||
usageHistoryEntity.setBelongYear(this.belongYear);
|
||||
usageHistoryEntity.setOldExtraAmount("0");
|
||||
usageHistoryEntity.setOldBaseAmount("0");
|
||||
usageHistoryEntity.setOldUsedAmount("0");
|
||||
usageHistoryEntity.setNewUsedAmount(_usedAmount.toString());
|
||||
usageHistoryEntity.setNewBaseAmount(_baseAmount.toString());
|
||||
usageHistoryEntity.setNewExtraAmount(_extraAmount.setScale(2, RoundingMode.HALF_UP).toPlainString());
|
||||
usageHistoryEntity.setOldMinimumUnit(minimumUnit);
|
||||
usageHistoryEntity.setNewMinimumUnit(minimumUnit);
|
||||
usageHistoryEntity.setBalanceOfLeaveId(balanceOfLeaveId);
|
||||
usageHistoryEntityList.add(usageHistoryEntity);
|
||||
KQUsageHistoryBiz usageHistoryBiz = new KQUsageHistoryBiz();
|
||||
flag = usageHistoryBiz.save(usageHistoryEntityList);
|
||||
|
||||
resultStr = String.valueOf(flag);
|
||||
/*员工假期余额变更记录*/
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
public String getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
public void setResourceId(String resourceId) {
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getWorkCode() {
|
||||
return workCode;
|
||||
}
|
||||
|
||||
public void setWorkCode(String workCode) {
|
||||
this.workCode = workCode;
|
||||
}
|
||||
|
||||
public String getBelongYear() {
|
||||
return belongYear;
|
||||
}
|
||||
|
||||
public void setBelongYear(String belongYear) {
|
||||
this.belongYear = belongYear;
|
||||
}
|
||||
|
||||
public String getLeaveRulesId() {
|
||||
return leaveRulesId;
|
||||
}
|
||||
|
||||
public void setLeaveRulesId(String leaveRulesId) {
|
||||
this.leaveRulesId = leaveRulesId;
|
||||
}
|
||||
|
||||
public String getOvertimeType() {
|
||||
return overtimeType;
|
||||
}
|
||||
|
||||
public void setOvertimeType(String overtimeType) {
|
||||
this.overtimeType = overtimeType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getUsedAmount() {
|
||||
return usedAmount;
|
||||
}
|
||||
|
||||
public void setUsedAmount(String usedAmount) {
|
||||
BigDecimal _usedAmount = new BigDecimal(Util.getDoubleValue(usedAmount, 0));
|
||||
this.usedAmount = _usedAmount.setScale(2, RoundingMode.HALF_UP).toPlainString();
|
||||
}
|
||||
|
||||
public String getEffectiveDate() {
|
||||
return effectiveDate;
|
||||
}
|
||||
|
||||
public void setEffectiveDate(String effectiveDate) {
|
||||
this.effectiveDate = effectiveDate;
|
||||
}
|
||||
|
||||
public int getUserLanguage() {
|
||||
return userLanguage;
|
||||
}
|
||||
|
||||
public void setUserLanguage(int userLanguage) {
|
||||
this.userLanguage = userLanguage;
|
||||
}
|
||||
|
||||
public void setUserLanguage(String userLanguage) {
|
||||
this.userLanguage = Util.getIntValue(userLanguage, 7);
|
||||
}
|
||||
|
||||
public String getKeyField() {
|
||||
return keyField;
|
||||
}
|
||||
|
||||
public void setKeyField(String keyField) {
|
||||
this.keyField = keyField;
|
||||
}
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,479 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
import com.engine.kq.biz.KQLeaveRulesComInfo;
|
||||
import com.engine.kq.biz.KQLeaveRulesDetailComInfo;
|
||||
import com.engine.kq.biz.KQSettingsComInfo;
|
||||
import com.engine.kq.biz.KQUsageHistoryBiz;
|
||||
import com.engine.kq.entity.KQUsageHistoryEntity;
|
||||
import com.engine.kq.jucailin.util.KQDateUtil;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 假期余额--用于Excel导入
|
||||
*/
|
||||
public class KQBalanceOfLeave extends BaseBean {
|
||||
|
||||
/**
|
||||
* 人员ID
|
||||
*/
|
||||
private String resourceId;
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private String workcode ;
|
||||
|
||||
/**
|
||||
* 人员姓名
|
||||
*/
|
||||
private String lastName;
|
||||
/**
|
||||
* 假期类型ID
|
||||
*/
|
||||
private String leaveRulesId;
|
||||
/**
|
||||
* 所属年份
|
||||
*/
|
||||
private String belongYear;
|
||||
/**
|
||||
* (混合模式下为法定年假)假期余额基数
|
||||
*/
|
||||
private double baseAmount = 0.00;
|
||||
/**
|
||||
* (混合模式下为法定年假)已使用的假期余额
|
||||
*/
|
||||
private double usedAmount = 0.00;
|
||||
/**
|
||||
* (混合模式下为法定年假)额外的假期余额
|
||||
*/
|
||||
private double extraAmount = 0.00;
|
||||
/**
|
||||
* (仅混合模式下使用,为福利年假)假期余额基数
|
||||
*/
|
||||
private double baseAmount2 = 0.00;
|
||||
/**
|
||||
* (仅混合模式下使用,为福利年假)已使用的假期余额
|
||||
*/
|
||||
private double usedAmount2 = 0.00;
|
||||
/**
|
||||
* (仅混合模式下使用,为福利年假)额外的假期余额
|
||||
*/
|
||||
private double extraAmount2 = 0.00;
|
||||
/**
|
||||
* 用户语言
|
||||
*/
|
||||
private int userlanguage = 7;
|
||||
/**
|
||||
* 导入Excel的操作者
|
||||
*/
|
||||
private String operator;
|
||||
|
||||
/**
|
||||
* 验证模板数据有效性--用于Excel导入
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String valExcelData() {
|
||||
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String allow_negative = Util.null2String(kqSettingsComInfo.getMain_val("allow_negative"),"0");
|
||||
String errorInfo = "";
|
||||
if (!isExist(resourceId, lastName)) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(389985, userlanguage);//ID和姓名不匹配
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
if (!"1".equals(allow_negative) && this.baseAmount < 0) {
|
||||
errorInfo = "基数不能为负数";
|
||||
return errorInfo;
|
||||
}
|
||||
if (!"1".equals(allow_negative) && this.extraAmount < 0) {
|
||||
errorInfo = "额外不能为负数";
|
||||
return errorInfo;
|
||||
}
|
||||
if (this.usedAmount < 0) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(10005288,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
double _totalAmount = this.baseAmount+this.extraAmount;
|
||||
if (!"1".equals(allow_negative) && _totalAmount < this.usedAmount) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(508124,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
if (!"1".equals(allow_negative) && this.baseAmount2 < 0) {
|
||||
errorInfo = "福利基数不能为负数";
|
||||
return errorInfo;
|
||||
}
|
||||
if (!"1".equals(allow_negative) && this.extraAmount2 < 0) {
|
||||
errorInfo = "福利额外不能为负数";
|
||||
return errorInfo;
|
||||
}
|
||||
if (this.usedAmount2 < 0) {
|
||||
errorInfo = "福利已休不能大于总数";
|
||||
return errorInfo;
|
||||
}
|
||||
double _totalAmount2 = this.baseAmount2+this.extraAmount2;
|
||||
if (!"1".equals(allow_negative) && _totalAmount2 < this.usedAmount2) {
|
||||
errorInfo = ""+ SystemEnv.getHtmlLabelName(508124,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String save() {
|
||||
String resultStr = "false";
|
||||
try {
|
||||
/*获取当前日期,当前时间*/
|
||||
Calendar today = Calendar.getInstance();
|
||||
String currentDate = Util.add0(today.get(Calendar.YEAR), 4) + "-" +
|
||||
Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" +
|
||||
Util.add0(today.get(Calendar.DAY_OF_MONTH), 2);
|
||||
String currentTime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" +
|
||||
Util.add0(today.get(Calendar.MINUTE), 2) + ":" +
|
||||
Util.add0(today.get(Calendar.SECOND), 2);
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
/*获取人员的相关信息*/
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
|
||||
/*分部ID*/
|
||||
String subcompanyId = resourceComInfo.getSubCompanyID(this.resourceId);
|
||||
//部门ID
|
||||
String departmentId = resourceComInfo.getDepartmentID(this.resourceId);
|
||||
/*入职日期*/
|
||||
String companyStartDate = resourceComInfo.getCompanyStartDate(this.resourceId);
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
/*获取假期类型的相关设置*/
|
||||
KQLeaveRulesComInfo rulesComInfo = new KQLeaveRulesComInfo();
|
||||
|
||||
/*请假最小单位*/
|
||||
String minimumUnit = rulesComInfo.getMinimumUnit(this.leaveRulesId);
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
/*获取假期规则(一个假期类型下可能存在多个假期规则)的相关设置*/
|
||||
KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
|
||||
|
||||
/*请假时长计算方式:1-按工作日计算请假时长、2-按自然日计算请假时长*/
|
||||
int distributionMode = Util.getIntValue(detailComInfo.getDistributionMode(this.leaveRulesId, subcompanyId, departmentId, this.resourceId), 1);
|
||||
|
||||
/*有效期规则:0-永久有效、1-按自然年(1月1日-12月31日)、2-按入职日期起12个月、3-自定义次年失效日期*/
|
||||
int validityRule = validityRule = Util.getIntValue(detailComInfo.getValidityRule(this.leaveRulesId, subcompanyId, departmentId, this.resourceId), 0);
|
||||
|
||||
/*失效日期--月(当有效期规则选择4-自定义次年失效日期时有效)*/
|
||||
String expirationMonth = detailComInfo.getExpirationMonth(this.leaveRulesId, subcompanyId ,departmentId, this.resourceId);
|
||||
|
||||
/*失效日期--日(当有效期规则选择4-自定义次年失效日期时有效)*/
|
||||
String expirationDay = detailComInfo.getExpirationDay(this.leaveRulesId, subcompanyId, departmentId, this.resourceId);
|
||||
|
||||
/*允许延长有效期:0-不允许、1-允许*/
|
||||
int extensionEnable = Util.getIntValue(detailComInfo.getExtensionEnable(this.leaveRulesId, subcompanyId, departmentId, this.resourceId), 0);
|
||||
|
||||
/*允许超过有效期天数*/
|
||||
int extendedDays = Util.getIntValue(detailComInfo.getExtendedDays(this.leaveRulesId, subcompanyId, departmentId, this.resourceId), 0);
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
/*员工假期余额变更记录*/
|
||||
String insertOrUpdate = "";
|
||||
KQUsageHistoryEntity usageHistoryEntity = new KQUsageHistoryEntity();//员工假期余额变更记录实体类
|
||||
List<KQUsageHistoryEntity> usageHistoryEntityList = new ArrayList<KQUsageHistoryEntity>();//员工假期余额变更记录集合
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
double oldBaseAmount = 0.00;
|
||||
double oldUsedAmount = 0.00;
|
||||
double oldExtraAmount = 0.00;
|
||||
double oldBaseAmount2 = 0.00;
|
||||
double oldUsedAmount2 = 0.00;
|
||||
double oldExtraAmount2 = 0.00;
|
||||
|
||||
double newBaseAmount = 0.00;
|
||||
double newUsedAmount = 0.00;
|
||||
double newExtraAmount = 0.00;
|
||||
double newBaseAmount2 = 0.00;
|
||||
double newUsedAmount2 = 0.00;
|
||||
double newExtraAmount2 = 0.00;
|
||||
int status = 0;
|
||||
String expirationDate = "";
|
||||
|
||||
/*计算有效期 start*/
|
||||
if (validityRule == 0) {
|
||||
/*不限制有效期,默认永久有效*/
|
||||
status = 0;
|
||||
} else if (validityRule == 1) {
|
||||
/*按自然年(1月1日-12月31日)*/
|
||||
if (extensionEnable == 1) {
|
||||
/*允许延长有效期*/
|
||||
expirationDate = DateUtil.addDate(this.belongYear + "-12-31", extendedDays);
|
||||
if (Util.dayDiff(expirationDate, currentDate) > 1) {
|
||||
status = 1;
|
||||
}
|
||||
} else {
|
||||
expirationDate = this.belongYear + "-12-31";
|
||||
if (Util.dayDiff(expirationDate, currentDate) > 1) {
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
} else if (validityRule == 2) {
|
||||
/*按入职日期起12个月*/
|
||||
if (companyStartDate.equals("")) {
|
||||
status = 1;
|
||||
} else if (extensionEnable == 1) {
|
||||
/*允许延长有效期*/
|
||||
expirationDate = DateUtil.addDate((Util.getIntValue(this.belongYear) + 1) + companyStartDate.substring(4), extendedDays);
|
||||
if (Util.dayDiff(expirationDate, currentDate) > 1) {
|
||||
status = 1;
|
||||
}
|
||||
} else {
|
||||
expirationDate = (Util.getIntValue(this.belongYear) + 1) + companyStartDate.substring(4);
|
||||
if (Util.dayDiff(expirationDate, currentDate) > 1) {
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
} else if (validityRule == 3) {
|
||||
/*自定义次年失效日期*/
|
||||
if (extensionEnable == 1) {
|
||||
/*允许延长有效期*/
|
||||
expirationDate = DateUtil.addDate((Util.getIntValue(this.belongYear) + 1) + "-" + expirationMonth + "-" + expirationDay, extendedDays);
|
||||
if (Util.dayDiff(expirationDate, currentDate) > 1) {
|
||||
status = 1;
|
||||
}
|
||||
} else {
|
||||
expirationDate = (Util.getIntValue(this.belongYear) + 1) + "-" + expirationMonth + "-" + expirationDay;
|
||||
if (Util.dayDiff(expirationDate, currentDate) > 1) {
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*计算有效期 end*/
|
||||
|
||||
newBaseAmount = this.baseAmount;
|
||||
newExtraAmount = this.extraAmount;
|
||||
newUsedAmount = this.usedAmount;
|
||||
if (distributionMode == 6) {
|
||||
newBaseAmount2 = this.baseAmount2;
|
||||
newExtraAmount2 = this.extraAmount2;
|
||||
newUsedAmount2 = this.usedAmount2;
|
||||
}
|
||||
|
||||
Timestamp date = KQDateUtil.getUpdateTimeStamp();
|
||||
boolean flag = true;//记录SQL操作是否成功
|
||||
String searchSql = "select * from kq_BalanceOfLeave where leaveRulesId=? and resourceId=? and belongYear=?";
|
||||
String updateSql = "update kq_BalanceOfLeave set baseAmount=?,extraAmount=?,usedAmount=?,baseAmount2=?,extraAmount2=?,usedAmount2=?,status=?,expirationDate=?,update_time=? where leaveRulesId=? and resourceId=? and belongYear=? ";
|
||||
String insertSql = "insert into kq_BalanceOfLeave(baseAmount,extraAmount,usedAmount,baseAmount2,extraAmount2,usedAmount2,status,expirationDate,leaveRulesId,resourceId,belongYear,create_time,update_time,creator) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
|
||||
RecordSet recordSet = new RecordSet();
|
||||
if (recordSet.getDBType().equals("postgresql")) {
|
||||
updateSql = "update kq_BalanceOfLeave set baseAmount=?,extraAmount=?,usedAmount=?,baseAmount2=?,extraAmount2=?,usedAmount2=?,status=?,expirationDate=?,update_time=?::timestamp where leaveRulesId=? and resourceId=? and belongYear=? ";
|
||||
insertSql = "insert into kq_BalanceOfLeave(baseAmount,extraAmount,usedAmount,baseAmount2,extraAmount2,usedAmount2,status,expirationDate,leaveRulesId,resourceId,belongYear,create_time,update_time,creator) values(?,?,?,?,?,?,?,?,?,?,?,?::timestamp,?::timestamp,?) ";
|
||||
}
|
||||
recordSet.executeQuery(searchSql, this.leaveRulesId, this.resourceId, this.belongYear);
|
||||
if (recordSet.next()) {
|
||||
oldBaseAmount = Util.getDoubleValue(recordSet.getString("baseAmount"), 0.00);
|
||||
oldExtraAmount = Util.getDoubleValue(recordSet.getString("extraAmount"), 0.00);
|
||||
oldUsedAmount = Util.getDoubleValue(recordSet.getString("usedAmount"), 0.00);
|
||||
if (distributionMode == 6) {
|
||||
oldBaseAmount2 = Util.getDoubleValue(recordSet.getString("baseAmount2"), 0.00);
|
||||
oldExtraAmount2 = Util.getDoubleValue(recordSet.getString("extraAmount2"), 0.00);
|
||||
oldUsedAmount2 = Util.getDoubleValue(recordSet.getString("usedAmount2"), 0.00);
|
||||
}
|
||||
|
||||
/*更新员工假期余额 start*/
|
||||
flag = recordSet.executeUpdate(updateSql, String.format("%.2f", newBaseAmount), String.format("%.2f", newExtraAmount), String.format("%.2f", newUsedAmount), String.format("%.2f", newBaseAmount2), String.format("%.2f", newExtraAmount2), String.format("%.2f", newUsedAmount2), status, expirationDate,date, this.leaveRulesId, this.resourceId, this.belongYear);
|
||||
resultStr = String.valueOf(flag);
|
||||
if (!flag) {
|
||||
resultStr = "false";
|
||||
return resultStr;
|
||||
}
|
||||
/*更新员工假期余额 end*/
|
||||
|
||||
insertOrUpdate = "update";
|
||||
} else {
|
||||
/*新增员工假期余额 start*/
|
||||
flag = recordSet.executeUpdate(insertSql, String.format("%.2f", newBaseAmount), String.format("%.2f", newExtraAmount), String.format("%.2f", newUsedAmount), String.format("%.2f", newBaseAmount2), String.format("%.2f", newExtraAmount2), String.format("%.2f", newUsedAmount2), status, expirationDate, this.leaveRulesId, this.resourceId, this.belongYear,date,date,Util.getIntValue(resourceId));
|
||||
resultStr = String.valueOf(flag);
|
||||
if (!flag) {
|
||||
return resultStr;
|
||||
}
|
||||
/*新增员工假期余额 end*/
|
||||
|
||||
insertOrUpdate = "insert";
|
||||
}
|
||||
|
||||
/*员工假期余额变更记录 start*/
|
||||
usageHistoryEntity = new KQUsageHistoryEntity();
|
||||
usageHistoryEntity.setLeaveRulesId(this.leaveRulesId);
|
||||
usageHistoryEntity.setRelatedId(this.resourceId);
|
||||
usageHistoryEntity.setWfRequestId("");
|
||||
usageHistoryEntity.setOperator(this.operator);
|
||||
usageHistoryEntity.setOperateDate(currentDate);
|
||||
usageHistoryEntity.setOperateTime(currentTime);
|
||||
usageHistoryEntity.setOperateType("7");
|
||||
usageHistoryEntity.setBelongYear(this.belongYear);
|
||||
usageHistoryEntity.setOldBaseAmount(String.format("%.2f", oldBaseAmount));
|
||||
usageHistoryEntity.setNewBaseAmount(String.format("%.2f", newBaseAmount));
|
||||
usageHistoryEntity.setOldExtraAmount(String.format("%.2f", oldExtraAmount));
|
||||
usageHistoryEntity.setNewExtraAmount(String.format("%.2f", newExtraAmount));
|
||||
usageHistoryEntity.setOldUsedAmount(String.format("%.2f", oldUsedAmount));
|
||||
usageHistoryEntity.setNewUsedAmount(String.format("%.2f", newUsedAmount));
|
||||
usageHistoryEntity.setOldBaseAmount2(String.format("%.2f", oldBaseAmount2));
|
||||
usageHistoryEntity.setNewBaseAmount2(String.format("%.2f", newBaseAmount2));
|
||||
usageHistoryEntity.setOldExtraAmount2(String.format("%.2f", oldExtraAmount2));
|
||||
usageHistoryEntity.setNewExtraAmount2(String.format("%.2f", newExtraAmount2));
|
||||
usageHistoryEntity.setOldUsedAmount2(String.format("%.2f", oldUsedAmount2));
|
||||
usageHistoryEntity.setNewUsedAmount2(String.format("%.2f", newUsedAmount2));
|
||||
usageHistoryEntity.setOldMinimumUnit(minimumUnit);
|
||||
usageHistoryEntity.setNewMinimumUnit(minimumUnit);
|
||||
usageHistoryEntity.setInsertOrUpdate(insertOrUpdate);
|
||||
|
||||
usageHistoryEntityList.add(usageHistoryEntity);
|
||||
KQUsageHistoryBiz usageHistoryBiz = new KQUsageHistoryBiz();
|
||||
flag = usageHistoryBiz.save(usageHistoryEntityList);
|
||||
resultStr = String.valueOf(flag);
|
||||
if (!flag) {
|
||||
return resultStr;
|
||||
}
|
||||
/*员工假期余额变更记录 end*/
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断ID和姓名是否匹配,系统中是否存在此人员
|
||||
*
|
||||
* @param resourceId
|
||||
* @param lastName
|
||||
* @return
|
||||
*/
|
||||
private boolean isExist(String resourceId, String lastName) {
|
||||
String sql = "select 1 from HrmResource where id=? ";
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeQuery(sql, resourceId);
|
||||
if (recordSet.next()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
public void setResourceId(String resourceId) {
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getLeaveRulesId() {
|
||||
return leaveRulesId;
|
||||
}
|
||||
|
||||
public void setLeaveRulesId(String leaveRulesId) {
|
||||
this.leaveRulesId = leaveRulesId;
|
||||
}
|
||||
|
||||
public String getBelongYear() {
|
||||
return belongYear;
|
||||
}
|
||||
|
||||
public void setBelongYear(String belongYear) {
|
||||
this.belongYear = belongYear;
|
||||
}
|
||||
|
||||
public double getBaseAmount() {
|
||||
return baseAmount;
|
||||
}
|
||||
|
||||
public void setBaseAmount(double baseAmount) {
|
||||
this.baseAmount = baseAmount;
|
||||
}
|
||||
|
||||
public double getUsedAmount() {
|
||||
return usedAmount;
|
||||
}
|
||||
|
||||
public void setUsedAmount(double usedAmount) {
|
||||
this.usedAmount = usedAmount;
|
||||
}
|
||||
|
||||
public double getExtraAmount() {
|
||||
return extraAmount;
|
||||
}
|
||||
|
||||
public void setExtraAmount(double extraAmount) {
|
||||
this.extraAmount = extraAmount;
|
||||
}
|
||||
|
||||
public double getBaseAmount2() {
|
||||
return baseAmount2;
|
||||
}
|
||||
|
||||
public void setBaseAmount2(double baseAmount2) {
|
||||
this.baseAmount2 = baseAmount2;
|
||||
}
|
||||
|
||||
public double getUsedAmount2() {
|
||||
return usedAmount2;
|
||||
}
|
||||
|
||||
public void setUsedAmount2(double usedAmount2) {
|
||||
this.usedAmount2 = usedAmount2;
|
||||
}
|
||||
|
||||
public double getExtraAmount2() {
|
||||
return extraAmount2;
|
||||
}
|
||||
|
||||
public void setExtraAmount2(double extraAmount2) {
|
||||
this.extraAmount2 = extraAmount2;
|
||||
}
|
||||
|
||||
public void setUserLanguage(String languageId) {
|
||||
this.userlanguage = Util.getIntValue(languageId, 7);
|
||||
}
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
public String getWorkcode() {
|
||||
return workcode;
|
||||
}
|
||||
|
||||
public void setWorkcode(String workcode) {
|
||||
this.workcode = workcode;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
/**
|
||||
* 排班制考勤组----排班设置权限(数据存储在建模表中)
|
||||
*/
|
||||
public class KQChildrenBean {
|
||||
private String id;
|
||||
|
||||
private String birthday;
|
||||
|
||||
private String title;
|
||||
|
||||
private String resourceid;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(String birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getResourceid() {
|
||||
return resourceid;
|
||||
}
|
||||
|
||||
public void setResourceid(String resourceid) {
|
||||
this.resourceid = resourceid;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,258 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
import com.engine.kq.biz.KQGroupComInfo;
|
||||
import com.engine.kq.biz.KQHolidaySetComInfo;
|
||||
import com.engine.kq.biz.KQHolidaySetThread;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.ThreadVarLanguage;
|
||||
import weaver.general.Util;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 节假日设置--用于Excel导入
|
||||
*/
|
||||
public class KQHolidaySet extends BaseBean {
|
||||
|
||||
/**
|
||||
* 考勤组名称
|
||||
*/
|
||||
private String groupName;
|
||||
/**
|
||||
* 考勤组ID
|
||||
*/
|
||||
private String groupId;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private String holidayDate;
|
||||
/**
|
||||
* 类型:公众假日、调配工作日、调配休息日
|
||||
*/
|
||||
private String changeTypeName;
|
||||
/**
|
||||
* 类型对应的数值:1-公众假日、2-调配工作日、3-调配休息日
|
||||
*/
|
||||
private int changeType = 1;
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private String holidayDesc;
|
||||
/**
|
||||
* 对应工作日:星期日、星期一、星期二、星期三、星期四、星期五、星期六
|
||||
* 当考勤组的考勤类型为固定班制和自由班制的时启用
|
||||
*/
|
||||
private String relatedDayName;
|
||||
/**
|
||||
* 6-星期日、0-星期一、1-星期二、2-星期三、3-星期四、4-星期五、5-星期六
|
||||
* 当考勤组的考勤类型为固定班制和自由班制的时启用
|
||||
*/
|
||||
private int relatedDay = -1;
|
||||
/**
|
||||
* 用户语言
|
||||
*/
|
||||
private int userlanguage = 7;
|
||||
|
||||
public void setUserLanguage(String userlanguage) {
|
||||
this.userlanguage = Util.getIntValue((String) userlanguage, 7);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验数据有效性--用于Excel导入
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String valExcelData() {
|
||||
//简单校验日期格式
|
||||
String str = "[0-9]{4}-[0-1]{1}[0-9]{1}-[0-3]{1}[0-9]{1}";
|
||||
|
||||
String errorInfo = "";
|
||||
KQGroupComInfo kqGroupComInfo = new KQGroupComInfo();
|
||||
|
||||
if (Util.null2String(this.groupName).length() == 0) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(390305, userlanguage);//考勤组不能为空
|
||||
return errorInfo;
|
||||
} else if (getGroupId(this.groupName).equals("")) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(390306, userlanguage);//没有找到对应的考勤组
|
||||
return errorInfo;
|
||||
} else if (Util.null2String(this.holidayDate).length() == 0) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(388723, userlanguage);//日期不能为空
|
||||
return errorInfo;
|
||||
} else if(Util.null2String(this.holidayDate).length()!=0 && !Pattern.matches(str,this.holidayDate)){
|
||||
errorInfo = SystemEnv.getHtmlLabelName(130208, userlanguage);//无效日期格式
|
||||
return errorInfo;
|
||||
}else if (getChengeType(this.changeTypeName) != 1 && getChengeType(this.changeTypeName) != 2 && getChengeType(this.changeTypeName) != 3) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(83411, userlanguage);//类型不匹配
|
||||
return errorInfo;
|
||||
} else if (getChengeType(this.changeTypeName) == 2) {
|
||||
String kqType = kqGroupComInfo.getKqtype(this.groupId);
|
||||
if (kqType.equals("2")) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(526272, userlanguage);//暂时不支持排班制的考勤组设置调配工作日
|
||||
return errorInfo;
|
||||
}else if (getRelatedDay(this.relatedDayName) < 0 || getRelatedDay(this.relatedDayName) > 6) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(388724, userlanguage);//未找到对应的工作日
|
||||
return errorInfo;
|
||||
}
|
||||
}
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String save() {
|
||||
boolean flag = false;
|
||||
try {
|
||||
RecordSet recordSet = new RecordSet();
|
||||
|
||||
String sql = "select 1 from kq_HolidaySet where groupId=" + this.groupId + " and holidayDate='" + this.holidayDate + "'";
|
||||
recordSet.executeQuery(sql);
|
||||
if (recordSet.next()) {
|
||||
sql = "delete from kq_HolidaySet where groupId=" + this.groupId + " and holidayDate='" + this.holidayDate + "'";
|
||||
recordSet.executeUpdate(sql);
|
||||
}
|
||||
|
||||
sql = " insert into kq_HolidaySet(groupId,holidayDate,changeType,holidayDesc,relatedDay) values(?,?,?,?,?)";
|
||||
flag = recordSet.executeUpdate(sql, this.groupId, this.holidayDate, this.changeType, this.holidayDesc, this.relatedDay);
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
} finally {
|
||||
KQHolidaySetComInfo kqHolidaySetComInfo = new KQHolidaySetComInfo();
|
||||
kqHolidaySetComInfo.removeCache();
|
||||
|
||||
/*刷新考勤报表*/
|
||||
List<String> groupIdList = new ArrayList<String>();
|
||||
groupIdList.add(this.groupId);
|
||||
List<String> holidayDateList = new ArrayList<String>();
|
||||
holidayDateList.add(this.holidayDate);
|
||||
new KQHolidaySetThread(groupIdList,holidayDateList).start();
|
||||
}
|
||||
return String.valueOf(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据考勤组名称获取考勤组ID
|
||||
*
|
||||
* @param groupName
|
||||
* @return
|
||||
*/
|
||||
public String getGroupId(String groupName) {
|
||||
String groupId = "";
|
||||
String sql = "select id from kq_Group where (isDelete is null or isDelete <>1) and groupName='" + groupName + "' ";
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeQuery(sql);
|
||||
if (recordSet.next()) {
|
||||
groupId = recordSet.getString("id");
|
||||
}
|
||||
this.groupId = groupId;
|
||||
return groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类型
|
||||
*
|
||||
* @param changeTypeName
|
||||
* @return
|
||||
*/
|
||||
public int getChengeType(String changeTypeName) {
|
||||
int changeType = -1;
|
||||
if (Util.null2String(changeTypeName).trim().equals(SystemEnv.getHtmlLabelName(16478, ThreadVarLanguage.getLang()).trim())) {
|
||||
changeType = 1;
|
||||
} else if (Util.null2String(changeTypeName).trim().equals(SystemEnv.getHtmlLabelName(16751, ThreadVarLanguage.getLang()).trim())) {
|
||||
changeType = 2;
|
||||
} else if (Util.null2String(changeTypeName).trim().equals(SystemEnv.getHtmlLabelName(16752, ThreadVarLanguage.getLang()).trim())) {
|
||||
changeType = 3;
|
||||
} else {
|
||||
changeType = -1;
|
||||
}
|
||||
this.changeType = changeType;
|
||||
return changeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应工作日
|
||||
*
|
||||
* @param relatedDayName 对应工作日:0-星期一、1-星期二、2-星期三、3-星期四、4-星期五、5-星期六、6-星期日
|
||||
* @return
|
||||
*/
|
||||
public int getRelatedDay(String relatedDayName) {
|
||||
int relatedDay = -1;
|
||||
if (Util.null2String(relatedDayName).trim().equals(SystemEnv.getHtmlLabelName(528000, ThreadVarLanguage.getLang()).trim())) {
|
||||
relatedDay = 0;
|
||||
} else if (Util.null2String(relatedDayName).trim().equals(SystemEnv.getHtmlLabelName(528001, ThreadVarLanguage.getLang()).trim())) {
|
||||
relatedDay = 1;
|
||||
} else if (Util.null2String(relatedDayName).trim().equals(SystemEnv.getHtmlLabelName(528002, ThreadVarLanguage.getLang()).trim())) {
|
||||
relatedDay = 2;
|
||||
} else if (Util.null2String(relatedDayName).trim().equals( SystemEnv.getHtmlLabelName(528003, ThreadVarLanguage.getLang()).trim())) {
|
||||
relatedDay = 3;
|
||||
} else if (Util.null2String(relatedDayName).trim().equals(SystemEnv.getHtmlLabelName(528004, ThreadVarLanguage.getLang()).trim())) {
|
||||
relatedDay = 4;
|
||||
} else if (Util.null2String(relatedDayName).trim().equals(SystemEnv.getHtmlLabelName(528005, ThreadVarLanguage.getLang()).trim())) {
|
||||
relatedDay = 5;
|
||||
} else if (Util.null2String(relatedDayName).trim().equals( SystemEnv.getHtmlLabelName(527999, ThreadVarLanguage.getLang()).trim())) {
|
||||
relatedDay = 6;
|
||||
} else {
|
||||
relatedDay = -1;
|
||||
}
|
||||
this.relatedDay = relatedDay;
|
||||
return relatedDay;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载缓存
|
||||
*/
|
||||
public void removeCache() {
|
||||
try {
|
||||
KQHolidaySetComInfo kqHolidaySetComInfo = new KQHolidaySetComInfo();
|
||||
kqHolidaySetComInfo.removeCache();
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
public String getHolidayDate() {
|
||||
return holidayDate;
|
||||
}
|
||||
|
||||
public void setHolidayDate(String holidayDate) {
|
||||
this.holidayDate = holidayDate;
|
||||
}
|
||||
|
||||
public String getChangeTypeName() {
|
||||
return changeTypeName;
|
||||
}
|
||||
|
||||
public void setChangeTypeName(String changeTypeName) {
|
||||
this.changeTypeName = changeTypeName;
|
||||
}
|
||||
|
||||
public String getHolidayDesc() {
|
||||
return holidayDesc;
|
||||
}
|
||||
|
||||
public void setHolidayDesc(String holidayDesc) {
|
||||
this.holidayDesc = holidayDesc;
|
||||
}
|
||||
|
||||
public String getRelatedDayName() {
|
||||
return relatedDayName;
|
||||
}
|
||||
|
||||
public void setRelatedDayName(String relatedDayName) {
|
||||
this.relatedDayName = relatedDayName;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,215 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Objects;
|
||||
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.common.StringUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
public class KQHrmScheduleSign extends BaseBean {
|
||||
private String id;
|
||||
private String userid;
|
||||
private String usertype;
|
||||
private String signtype;
|
||||
private String signdate;
|
||||
private String signtime;
|
||||
private String clientaddress;
|
||||
private String signfrom;
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
private String addr;
|
||||
private String isincom;
|
||||
private String isimport;
|
||||
private String uuid;
|
||||
private String suuid;
|
||||
private String importsql;
|
||||
/**
|
||||
* 针对跨天的数据设置的所属日期
|
||||
*/
|
||||
private String belongdate;
|
||||
/**
|
||||
* 这条考勤签到签退数据对应的班次id,历史班次数据的处理
|
||||
*/
|
||||
private String serialid;
|
||||
/**
|
||||
* 获取工作时段
|
||||
* 这样写 上班-下班;上班-下班
|
||||
*/
|
||||
private String worksections;
|
||||
|
||||
/**
|
||||
* 粗布的记录考勤状态 迟到、早退
|
||||
*/
|
||||
private String signstatus;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public String getUsertype() {
|
||||
return usertype;
|
||||
}
|
||||
|
||||
public void setUsertype(String usertype) {
|
||||
this.usertype = usertype;
|
||||
}
|
||||
|
||||
public String getSigntype() {
|
||||
return signtype;
|
||||
}
|
||||
|
||||
public void setSigntype(String signtype) {
|
||||
this.signtype = signtype;
|
||||
}
|
||||
|
||||
public String getSigndate() {
|
||||
return signdate;
|
||||
}
|
||||
|
||||
public void setSigndate(String signdate) {
|
||||
this.signdate = signdate;
|
||||
}
|
||||
|
||||
public String getSigntime() {
|
||||
return signtime;
|
||||
}
|
||||
|
||||
public void setSigntime(String signtime) {
|
||||
this.signtime = signtime;
|
||||
}
|
||||
|
||||
public String getClientaddress() {
|
||||
return clientaddress;
|
||||
}
|
||||
|
||||
public void setClientaddress(String clientaddress) {
|
||||
this.clientaddress = clientaddress;
|
||||
}
|
||||
|
||||
public String getSignfrom() {
|
||||
return signfrom;
|
||||
}
|
||||
|
||||
public void setSignfrom(String signfrom) {
|
||||
this.signfrom = signfrom;
|
||||
}
|
||||
|
||||
public String getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(String longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public String getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(String latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public String getAddr() {
|
||||
return addr;
|
||||
}
|
||||
|
||||
public void setAddr(String addr) {
|
||||
this.addr = addr;
|
||||
}
|
||||
|
||||
public String getIsincom() {
|
||||
return isincom;
|
||||
}
|
||||
|
||||
public void setIsincom(String isincom) {
|
||||
this.isincom = isincom;
|
||||
}
|
||||
|
||||
public String getIsimport() {
|
||||
return isimport;
|
||||
}
|
||||
|
||||
public void setIsimport(String isimport) {
|
||||
this.isimport = isimport;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getSuuid() {
|
||||
return suuid;
|
||||
}
|
||||
|
||||
public void setSuuid(String suuid) {
|
||||
this.suuid = suuid;
|
||||
}
|
||||
|
||||
public String getImportsql() {
|
||||
return importsql;
|
||||
}
|
||||
|
||||
public void setImportsql(String importsql) {
|
||||
this.importsql = importsql;
|
||||
}
|
||||
|
||||
public String getBelongdate() {
|
||||
return belongdate;
|
||||
}
|
||||
|
||||
public void setBelongdate(String belongdate) {
|
||||
this.belongdate = belongdate;
|
||||
}
|
||||
|
||||
public String getSerialid() {
|
||||
return serialid;
|
||||
}
|
||||
|
||||
public void setSerialid(String serialid) {
|
||||
this.serialid = serialid;
|
||||
}
|
||||
|
||||
public String getWorksections() {
|
||||
return worksections;
|
||||
}
|
||||
|
||||
public void setWorksections(String worksections) {
|
||||
this.worksections = worksections;
|
||||
}
|
||||
|
||||
public String getSignstatus() {
|
||||
return signstatus;
|
||||
}
|
||||
|
||||
public void setSignstatus(String signstatus) {
|
||||
this.signstatus = signstatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
KQHrmScheduleSign that = (KQHrmScheduleSign) o;
|
||||
return Objects.equals(id, that.id) && Objects.equals(userid, that.userid) && Objects.equals(usertype, that.usertype) && Objects.equals(signtype, that.signtype) && Objects.equals(signdate, that.signdate) && Objects.equals(signtime, that.signtime) && Objects.equals(clientaddress, that.clientaddress) && Objects.equals(signfrom, that.signfrom) && Objects.equals(longitude, that.longitude) && Objects.equals(latitude, that.latitude) && Objects.equals(addr, that.addr) && Objects.equals(isincom, that.isincom) && Objects.equals(isimport, that.isimport) && Objects.equals(uuid, that.uuid) && Objects.equals(suuid, that.suuid) && Objects.equals(importsql, that.importsql) && Objects.equals(belongdate, that.belongdate) && Objects.equals(serialid, that.serialid) && Objects.equals(worksections, that.worksections) && Objects.equals(signstatus, that.signstatus);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
public class KQRepeatBean {
|
||||
|
||||
/**
|
||||
* 重复请假方式 0-晚到,1-早走,2-晚到+早走
|
||||
*/
|
||||
private String repeatType;
|
||||
|
||||
/**
|
||||
* 晚到时长 分钟
|
||||
*/
|
||||
private Long repeatLate;
|
||||
|
||||
/**
|
||||
* 早走时长 分钟
|
||||
*/
|
||||
private Long repeatEarly;
|
||||
|
||||
/**
|
||||
* 流程抵扣了晚到时长分钟
|
||||
*/
|
||||
private Long repeatLateLink;
|
||||
|
||||
/**
|
||||
* 流程抵扣了的早走时长分钟
|
||||
*/
|
||||
private Long repeatEarlyLink;
|
||||
|
||||
public Long getRepeatLateLink() {
|
||||
return repeatLateLink;
|
||||
}
|
||||
|
||||
public void setRepeatLateLink(Long repeatLateLink) {
|
||||
this.repeatLateLink = repeatLateLink;
|
||||
}
|
||||
|
||||
public Long getRepeatEarlyLink() {
|
||||
return repeatEarlyLink;
|
||||
}
|
||||
|
||||
public void setRepeatEarlyLink(Long repeatEarlyLink) {
|
||||
this.repeatEarlyLink = repeatEarlyLink;
|
||||
}
|
||||
|
||||
public Long getRepeatLate() {
|
||||
return repeatLate;
|
||||
}
|
||||
|
||||
public void setRepeatLate(Long repeatLate) {
|
||||
this.repeatLate = repeatLate;
|
||||
}
|
||||
|
||||
public Long getRepeatEarly() {
|
||||
return repeatEarly;
|
||||
}
|
||||
|
||||
public void setRepeatEarly(Long repeatEarly) {
|
||||
this.repeatEarly = repeatEarly;
|
||||
}
|
||||
|
||||
public String getRepeatType() {
|
||||
return repeatType;
|
||||
}
|
||||
|
||||
public void setRepeatType(String repeatType) {
|
||||
this.repeatType = repeatType;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,200 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 考勤人员编号--用于Excel导入
|
||||
*/
|
||||
public class KQScheduleCode extends BaseBean {
|
||||
private String keyField = "";
|
||||
private String workcode = "";
|
||||
private String lastname = "";
|
||||
private String devicecode = "";
|
||||
private String schedulecode = "";
|
||||
private int userlanguage = 7;
|
||||
|
||||
/**
|
||||
* 校验数据有效性--用于Excel导入
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String valExcelData() {
|
||||
String sql = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
String errorInfo = "";
|
||||
int userid = 0;
|
||||
if (this.keyField.equals("workcode")) {
|
||||
if (workcode.length() == 0) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(83770, userlanguage);
|
||||
} else {
|
||||
userid = getUserId(workcode);
|
||||
if (userid == 0) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(83772, userlanguage);
|
||||
}
|
||||
}
|
||||
} else if (this.keyField.equals("lastname")) {
|
||||
if (lastname.length() == 0) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(83774, userlanguage);
|
||||
} else {
|
||||
userid = getUserId(lastname);
|
||||
if (userid == 0) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(83777, userlanguage);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (schedulecode.length() == 0) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(511425, userlanguage);
|
||||
}
|
||||
boolean isOneDevice = true;
|
||||
sql = " select count(1) from kq_schedule_device ";
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
if(rs.getInt(1)>1){
|
||||
isOneDevice = false;
|
||||
}
|
||||
}
|
||||
if(!isOneDevice){
|
||||
if (devicecode.length() == 0) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName( 513724, userlanguage);
|
||||
}else{
|
||||
boolean flag = false;
|
||||
sql = " select count(1) from kq_schedule_device where devicecode='"+this.devicecode+"'";
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
if(rs.getInt(1)>0){
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if(!flag) {
|
||||
errorInfo = SystemEnv.getHtmlLabelName(513724, userlanguage);
|
||||
}
|
||||
}
|
||||
}
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String save() {
|
||||
boolean flag = false;
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
String sql = "";
|
||||
try {
|
||||
rst.setAutoCommit(false);
|
||||
String[] tmpScheduleCodes = Util.splitString(this.schedulecode, ",");
|
||||
int tmpUserId = 0;
|
||||
if (keyField.equals("workcode")) {
|
||||
tmpUserId = getUserId(this.workcode);
|
||||
} else if (keyField.equals("lastname")) {
|
||||
tmpUserId = getUserId(this.lastname);
|
||||
}
|
||||
if (tmpUserId > 0) {
|
||||
String tmpDeviceId = "";
|
||||
sql = " select * from kq_schedule_device where devicecode='" + this.devicecode + "'";
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()) {
|
||||
tmpDeviceId = rs.getString("id");
|
||||
}
|
||||
|
||||
if(tmpDeviceId.length()==0){
|
||||
sql = " select id from kq_schedule_device ";
|
||||
rs.executeQuery(sql);
|
||||
if(rs.getCounts()==1){
|
||||
if(rs.next()){
|
||||
if(rs.getInt(1)>1){
|
||||
tmpDeviceId = Util.null2String(rs.getString("id"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < tmpScheduleCodes.length; k++) {
|
||||
//删除本次同步数据
|
||||
sql = " delete from kq_schedule_code where resourceid=? and schedulecode=? and deviceid=? ";
|
||||
rst.executeUpdate(sql, tmpUserId,tmpScheduleCodes[k],tmpDeviceId.length()==0?null:tmpDeviceId);
|
||||
|
||||
sql = " insert into kq_schedule_code (resourceid ,schedulecode ,deviceid) "
|
||||
+ " values(?,?,?)";
|
||||
rst.executeUpdate(sql, tmpUserId,tmpScheduleCodes[k],tmpDeviceId.length()==0?null:tmpDeviceId);
|
||||
}
|
||||
sql = " SELECT deviceid,schedulecode,COUNT(1) AS num from kq_schedule_code group BY deviceid,schedulecode HAVING COUNT(1)>1 ";
|
||||
rst.executeQuery(sql);
|
||||
if(rst.next()){
|
||||
flag = false;
|
||||
rst.rollback();
|
||||
}else{
|
||||
flag = true;
|
||||
rst.commit();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
rst.rollback();
|
||||
writeLog(e);
|
||||
}
|
||||
return String.valueOf(flag);
|
||||
}
|
||||
|
||||
private int getUserId(String val) {
|
||||
int userid = 0;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
if(Util.isEnableMultiLang()) {
|
||||
if (rs.getDBType().equalsIgnoreCase("sqlserver")) {
|
||||
sql = "select id from hrmresource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))='" + Util.null2String(val).trim() + "'";
|
||||
} else {
|
||||
sql = "select id from hrmresource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))='" + Util.null2String(val).trim() + "'";
|
||||
}
|
||||
}else{
|
||||
sql = "select id from hrmresource where ltrim(rtrim( "+ keyField +"))='" + Util.null2String(val).trim() + "'";
|
||||
}
|
||||
rs.execute(sql);
|
||||
if (rs.next()) {
|
||||
userid = rs.getInt("id");
|
||||
}
|
||||
return userid;
|
||||
}
|
||||
|
||||
public String getWorkcode() {
|
||||
return this.workcode;
|
||||
}
|
||||
|
||||
public void setWorkcode(String workcode) {
|
||||
this.workcode = workcode;
|
||||
}
|
||||
|
||||
public String getLastname() {
|
||||
return this.lastname;
|
||||
}
|
||||
|
||||
public void setLastname(String lastname) {
|
||||
this.lastname = lastname;
|
||||
}
|
||||
|
||||
public void setDevicecode(String devicecode) {
|
||||
this.devicecode = devicecode;
|
||||
}
|
||||
|
||||
public String getSchedulecode() {
|
||||
return this.schedulecode;
|
||||
}
|
||||
|
||||
public void setSchedulecode(String schedulecode) {
|
||||
this.schedulecode = schedulecode;
|
||||
}
|
||||
|
||||
public void setKeyField(String keyField) {
|
||||
this.keyField = keyField;
|
||||
}
|
||||
|
||||
public void setUserLanguage(String userlanguage) {
|
||||
this.userlanguage = Util.getIntValue((String) userlanguage);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
/**
|
||||
* 排班制考勤组----排班设置权限(数据存储在建模表中)
|
||||
*/
|
||||
public class KqLockAttenda {
|
||||
private String LOCK_COM;
|
||||
|
||||
private String LOCK_SUBCOM;
|
||||
|
||||
private String LOCK_DEPT;
|
||||
|
||||
private String LOCK_RESOURCE;
|
||||
|
||||
private String LOCK_FROMDATE;
|
||||
private String LOCK_TODATE;
|
||||
private String LOCK_LOCK;
|
||||
|
||||
public String getLOCK_COM() {
|
||||
return LOCK_COM;
|
||||
}
|
||||
|
||||
public void setLOCK_COM(String LOCK_COM) {
|
||||
this.LOCK_COM = LOCK_COM;
|
||||
}
|
||||
|
||||
public String getLOCK_SUBCOM() {
|
||||
return LOCK_SUBCOM;
|
||||
}
|
||||
|
||||
public void setLOCK_SUBCOM(String LOCK_SUBCOM) {
|
||||
this.LOCK_SUBCOM = LOCK_SUBCOM;
|
||||
}
|
||||
|
||||
public String getLOCK_DEPT() {
|
||||
return LOCK_DEPT;
|
||||
}
|
||||
|
||||
public void setLOCK_DEPT(String LOCK_DEPT) {
|
||||
this.LOCK_DEPT = LOCK_DEPT;
|
||||
}
|
||||
|
||||
public String getLOCK_RESOURCE() {
|
||||
return LOCK_RESOURCE;
|
||||
}
|
||||
|
||||
public void setLOCK_RESOURCE(String LOCK_RESOURCE) {
|
||||
this.LOCK_RESOURCE = LOCK_RESOURCE;
|
||||
}
|
||||
|
||||
public String getLOCK_FROMDATE() {
|
||||
return LOCK_FROMDATE;
|
||||
}
|
||||
|
||||
public void setLOCK_FROMDATE(String LOCK_FROMDATE) {
|
||||
this.LOCK_FROMDATE = LOCK_FROMDATE;
|
||||
}
|
||||
|
||||
public String getLOCK_TODATE() {
|
||||
return LOCK_TODATE;
|
||||
}
|
||||
|
||||
public void setLOCK_TODATE(String LOCK_TODATE) {
|
||||
this.LOCK_TODATE = LOCK_TODATE;
|
||||
}
|
||||
|
||||
public String getLOCK_LOCK() {
|
||||
return LOCK_LOCK;
|
||||
}
|
||||
|
||||
public void setLOCK_LOCK(String LOCK_LOCK) {
|
||||
this.LOCK_LOCK = LOCK_LOCK;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
public class KqOldCardFlowFlushBean {
|
||||
private int id;
|
||||
private int prosetid;
|
||||
private int workflowid;
|
||||
private int billid;
|
||||
private String maintablename;
|
||||
private String detailtablename;
|
||||
private String mainresourcefield;
|
||||
private String detailresourcefield;
|
||||
private int isexecute;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getProsetid() {
|
||||
return prosetid;
|
||||
}
|
||||
|
||||
public void setProsetid(int prosetid) {
|
||||
this.prosetid = prosetid;
|
||||
}
|
||||
|
||||
public int getWorkflowid() {
|
||||
return workflowid;
|
||||
}
|
||||
|
||||
public void setWorkflowid(int workflowid) {
|
||||
this.workflowid = workflowid;
|
||||
}
|
||||
|
||||
public int getBillid() {
|
||||
return billid;
|
||||
}
|
||||
|
||||
public void setBillid(int billid) {
|
||||
this.billid = billid;
|
||||
}
|
||||
|
||||
public String getMaintablename() {
|
||||
return maintablename;
|
||||
}
|
||||
|
||||
public void setMaintablename(String maintablename) {
|
||||
this.maintablename = maintablename;
|
||||
}
|
||||
|
||||
public String getDetailtablename() {
|
||||
return detailtablename;
|
||||
}
|
||||
|
||||
public void setDetailtablename(String detailtablename) {
|
||||
this.detailtablename = detailtablename;
|
||||
}
|
||||
|
||||
public String getMainresourcefield() {
|
||||
return mainresourcefield;
|
||||
}
|
||||
|
||||
public void setMainresourcefield(String mainresourcefield) {
|
||||
this.mainresourcefield = mainresourcefield;
|
||||
}
|
||||
|
||||
public String getDetailresourcefield() {
|
||||
return detailresourcefield;
|
||||
}
|
||||
|
||||
public void setDetailresourcefield(String detailresourcefield) {
|
||||
this.detailresourcefield = detailresourcefield;
|
||||
}
|
||||
|
||||
public int getIsexecute() {
|
||||
return isexecute;
|
||||
}
|
||||
|
||||
public void setIsexecute(int isexecute) {
|
||||
this.isexecute = isexecute;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 排班制考勤组----排班设置日志
|
||||
*/
|
||||
public class KqShiftscheduleOperateLog {
|
||||
/**
|
||||
* 操作类型
|
||||
*/
|
||||
private String operatetype;
|
||||
|
||||
/**
|
||||
* 操作人
|
||||
*/
|
||||
private String operator;
|
||||
|
||||
/**
|
||||
* 考勤组名称+id
|
||||
*/
|
||||
private String kqgroupname;
|
||||
|
||||
/**
|
||||
* 被修改人
|
||||
*/
|
||||
private String changeduser;
|
||||
|
||||
/**
|
||||
* 被修改班次日期
|
||||
*/
|
||||
private String changedshiftdate;
|
||||
|
||||
/**
|
||||
* 被修改班次+id
|
||||
*/
|
||||
private String changedshiftname;
|
||||
|
||||
/**
|
||||
* 排班设置行id
|
||||
*/
|
||||
private String kqshiftid;
|
||||
|
||||
public KqShiftscheduleOperateLog() {
|
||||
}
|
||||
|
||||
public KqShiftscheduleOperateLog(int type, String operator, String kqgroupname, String changeduser, String changedshiftdate, String oldShiftname, String kqshiftid, String newSerialName, int languageId) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
this.operatetype = SystemEnv.getHtmlLabelName(1421, languageId);
|
||||
this.changedshiftname = SystemEnv.getHtmlLabelName(546713, languageId)+": <"+newSerialName+">";
|
||||
break;
|
||||
case 1:
|
||||
this.operatetype = SystemEnv.getHtmlLabelName(17744, languageId);
|
||||
this.changedshiftname = SystemEnv.getHtmlLabelName(546715, languageId)+": <"+oldShiftname+">"+SystemEnv.getHtmlLabelName(546716, languageId)+"<"+newSerialName+">";
|
||||
break;
|
||||
case 2:
|
||||
this.operatetype = SystemEnv.getHtmlLabelName(91, languageId);
|
||||
this.changedshiftname = SystemEnv.getHtmlLabelName(546714, languageId)+": <"+oldShiftname+">";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.operator = operator;
|
||||
this.kqgroupname = kqgroupname;
|
||||
this.changeduser = changeduser;
|
||||
this.changedshiftdate = changedshiftdate;
|
||||
this.kqshiftid = kqshiftid;
|
||||
}
|
||||
|
||||
public String getOperatetype() {
|
||||
return operatetype;
|
||||
}
|
||||
|
||||
public void setOperatetype(String operatetype) {
|
||||
this.operatetype = operatetype;
|
||||
}
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
public String getKqgroupname() {
|
||||
return kqgroupname;
|
||||
}
|
||||
|
||||
public void setKqgroupname(String kqgroupname) {
|
||||
this.kqgroupname = kqgroupname;
|
||||
}
|
||||
|
||||
public String getChangeduser() {
|
||||
return changeduser;
|
||||
}
|
||||
|
||||
public void setChangeduser(String changeduser) {
|
||||
this.changeduser = changeduser;
|
||||
}
|
||||
|
||||
public String getChangedshiftdate() {
|
||||
return changedshiftdate;
|
||||
}
|
||||
|
||||
public void setChangedshiftdate(String changedshiftdate) {
|
||||
this.changedshiftdate = changedshiftdate;
|
||||
}
|
||||
|
||||
public String getChangedshiftname() {
|
||||
return changedshiftname;
|
||||
}
|
||||
|
||||
public void setChangedshiftname(String changedshiftname) {
|
||||
this.changedshiftname = changedshiftname;
|
||||
}
|
||||
|
||||
public String getKqshiftid() {
|
||||
return kqshiftid;
|
||||
}
|
||||
|
||||
public void setKqshiftid(String kqshiftid) {
|
||||
this.kqshiftid = kqshiftid;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
/**
|
||||
* 排班制考勤组----排班设置权限(数据存储在建模表中)
|
||||
*/
|
||||
public class KqShiftscheduleRole {
|
||||
private String kqShiftRoleManagerIds;
|
||||
|
||||
private String kqShiftRoleGroupIds;
|
||||
|
||||
private String kqShiftRoleSubcompanyIds;
|
||||
|
||||
private String kqShiftRoleDepartmentIds;
|
||||
|
||||
private String kqShiftRoleResourceIds;
|
||||
|
||||
public String getKqShiftRoleManagerIds() {
|
||||
return kqShiftRoleManagerIds;
|
||||
}
|
||||
|
||||
public void setKqShiftRoleManagerIds(String kqShiftRoleManagerIds) {
|
||||
this.kqShiftRoleManagerIds = kqShiftRoleManagerIds;
|
||||
}
|
||||
|
||||
public String getKqShiftRoleGroupIds() {
|
||||
return kqShiftRoleGroupIds;
|
||||
}
|
||||
|
||||
public void setKqShiftRoleGroupIds(String kqShiftRoleGroupIds) {
|
||||
this.kqShiftRoleGroupIds = kqShiftRoleGroupIds;
|
||||
}
|
||||
|
||||
public String getKqShiftRoleSubcompanyIds() {
|
||||
return kqShiftRoleSubcompanyIds;
|
||||
}
|
||||
|
||||
public void setKqShiftRoleSubcompanyIds(String kqShiftRoleSubcompanyIds) {
|
||||
this.kqShiftRoleSubcompanyIds = kqShiftRoleSubcompanyIds;
|
||||
}
|
||||
|
||||
public String getKqShiftRoleDepartmentIds() {
|
||||
return kqShiftRoleDepartmentIds;
|
||||
}
|
||||
|
||||
public void setKqShiftRoleDepartmentIds(String kqShiftRoleDepartmentIds) {
|
||||
this.kqShiftRoleDepartmentIds = kqShiftRoleDepartmentIds;
|
||||
}
|
||||
|
||||
public String getKqShiftRoleResourceIds() {
|
||||
return kqShiftRoleResourceIds;
|
||||
}
|
||||
|
||||
public void setKqShiftRoleResourceIds(String kqShiftRoleResourceIds) {
|
||||
this.kqShiftRoleResourceIds = kqShiftRoleResourceIds;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 右键菜单
|
||||
* @wangqs
|
||||
* */
|
||||
public class RightMenu {
|
||||
private String menuName; //名称
|
||||
private String menuFun; //回调
|
||||
private String menuIcon; //图标
|
||||
private RightMenuType type; // 类型
|
||||
private String isTop; //是否有顶部按钮
|
||||
private String isControl ; //是否受控(即有选中列 才可点击)
|
||||
private String isBatch ; //是否为批量按钮
|
||||
private Map<String, Object> params; //请求附带参数
|
||||
|
||||
public RightMenu(int languageid, RightMenuType type, String menuFun) {
|
||||
this.menuName = SystemEnv.getHtmlLabelNames(type.getLabelids(),languageid);
|
||||
this.menuFun = menuFun;
|
||||
this.menuIcon = type.getIcon();
|
||||
this.type = type;
|
||||
this.isTop = "0";
|
||||
}
|
||||
|
||||
public RightMenu(int languageid, RightMenuType type, String menuFun, Map<String,Object> params) {
|
||||
this.menuName = SystemEnv.getHtmlLabelNames(type.getLabelids(),languageid);
|
||||
this.menuFun = menuFun;
|
||||
this.menuIcon = type.getIcon();
|
||||
this.type = type;
|
||||
this.isTop = "0";
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public RightMenu(int languageid, RightMenuType type, String menuFun, boolean isTop) {
|
||||
this.menuName = SystemEnv.getHtmlLabelNames(type.getLabelids(),languageid);
|
||||
this.menuFun = menuFun;
|
||||
this.menuIcon = type.getIcon();
|
||||
this.type = type;
|
||||
this.isTop = isTop ? "1" : "0";
|
||||
}
|
||||
|
||||
public RightMenu(int languageid, RightMenuType type, String menuFun, boolean isTop, Map<String,Object> params) {
|
||||
this.menuName = SystemEnv.getHtmlLabelNames(type.getLabelids(),languageid);
|
||||
this.menuFun = menuFun;
|
||||
this.menuIcon = type.getIcon();
|
||||
this.type = type;
|
||||
this.isTop = isTop ? "1" : "0";
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public RightMenu(int languageid, RightMenuType type, String menuFun,boolean isTop, boolean isBatch) {
|
||||
this.menuName = SystemEnv.getHtmlLabelNames(type.getLabelids(),languageid);
|
||||
this.menuFun = menuFun;
|
||||
this.menuIcon = type.getIcon();
|
||||
this.type = type;
|
||||
this.isBatch = isBatch ? "1" : "0";
|
||||
this.isTop = isTop ? "1" : "0";
|
||||
}
|
||||
|
||||
public RightMenu(int languageid, RightMenuType type, String menuFun,boolean isTop, boolean isBatch, Map<String,Object> params) {
|
||||
this.menuName = SystemEnv.getHtmlLabelNames(type.getLabelids(),languageid);
|
||||
this.menuFun = menuFun;
|
||||
this.menuIcon = type.getIcon();
|
||||
this.type = type;
|
||||
this.isBatch = isBatch ? "1" : "0";
|
||||
this.isTop = isTop ? "1" : "0";
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public RightMenu() {
|
||||
|
||||
}
|
||||
public RightMenuType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(RightMenuType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getMenuName() {
|
||||
return menuName;
|
||||
}
|
||||
|
||||
public void setMenuName(String menuName) {
|
||||
this.menuName = menuName;
|
||||
}
|
||||
|
||||
public String getMenuFun() {
|
||||
return menuFun;
|
||||
}
|
||||
|
||||
public void setMenuFun(String menuFun) {
|
||||
this.menuFun = menuFun;
|
||||
}
|
||||
|
||||
public String getMenuIcon() {
|
||||
return menuIcon;
|
||||
}
|
||||
|
||||
public void setMenuIcon(String menuIcon) {
|
||||
this.menuIcon = menuIcon;
|
||||
}
|
||||
|
||||
public String getIsTop() {
|
||||
return isTop;
|
||||
}
|
||||
|
||||
public void setIsTop(String isTop) {
|
||||
this.isTop = isTop;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Map<String, Object> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public String getIsControl() {
|
||||
return isControl;
|
||||
}
|
||||
|
||||
public void setIsControl(String isControl) {
|
||||
this.isControl = isControl;
|
||||
}
|
||||
|
||||
public String getIsBatch() {
|
||||
return isBatch;
|
||||
}
|
||||
|
||||
public void setIsBatch(String isBatch) {
|
||||
this.isBatch = isBatch;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
/**
|
||||
* 右键菜单
|
||||
* @author lvyi
|
||||
* */
|
||||
public enum RightMenuType {
|
||||
BTN_SENDMAIL("2051","icon-coms-Send-emails"),//发送邮件
|
||||
BTN_SENDSMSMESSAGE("16635","icon-coms-New-SMS"),//发送短信
|
||||
BTN_ADDCOWORK("18034","icon-coms-cowork"),//新建协作
|
||||
BTN_DOADDWORKPLANBYHRM("18481","icon-coms-Planning-tasks"),//新建日程
|
||||
BTN_EDIT("93","icon-coms-edit"),//编辑
|
||||
BTN_EditCompanyVirtual("93,34069","icon-coms-edit"),//编辑组织维度
|
||||
BTN_SENDEMESSAGE("130343","icon-coms-e-message"),//发起群聊
|
||||
BTN_SEARCH("197","icon-coms-search"),//搜索
|
||||
BTN_RESEARCH("364","icon-coms-go-back"),//重新搜索
|
||||
BTN_EXPORTEXCEL("28343","icon-coms-export"),//EXCEL导出
|
||||
BTN_ADDTOGROUP("130759","icon-coms-search"),//加入到组
|
||||
BTN_COLUMN("32535","icon-coms-task-list"),//显示列定制
|
||||
//BTN_STORE("28111","icon-coms-Collection"),//收藏
|
||||
//BTN_HELP("275","icon-coms-help"),//帮助
|
||||
BTN_log("83","icon-coms-Print-log"),//日志
|
||||
//BTN_PageAddress("21682","icon-coms-PageAddress"),//显示页面地址
|
||||
BTN_AddCounrty("82,377","icon-coms-New-Flow"),//新建国家
|
||||
BTN_AddProvince("82,800","icon-coms-New-Flow"),//新建省份
|
||||
BTN_AddCity("82,493","icon-coms-New-Flow"),//新建城市
|
||||
BTN_AddCityTwo("82,81764","icon-coms-New-Flow"),//新建区县
|
||||
BTN_Cancel("22151","icon-coms-hide"),//封存
|
||||
BTN_DoIsCanceled("22152","icon-coms-display"),//解封
|
||||
BTN_BatchCancel("33619","icon-coms-Batch-add-hot"),//批量封存
|
||||
BTN_BatchDoIsCanceled("33620","icon-coms-Batch-add"),//批量解封
|
||||
BTN_BatchDelete("32136","icon-coms-Batch-delete"),//批量删除
|
||||
BTN_BatchRomove("383696","icon-coms-Batch-delete"),//批量移除
|
||||
BTN_BatchOrder("25164","icon-coms-task-list"),//批量排序
|
||||
BTN_BatchCode("382686","icon-coms-Need-feedback"),//批量编号
|
||||
BTN_BatchSetManager("34078","icon-coms-Need-feedback"),//批量编号
|
||||
BTN_Import("18596","icon-coms-leading-in"),//导入
|
||||
BTN_Import_Resource("17887","icon-coms-leading-in"),//人员导入
|
||||
BTN_Import_Org("125523","icon-coms-leading-in"),//组织结构导入
|
||||
BTN_Addnew("82","icon-coms-New-Flow"),//新建
|
||||
BTN_AddSignature("16387","icon-coms-New-Flow"),//新建签章
|
||||
BTN_AddCompanyVirtual("82,34069","icon-coms-New-Flow"),//新建组织维度
|
||||
BTN_AddSubCompany("82,141","icon-coms-New-Flow"),//新建分部
|
||||
BTN_AddSubCompanySibling("82,17897","icon-coms-New-Flow"),//新建同级分部
|
||||
BTN_AddSubCompanyChild("82,17898","icon-coms-New-Flow"),//新建下级分部
|
||||
BTN_AddDepartment("82,124","icon-coms-New-Flow"),//新建部门
|
||||
BTN_AddDepartmentSibling("82,17899","icon-coms-New-Flow"),//新建同级部门
|
||||
BTN_AddDepartmentChild("82,17587","icon-coms-New-Flow"),//新建下级部门
|
||||
BTN_AddResource("15005","icon-coms-New-Flow"),//新建人员
|
||||
BTN_AddResourceVirtual("34100","icon-coms-New-Flow"),//加入到多维组织
|
||||
BTN_AddResourceToVirtual("383694","icon-coms-New-Flow"),//添加人员
|
||||
BTN_AddResourceToGroup("130759","icon-coms-New-Flow"),//加入到组
|
||||
BTN_AddVirtualCompany("82,34069","icon-coms-New-Flow"),//新建组织维度
|
||||
BTN_FnaBudgetView("386","icon-coms-Detailed"),//预算
|
||||
BTN_FnaExpenseDetail("428","icon-coms-Detailed"),//收支
|
||||
BTN_Delete("91","icon-coms-delete"),//删除
|
||||
BTN_AddJobGroup("82,805","icon-coms-New-Flow"),//新建职务类别
|
||||
BTN_ImportJobTitle("125443","icon-coms-leading-in"),//岗位体系导入
|
||||
BTN_AddJobActivity("82,1915","icon-coms-New-Flow"),//新建职务
|
||||
BTN_AddJobTitle("125302","icon-coms-New-Flow"),//新建岗位
|
||||
BTN_Save("86","icon-coms-Preservation"),//保存
|
||||
BTN_DepartmentRoles("122","icon-coms-currency-Customer"),//角色
|
||||
BTN_Commit("615","icon-coms-Branch"),//保存
|
||||
BTN_CreateSalary("15845","icon-coms-content-o"),//生成工资单
|
||||
BTN_CloseSalary("19575","icon-coms-integration-o"),//关闭工资单
|
||||
BTN_ChangeSalary("19580","icon-coms-currency-Process"),//调整薪酬设置
|
||||
BTN_SendSalary("15848","icon-coms-Collection"),//发送工资单
|
||||
BTN_ExportSalary("17416,503","icon-coms-PageAddress"),//导出工资单
|
||||
BTN_HistorySalary("19576","icon-coms-reportform"),//历史工资单
|
||||
BTN_Return("1290","icon-coms-Return"),//返回
|
||||
BTN_Export_Excel("28343","icon-coms-export"),//导出Excel
|
||||
BTN_Copy("77","icon-coms-edit"),//复制
|
||||
BTN_Join("2195","icon-coms-Branch"),//保存
|
||||
BTN_Apply("129","icon-coms-Branch"),//申请
|
||||
BTN_Range("6104","icon-coms-Branch"),//公开范围
|
||||
BTN_BatchSet("33511","icon-coms-Flow-setting"),//批量设置
|
||||
BTN_SyncSet("385814","icon-coms-Update-synchronization"),//同步默认方式
|
||||
BTN_DetailInfo("15729","icon-coms-investigate"),//具体信息
|
||||
BTN_SetUserIcon("28062","icon-coms-upload"),//设置头像
|
||||
BTN_Rp_Excel("383381","icon-coms-export"),//导出清单到Excel
|
||||
BTN_KQ_TYPE("383381","icon-coms-investigate"),//考勤方式
|
||||
BTN_BatchEditing("15839","icon-coms-BatchEditing-Hot"),//批处理
|
||||
BTN_Initialization("390425","icon-coms-Flow-setting"),//开始初始化
|
||||
BTN_Init("20873","icon-coms-Flow-setting"),//初始化
|
||||
BTN_SHOW_NOACCOUNT("500013","icon-coms-Flow-setting"),//不显示无账号人员
|
||||
BTN_KQ_REPORT_FORMAT("510380","icon-coms-investigate"),//重新计算考勤数据
|
||||
BTN_KQ_Refresh("354","icon-coms-Update-synchronization"),//刷新
|
||||
BTN_CREATE_GROUP("30131","icon-coms-New-Flow"),//新建分组
|
||||
BTN_EDIT_GROUP("383049","icon-coms-edit"),//分组维护
|
||||
BTN_SAVE_TEMPLETE("18418","icon-coms-Branch"),//存为模板
|
||||
BTN_SET_ORDER("389339","icon-coms-Flow-setting"),//设置默认排序
|
||||
;
|
||||
|
||||
private String labelids;
|
||||
private String icon;
|
||||
|
||||
private RightMenuType(String labelids,String icon){
|
||||
this.labelids = labelids;
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public String getLabelids() {
|
||||
return labelids;
|
||||
}
|
||||
|
||||
public void setLabelids(String labelids) {
|
||||
this.labelids = labelids;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
package com.engine.kq.bean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 属性节点
|
||||
*/
|
||||
public class TreeNode {
|
||||
|
||||
private String id; //节点ID 【在树上不一定唯一,需要和type共同使用】
|
||||
private String name; //节点显示名
|
||||
private String desc; //节点描述
|
||||
private String linkUrl; //节点链接
|
||||
private String icon; //节点图标
|
||||
private String pid; //父节点ID
|
||||
private boolean isParent; //是否为父节点
|
||||
private List<TreeNode> subs; //子节点数据
|
||||
private String type; //类型
|
||||
//其他属性
|
||||
private Map<String,Object> prop;
|
||||
private boolean isSelected; //是否默认选中
|
||||
private boolean canClick; //当前节点是否可点击
|
||||
private String title;
|
||||
|
||||
public TreeNode() {
|
||||
}
|
||||
|
||||
public TreeNode(String id, String name, String pid, boolean isParent) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.pid = pid;
|
||||
this.isParent = isParent;
|
||||
}
|
||||
public TreeNode(String id, String name, String pid, boolean isParent, List<TreeNode> subs) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.pid = pid;
|
||||
this.isParent = isParent;
|
||||
this.subs = subs;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getLinkUrl() {
|
||||
return linkUrl;
|
||||
}
|
||||
public void setLinkUrl(String linkUrl) {
|
||||
this.linkUrl = linkUrl;
|
||||
}
|
||||
public String getPid() {
|
||||
return pid;
|
||||
}
|
||||
public void setPid(String pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
public boolean getIsParent() {
|
||||
return isParent;
|
||||
}
|
||||
public void setIsParent(boolean isParent) {
|
||||
this.isParent = isParent;
|
||||
}
|
||||
public List<TreeNode> getSubs() {
|
||||
return subs;
|
||||
}
|
||||
public void setSubs(List<TreeNode> subs) {
|
||||
this.subs = subs;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Map<String, Object> getProp() {
|
||||
return prop;
|
||||
}
|
||||
|
||||
public void setProp(Map<String, Object> prop) {
|
||||
this.prop = prop;
|
||||
}
|
||||
|
||||
public void setParent(boolean isParent) {
|
||||
this.isParent = isParent;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
return isSelected;
|
||||
}
|
||||
|
||||
public void setSelected(boolean isSelected) {
|
||||
this.isSelected = isSelected;
|
||||
}
|
||||
|
||||
public boolean isCanClick() {
|
||||
return canClick;
|
||||
}
|
||||
|
||||
public void setCanClick(boolean canClick) {
|
||||
this.canClick = canClick;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.engine.kq.biz.chain.cominfo.ShiftInfoCominfoBean;
|
||||
import com.engine.kq.enums.DurationTypeEnum;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import weaver.common.StringUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.hrm.schedule.domain.HrmSchedule;
|
||||
import weaver.hrm.schedule.manager.HrmScheduleManager;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 新版考勤为原考勤类HrmScheduleManager的通用方法做单独的处理
|
||||
*/
|
||||
public class KQ4ScheduleManager extends BaseBean {
|
||||
|
||||
private int scale = 2;
|
||||
|
||||
private User user;
|
||||
|
||||
private static final String B_TIME = "00:00";
|
||||
|
||||
private static final String E_TIME = "23:59";
|
||||
|
||||
private KQWorkTime kqWorkTime;
|
||||
|
||||
public KQ4ScheduleManager(User user) {
|
||||
this.user = user;
|
||||
this.kqWorkTime = new KQWorkTime();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* HrmScheduleManager里的getTotalWorkData方法
|
||||
* @param fromDate
|
||||
* @param fromTime
|
||||
* @param toDate
|
||||
* @param toTime
|
||||
* @param $user
|
||||
* @return
|
||||
*/
|
||||
public String[] getTotalWorkData(String fromDate, String fromTime, String toDate, String toTime, User $user) {
|
||||
|
||||
String[] result = {"", ""};
|
||||
if($user == null){
|
||||
$user = user;
|
||||
}
|
||||
if(fromTime.length() == 0){
|
||||
fromTime = B_TIME;
|
||||
}
|
||||
if(toTime.length() == 0){
|
||||
toTime = E_TIME;
|
||||
}
|
||||
String ressourceid = $user.getUID()+"";
|
||||
KQDurationCalculatorUtil kqDurationCalculatorUtil =new KQDurationCalculatorUtil.DurationParamBuilder(ressourceid).
|
||||
fromDateParam(fromDate).toDateParam(toDate).fromTimeParam(fromTime).toTimeParam(toTime).durationRuleParam("1")
|
||||
.computingModeParam("1").durationTypeEnumParam(DurationTypeEnum.COMMON_CAL).build();
|
||||
|
||||
Map<String,Object> durationMap = kqDurationCalculatorUtil.getWorkDuration();
|
||||
String duration4day = Util.null2s(Util.null2String(durationMap.get("duration")),"0");
|
||||
String duration4min = Util.null2s(Util.null2String(durationMap.get("min_duration")),"0");
|
||||
double duration4hour = Util.getDoubleValue(duration4min)/60.0;
|
||||
|
||||
result[0] = String.valueOf(StringUtil.round(Util.getDoubleValue(duration4day), 5));
|
||||
result[1] = String.valueOf(StringUtil.round(duration4hour, 5));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* HrmScheduleManager里的getTotalRestHours方法
|
||||
* @param fromDate
|
||||
* @param fromTime
|
||||
* @param toDate
|
||||
* @param toTime
|
||||
* @param $user
|
||||
* @return
|
||||
*/
|
||||
public String getTotalRestHours(String fromDate, String fromTime, String toDate, String toTime, User $user) {
|
||||
if($user == null){
|
||||
$user = user;
|
||||
}
|
||||
String ressourceid = $user.getUID()+"";
|
||||
KQDurationCalculatorUtil kqDurationCalculatorUtil =new KQDurationCalculatorUtil.DurationParamBuilder(ressourceid).
|
||||
fromDateParam(fromDate).toDateParam(toDate).fromTimeParam(fromTime).toTimeParam(toTime).computingModeParam("1").
|
||||
durationRuleParam("3").durationTypeEnumParam(DurationTypeEnum.OVERTIME).build();
|
||||
Map<String,Object> durationMap = kqDurationCalculatorUtil.getNonWorkDuration();
|
||||
String duration = Util.null2String(durationMap.get("duration"));
|
||||
|
||||
return Util.null2String(Util.getDoubleValue(duration,0.0));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为工作日
|
||||
* @param currentDate
|
||||
* @return
|
||||
*/
|
||||
|
||||
public boolean isWorkday(String currentDate){
|
||||
return isWorkday(currentDate, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为工作日
|
||||
* @param currentDate
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public boolean isWorkday(String currentDate, User user){
|
||||
boolean isWorkday = false;
|
||||
if(user!=null){
|
||||
isWorkday = kqWorkTime.isWorkDay(""+user.getUID(),currentDate);
|
||||
}
|
||||
return isWorkday;
|
||||
}
|
||||
|
||||
public Map<String, String> getOnDutyAndOffDutyTimeMap(String currentDate) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if(user!=null){
|
||||
ShiftInfoCominfoBean shiftInfoCominfoBean = kqWorkTime.getShiftInfoCominfoBean(""+user.getUID(), currentDate);
|
||||
if(shiftInfoCominfoBean != null){
|
||||
//只有一次签到签退的 且设置了休息时间的才能对应上这个方法
|
||||
List<String> allWorkTime = shiftInfoCominfoBean.getAllWorkTime();
|
||||
List<String> restTimes = shiftInfoCominfoBean.getAllRestTime();
|
||||
if(allWorkTime != null && !allWorkTime.isEmpty()){
|
||||
//一天一次
|
||||
if(allWorkTime.size() == 2){
|
||||
if(restTimes != null && !restTimes.isEmpty() && restTimes.size() == 2){
|
||||
map.put("onDutyTimeAM", allWorkTime.get(0));
|
||||
map.put("offDutyTimeAM", restTimes.get(0));
|
||||
map.put("onDutyTimePM", restTimes.get(1));
|
||||
map.put("offDutyTimePM",allWorkTime.get(1));
|
||||
map.put("signType", "1");
|
||||
map.put("signStartTime", "");
|
||||
}
|
||||
}
|
||||
//一天两次
|
||||
if(allWorkTime.size() == 4){
|
||||
map.put("onDutyTimeAM", allWorkTime.get(0));
|
||||
map.put("offDutyTimeAM", allWorkTime.get(1));
|
||||
map.put("onDutyTimePM", allWorkTime.get(2));
|
||||
map.put("offDutyTimePM",allWorkTime.get(3));
|
||||
map.put("signType", "1");
|
||||
map.put("signStartTime", "");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public int getScale() {
|
||||
return scale;
|
||||
}
|
||||
|
||||
public void setScale(int scale) {
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤流程 字段对应 设置类
|
||||
*/
|
||||
public class KQAttFlowFieldsSetBiz {
|
||||
|
||||
/**
|
||||
* 请假主表流程的规定字段
|
||||
*/
|
||||
public static String[] leaveFields = {"resourceId","departmentId","newLeaveType","fromDate","fromTime","toDate","toTime","duration"};
|
||||
|
||||
/**
|
||||
* 出差主表流程的规定字段
|
||||
*/
|
||||
public static String[] evectionFields = {"resourceId","departmentId","fromDate","fromTime","toDate","toTime","duration","companion"};
|
||||
|
||||
/**
|
||||
* 公出主表流程的规定字段
|
||||
*/
|
||||
public static String[] outFields = {"resourceId","departmentId","fromDate","fromTime","toDate","toTime","duration"};
|
||||
|
||||
/**
|
||||
* 加班主表流程的规定字段
|
||||
*/
|
||||
public static String[] overtimeFields = {"resourceId","departmentId","fromDate","fromTime","toDate","toTime","duration"};
|
||||
|
||||
/**
|
||||
* 异常流程主表流程的规定字段
|
||||
*/
|
||||
public static String[] otherFields = {"resourceId","departmentId","fromDate","fromTime","toDate","toTime"};
|
||||
|
||||
/**
|
||||
* 排班流程明细流程的规定字段
|
||||
*/
|
||||
public static String[] shiftDetailFields = {"detail_resourceId","detail_fromDate","detail_toDate","detail_shift","detail_group"};
|
||||
|
||||
/**
|
||||
* 销假流程的规定字段
|
||||
*/
|
||||
public static String[] leavebackFields = {"resourceId","leaverequestid","detail_fromDate","detail_fromTime","detail_toDate","detail_toTime","detail_duration"};
|
||||
|
||||
/**
|
||||
* 销假流程的规定主字段
|
||||
*/
|
||||
public static String[] leavebackMainFields = {"resourceId","leaverequestid"};
|
||||
|
||||
/**
|
||||
* 补卡流程的规定字段
|
||||
*/
|
||||
public static String[] cardFields = {"resourceId","fromDate","toDate","detail_signdate","detail_scheduletime","detail_atteStatus","detail_signtype","detail_signtime","resourceIds","detail_resourceid"};
|
||||
|
||||
/**
|
||||
* 补卡流程的规定字段
|
||||
*/
|
||||
public static String[] cardMainFields = {"resourceId","fromDate","toDate","resourceIds"};
|
||||
|
||||
/**
|
||||
* 考勤变更流程的规定主字段
|
||||
*/
|
||||
public static String[] processchangeMainFields = {"resourceId","changerequestid","changetype"};
|
||||
|
||||
/**
|
||||
* 考勤变更流程的规定明细字段
|
||||
*/
|
||||
public static String[] processchangeFields = {"resourceId","changerequestid","changetype","detail_attendancefromDate","detail_attendancefromTime","detail_attendancetoDate","detail_attendancetoTime","detail_attendanceduration","detail_fromDate","detail_fromTime","detail_toDate","detail_toTime","detail_duration"};
|
||||
|
||||
/**
|
||||
* 根据类型映射查找字段对应
|
||||
*/
|
||||
public static String[][] fieldsRefect = {leaveFields,evectionFields,outFields,overtimeFields,otherFields,shiftDetailFields,leavebackFields,cardFields,processchangeFields};
|
||||
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,371 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.api.hrm.bean.SelectOption;
|
||||
import com.engine.kq.biz.chain.cominfo.ShiftInfoCominfoBean;
|
||||
import com.engine.kq.enums.KqSplitFlowTypeEnum;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.StaticObj;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 考勤流程设置缓存类
|
||||
* 1、给流程上半天和天下拉框对应关系用的
|
||||
* 2、给根据人员id不同带出不同的请假类型用的
|
||||
* 主要是给HrmTimeSelWorkflowService这个地方用,流程调用
|
||||
*/
|
||||
public class KQAttFlowSetComInfo extends BaseBean {
|
||||
private ArrayList ids = null;
|
||||
|
||||
private StaticObj staticobj = null;
|
||||
|
||||
public KQAttFlowSetComInfo(User user) {
|
||||
staticobj = StaticObj.getInstance();
|
||||
if(user != null){
|
||||
setKQAttFlowSetComInfo(user);
|
||||
}
|
||||
}
|
||||
|
||||
public KQAttFlowSetComInfo() {
|
||||
staticobj = StaticObj.getInstance();
|
||||
getKQAttFlowSetComInfo() ;
|
||||
}
|
||||
|
||||
private void getKQAttFlowSetComInfo(User user) {
|
||||
if(staticobj.getObject("KQAttFlowSetComInfo&KQShift") == null || ((Hashtable)staticobj.getObject("KQAttFlowSetComInfo&KQShift")).size()==0) {
|
||||
setKQAttFlowSetComInfo(user);
|
||||
}
|
||||
ids = (ArrayList)(staticobj.getRecordFromObj("KQAttFlowSetComInfo&KQShift", "ids"));
|
||||
if(ids==null){
|
||||
setKQAttFlowSetComInfo(user);
|
||||
}
|
||||
}
|
||||
|
||||
private void getKQAttFlowSetComInfo() {
|
||||
if(staticobj.getObject("KQAttFlowSetComInfo&KQShift") == null || ((Hashtable)staticobj.getObject("KQAttFlowSetComInfo&KQShift")).size()==0) {
|
||||
setKQAttFlowSetComInfo();
|
||||
}
|
||||
ids = (ArrayList)(staticobj.getRecordFromObj("KQAttFlowSetComInfo&KQShift", "ids"));
|
||||
if(ids==null){
|
||||
setKQAttFlowSetComInfo();
|
||||
}
|
||||
}
|
||||
private void setKQAttFlowSetComInfo() {
|
||||
setKQAttFlowSetComInfo(null);
|
||||
}
|
||||
|
||||
private void setKQAttFlowSetComInfo(User user) {
|
||||
if(ids != null){
|
||||
ids.clear();
|
||||
}else{
|
||||
ids = new ArrayList();
|
||||
}
|
||||
|
||||
Map<String,Object> attFLowlinkMap = new HashMap<>();
|
||||
Map<String,Object> attFLowDependCfgMap = new HashMap<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs1 = new RecordSet();
|
||||
//现在只有请假流程有特殊处理
|
||||
String getAttFLowInfo = "select * from kq_att_proc_set where field005 = 1 and field006 in(0,6) ";
|
||||
try {
|
||||
rs.execute(getAttFLowInfo);
|
||||
while(rs.next()){
|
||||
String prefix = "";
|
||||
int type = 0;
|
||||
String id = rs.getString("id");
|
||||
String workflowid = rs.getString("field001");
|
||||
String attrType = rs.getString("field006");
|
||||
String setId = rs.getString("id");
|
||||
String usedetail = rs.getString("usedetail");
|
||||
if(usedetail.equalsIgnoreCase("1")){
|
||||
prefix = "detail_";
|
||||
type = 1;
|
||||
}
|
||||
|
||||
//请假类型存储的list
|
||||
Map<String,Object> linkageCfg = new HashMap<String,Object>();//联动
|
||||
Map<String,Object> dependCfg = new HashMap<String,Object>();//请假类型数据过滤
|
||||
|
||||
Map<String,String> map0 = new HashMap<>();
|
||||
String fieldSql = "select a.*,b.field002 fieldname from kq_att_proc_relation a left join kq_att_proc_fields b on a.field002 = b.id where b.field001=180 and a.field001="+setId+" and b.field002 in('"+prefix+"resourceId','"+prefix+"newLeaveType','"+prefix+"fromTime','"+prefix+"toTime') ";
|
||||
if("6".equalsIgnoreCase(attrType)){
|
||||
fieldSql = "select a.*,b.field002 fieldname from kq_att_proc_relation a left join kq_att_proc_fields b on a.field002 = b.id where b.field001=6 and a.field001="+setId+" and b.field002 in('resourceId','detail_newLeaveType','detail_leavefromTime','detail_leavetoTime','detail_fromTime','detail_toTime') ";
|
||||
}
|
||||
rs1.execute(fieldSql);
|
||||
while(rs1.next()){
|
||||
String fieldid = rs1.getString("field003");
|
||||
String fieldName = rs1.getString("fieldname");
|
||||
if("6".equalsIgnoreCase(attrType)){
|
||||
if(("resourceId").equalsIgnoreCase(fieldName)){
|
||||
map0.put("resourceId", fieldid);
|
||||
}
|
||||
if(("detail_newLeaveType").equalsIgnoreCase(fieldName)){
|
||||
map0.put("newLeaveType", fieldid);
|
||||
}
|
||||
if(("detail_leavefromTime").equalsIgnoreCase(fieldName)){
|
||||
map0.put("fromTime", fieldid);
|
||||
}
|
||||
if(("detail_leavetoTime").equalsIgnoreCase(fieldName)){
|
||||
map0.put("toTime", fieldid);
|
||||
}
|
||||
if(("detail_fromTime").equalsIgnoreCase(fieldName)){
|
||||
map0.put("back_fromTime", fieldid);
|
||||
}
|
||||
if(("detail_toTime").equalsIgnoreCase(fieldName)){
|
||||
map0.put("back_toTime", fieldid);
|
||||
}
|
||||
}else{
|
||||
if((prefix+"resourceId").equalsIgnoreCase(fieldName)){
|
||||
map0.put("resourceId", fieldid);
|
||||
}
|
||||
if((prefix+"newLeaveType").equalsIgnoreCase(fieldName)){
|
||||
map0.put("newLeaveType", fieldid);
|
||||
}
|
||||
if((prefix+"fromTime").equalsIgnoreCase(fieldName)){
|
||||
map0.put("fromTime", fieldid);
|
||||
}
|
||||
if((prefix+"toTime").equalsIgnoreCase(fieldName)){
|
||||
map0.put("toTime", fieldid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!map0.isEmpty()){
|
||||
String resourceId_f = Util.null2String(map0.get("resourceId"));
|
||||
String newLeaveType_f = Util.null2String(map0.get("newLeaveType"));
|
||||
String fromTime_f = Util.null2String(map0.get("fromTime"));
|
||||
String toTime_f = Util.null2String(map0.get("toTime"));
|
||||
String back_fromTime_f = Util.null2String(map0.get("back_fromTime"));
|
||||
String back_toTime_f = Util.null2String(map0.get("back_toTime"));
|
||||
// 根据人员id联动请假类型
|
||||
resIdLinkLeaveType(resourceId_f,newLeaveType_f, dependCfg, type);
|
||||
//请假类型联动出时间或者上午下午下拉框
|
||||
leaveTypeLinkTime(newLeaveType_f, fromTime_f, toTime_f, linkageCfg, type, null,user,back_fromTime_f,back_toTime_f);
|
||||
attFLowlinkMap.put(workflowid, linkageCfg);
|
||||
attFLowDependCfgMap.put(workflowid, dependCfg);
|
||||
}
|
||||
ids.add(id);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
writeLog(e) ;
|
||||
throw e ;
|
||||
}
|
||||
staticobj.putRecordToObj("KQAttFlowSetComInfo&KQShift", "ids", ids);
|
||||
staticobj.putRecordToObj("KQAttFlowSetComInfo&KQShift", "linkageCfg", attFLowlinkMap);
|
||||
staticobj.putRecordToObj("KQAttFlowSetComInfo&KQShift", "dependCfg", attFLowDependCfgMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据人员id联动请假类型
|
||||
* {field83333_1:[field8555_1,field866639_1]}
|
||||
* 接口说明:
|
||||
* 请假类型选择的值field83333_1(表示主表明细表):[人力资源浏览按钮field8555_1(用数组表示如果以后要增加多个)]
|
||||
* @param resourceId_f
|
||||
* @param newLeaveType_f
|
||||
* @param linkageCfg
|
||||
* @param type
|
||||
*/
|
||||
private void resIdLinkLeaveType(String resourceId_f, String newLeaveType_f, Map<String, Object> linkageCfg, int type) {
|
||||
List<String> linkageCfg1 = new ArrayList<String>();
|
||||
linkageCfg1.add(resourceId_f+"_"+type);
|
||||
linkageCfg.put(newLeaveType_f, linkageCfg1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请假类型fieldid_主表还是明细表(0,1){
|
||||
* {
|
||||
* 请假类型选择的值:{
|
||||
* changeType:"5-1"/"3-19" 选择了类型之后变成时间还是下拉框
|
||||
* fieldid:"112_1", 时间浏览按钮对应的fieldid_主表还是明细表
|
||||
* option:[ 变成下拉框之后下拉框里面的值
|
||||
* {key:"09:00",showname:"上午"},
|
||||
* {key:"13:00",showname:"下午"},
|
||||
* {key:"23:00",showname:"整天"}
|
||||
* ]
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* 请假类型选择框联动时间控件,下拉框
|
||||
* @param leaveTypeFieldId 请假类型fieldid
|
||||
* @param fromtimefieldId 时间浏览框fieldid
|
||||
* @param totimefieldId 时间浏览框fieldid
|
||||
* @param linkageCfg
|
||||
* @param type 0:主表; 1:明细表1; 2:明细表2; 3:明细表3
|
||||
* @param deafultValue
|
||||
* @param user
|
||||
* @param back_fromTime_f 销假时间浏览框fieldid
|
||||
* @param back_toTime_f 销假时间浏览框fieldid
|
||||
*/
|
||||
private void leaveTypeLinkTime(String leaveTypeFieldId, String fromtimefieldId,
|
||||
String totimefieldId, Map<String, Object> linkageCfg, int type, String[] deafultValue,User user,
|
||||
String back_fromTime_f,String back_toTime_f){
|
||||
int lan = user != null ? user.getLanguage() : 7;
|
||||
String allday = SystemEnv.getHtmlLabelName(390728, lan);
|
||||
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
|
||||
KQTimeSelectionComInfo kqTimeSelectionComInfo = new KQTimeSelectionComInfo();
|
||||
|
||||
Map<String,Object> selectChangeMapLinkage = new HashMap<String,Object>();
|
||||
|
||||
kqLeaveRulesComInfo.setTofirstRow();
|
||||
while(kqLeaveRulesComInfo.next()){
|
||||
String am = SystemEnv.getHtmlLabelName(16689, lan);
|
||||
String pm = SystemEnv.getHtmlLabelName(16690, lan);
|
||||
String ruleid = kqLeaveRulesComInfo.getId();
|
||||
String changeType = kqLeaveRulesComInfo.getMinimumUnit();
|
||||
String timeselection = kqLeaveRulesComInfo.getTimeSelection();
|
||||
String selectiontype = ""+KqSplitFlowTypeEnum.LEAVE.getFlowtype();
|
||||
Map<String,String> map = kqTimeSelectionComInfo.getTimeselections(selectiontype,ruleid,changeType);
|
||||
if(!map.isEmpty()){
|
||||
am = Util.null2String(map.get("half_on"));
|
||||
pm = Util.null2String(map.get("half_off"));
|
||||
if(am.length() == 0){
|
||||
am = SystemEnv.getHtmlLabelName(16689, lan);
|
||||
}
|
||||
if(pm.length() == 0){
|
||||
pm = SystemEnv.getHtmlLabelName(16690, lan);
|
||||
}
|
||||
}
|
||||
boolean isHalf = "2".equals(changeType);
|
||||
boolean isWhole = "4".equals(changeType);
|
||||
changeType = (isHalf||isWhole)?"5-1":"3-19";
|
||||
if(isHalf && "2".equalsIgnoreCase(timeselection)){
|
||||
//如果不是下拉框形式,还是按照时间浏览按钮显示
|
||||
changeType = "3-19";
|
||||
}
|
||||
|
||||
List<Object> fromHalfOption = new ArrayList<>();
|
||||
fromHalfOption.add(new SelectOption("08:00", am));
|
||||
fromHalfOption.add(new SelectOption("13:00", pm));
|
||||
|
||||
List<Object> toHalfOption = new ArrayList<>();
|
||||
toHalfOption.add(new SelectOption("13:00", am));
|
||||
toHalfOption.add(new SelectOption("18:00", pm));
|
||||
|
||||
List<Object> fromWholeOption = new ArrayList<>();
|
||||
fromWholeOption.add(new SelectOption("08:00", allday));
|
||||
|
||||
List<Object> toWholeOption = new ArrayList<>();
|
||||
toWholeOption.add(new SelectOption("18:00", allday));
|
||||
|
||||
List<Map<String,Object>> linkageCfg1 = new ArrayList<Map<String,Object>>();
|
||||
selectChangeMapLinkage.put(ruleid, linkageCfg1);
|
||||
Map<String,Object> cfg1 = new HashMap<String,Object>();
|
||||
cfg1.put("fieldid", fromtimefieldId+"_"+type); //改变的浏览框ID(_0为主字段,_1为明细字段)
|
||||
cfg1.put("changeType", changeType);
|
||||
List<Object> _new = new ArrayList<>();
|
||||
if(isHalf){
|
||||
List<Object> _new_half = new ArrayList<>();
|
||||
_new_half.addAll(fromHalfOption);
|
||||
_new.addAll(_new_half);
|
||||
}
|
||||
if(isWhole){
|
||||
List<Object> _new_half = new ArrayList<>();
|
||||
_new_half.addAll(fromWholeOption);
|
||||
_new.addAll(_new_half);
|
||||
}
|
||||
cfg1.put("selectOption", _new); //下拉框里的值对应关系
|
||||
linkageCfg1.add(cfg1);
|
||||
cfg1 = new HashMap<String,Object>();
|
||||
cfg1.put("fieldid", totimefieldId+"_"+type); //改变的浏览框ID(_0为主字段,_1为明细字段)
|
||||
cfg1.put("changeType", changeType);
|
||||
List<Object> _new1 = new ArrayList<>();
|
||||
if(isHalf){
|
||||
List<Object> _new_whole = new ArrayList<>();
|
||||
_new_whole.addAll(toHalfOption);
|
||||
_new1.addAll(_new_whole);
|
||||
}
|
||||
if(isWhole){
|
||||
List<Object> _new_whole = new ArrayList<>();
|
||||
_new_whole.addAll(toWholeOption);
|
||||
_new1.addAll(_new_whole);
|
||||
}
|
||||
cfg1.put("selectOption", _new1); //下拉框里的值对应关系
|
||||
linkageCfg1.add(cfg1);
|
||||
|
||||
if(back_fromTime_f.length() > 0 && back_toTime_f.length() > 0){
|
||||
cfg1 = new HashMap<String,Object>();
|
||||
cfg1.put("fieldid", back_fromTime_f+"_"+type); //改变的浏览框ID(_0为主字段,_1为明细字段)
|
||||
cfg1.put("changeType", changeType);
|
||||
List<Object> _new2 = new ArrayList<>();
|
||||
if(isHalf){
|
||||
List<Object> _new_whole = new ArrayList<>();
|
||||
_new_whole.addAll(fromHalfOption);
|
||||
_new2.addAll(_new_whole);
|
||||
}
|
||||
if(isWhole){
|
||||
List<Object> _new_whole = new ArrayList<>();
|
||||
_new_whole.addAll(fromWholeOption);
|
||||
_new2.addAll(_new_whole);
|
||||
}
|
||||
cfg1.put("selectOption", _new2); //下拉框里的值对应关系
|
||||
linkageCfg1.add(cfg1);
|
||||
|
||||
cfg1 = new HashMap<String,Object>();
|
||||
cfg1.put("fieldid", back_toTime_f+"_"+type); //改变的浏览框ID(_0为主字段,_1为明细字段)
|
||||
cfg1.put("changeType", changeType);
|
||||
List<Object> _new3 = new ArrayList<>();
|
||||
if(isHalf){
|
||||
List<Object> _new_whole = new ArrayList<>();
|
||||
_new_whole.addAll(toHalfOption);
|
||||
_new3.addAll(_new_whole);
|
||||
}
|
||||
if(isWhole){
|
||||
List<Object> _new_whole = new ArrayList<>();
|
||||
_new_whole.addAll(toWholeOption);
|
||||
_new3.addAll(_new_whole);
|
||||
}
|
||||
cfg1.put("selectOption", _new3); //下拉框里的值对应关系
|
||||
linkageCfg1.add(cfg1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
linkageCfg.put(leaveTypeFieldId+"_"+type, selectChangeMapLinkage);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 和流程联调的根据请假类型不同带出不同的时间选择框
|
||||
* @param workflowid
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> getLinkageCfgByWfId(String workflowid){
|
||||
Map<String,Object> attFLowlinkMap = (Map<String,Object>)staticobj.getRecordFromObj("KQAttFlowSetComInfo&KQShift", "linkageCfg");
|
||||
if(attFLowlinkMap != null && attFLowlinkMap.get(workflowid) != null){
|
||||
return (Map<String, Object>) attFLowlinkMap.get(workflowid);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* com/api/hrm/service/HrmTimeSelWorkflowService.java
|
||||
* 这个地方会调用,控制流程的半天和整天下拉框的
|
||||
* 和流程联调的根据不同的人员带出不同的请假类型
|
||||
* @param workflowid
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> getDependCfgByWfId(String workflowid){
|
||||
Map<String,Object> attFLowDependCfgMap = (Map<String,Object>)staticobj.getRecordFromObj("KQAttFlowSetComInfo&KQShift", "dependCfg");
|
||||
if(attFLowDependCfgMap != null && attFLowDependCfgMap.get(workflowid) != null){
|
||||
return (Map<String, Object>) attFLowDependCfgMap.get(workflowid);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void removeKQAttFlowSetComInfoCache(){
|
||||
staticobj.removeObject("KQAttFlowSetComInfo&KQShift");
|
||||
KQAttProcSetComInfo kqAttProcSetComInfo = new KQAttProcSetComInfo();
|
||||
kqAttProcSetComInfo.removeCache();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import weaver.cache.CacheBase;
|
||||
import weaver.cache.CacheColumn;
|
||||
import weaver.cache.CacheColumnType;
|
||||
import weaver.cache.PKColumn;
|
||||
|
||||
/**
|
||||
* 考勤流程设置基础信息缓存类
|
||||
*/
|
||||
public class KQAttProcSetComInfo extends CacheBase{
|
||||
protected static String TABLE_NAME = "kq_att_proc_set";
|
||||
/** sql中的where信息,不要以where开始 */
|
||||
protected static String TABLE_WHERE = null;
|
||||
/** sql中的order by信息,不要以order by开始 */
|
||||
protected static String TABLE_ORDER = "field001";
|
||||
|
||||
/**
|
||||
* 这个就是流程id
|
||||
*/
|
||||
@PKColumn(type = CacheColumnType.NUMBER)
|
||||
protected static String PK_NAME = "field001";
|
||||
|
||||
/**
|
||||
* 对应表单id
|
||||
*/
|
||||
@CacheColumn(name = "field002")
|
||||
protected static int field002;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@CacheColumn(name = "field005")
|
||||
protected static int field005;
|
||||
|
||||
/**
|
||||
* 变更流程类型,0表示请假,1表示出差,2表示公出,3表示加班,4表示异常,5表示调班,6表示销假,7表示补卡
|
||||
*/
|
||||
@CacheColumn(name = "field006")
|
||||
protected static int field006;
|
||||
|
||||
/**
|
||||
* 是否启用明细表,默认不启用,1表示启用
|
||||
*/
|
||||
@CacheColumn(name = "usedetail")
|
||||
protected static int usedetail;
|
||||
|
||||
/**
|
||||
* 流程可抵扣打卡記錄,默认不启用,1表示启用
|
||||
*/
|
||||
@CacheColumn(name = "flow_deduct_card")
|
||||
protected static int flow_deduct_card;
|
||||
|
||||
/**
|
||||
* 考勤流程设置id
|
||||
*/
|
||||
@CacheColumn(name = "id")
|
||||
protected static int attid;
|
||||
|
||||
public String getId(){
|
||||
return (String)getRowValue(PK_INDEX);
|
||||
}
|
||||
public String getWorkflowId(){
|
||||
return (String)getRowValue(PK_INDEX);
|
||||
}
|
||||
|
||||
public String getFormid() { return (String)getRowValue(field002); }
|
||||
|
||||
public String getFormid(String key)
|
||||
{
|
||||
return (String)getValue(field002,key);
|
||||
}
|
||||
|
||||
public String getEnable() { return (String)getRowValue(field005); }
|
||||
public String getEnable(String key)
|
||||
{
|
||||
return (String)getValue(field005,key);
|
||||
}
|
||||
|
||||
public String getkqType() { return (String)getRowValue(field006); }
|
||||
public String getkqType(String key)
|
||||
{
|
||||
return (String)getValue(field006,key);
|
||||
}
|
||||
|
||||
public String getUsedetail() { return (String)getRowValue(usedetail); }
|
||||
public String getUsedetail(String key)
|
||||
{
|
||||
return (String)getValue(usedetail,key);
|
||||
}
|
||||
|
||||
public String getFlow_deduct_card() { return (String)getRowValue(flow_deduct_card); }
|
||||
public String getFlow_deduct_card(String key)
|
||||
{
|
||||
return (String)getValue(flow_deduct_card,key);
|
||||
}
|
||||
|
||||
public String getAttid() { return (String)getRowValue(attid); }
|
||||
public String getAttid(String key)
|
||||
{
|
||||
return (String)getValue(attid,key);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,55 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import weaver.cache.CacheBase;
|
||||
import weaver.cache.CacheColumn;
|
||||
import weaver.cache.CacheColumnType;
|
||||
import weaver.cache.PKColumn;
|
||||
|
||||
/**
|
||||
* EM端设置过自定义的自动打卡对应的缓存类
|
||||
*/
|
||||
public class KQAutoCheckComInfo extends CacheBase{
|
||||
protected static String TABLE_NAME = "kq_autocheck_set";
|
||||
/** sql中的where信息,不要以where开始 */
|
||||
protected static String TABLE_WHERE = null;
|
||||
/** sql中的order by信息,不要以order by开始 */
|
||||
protected static String TABLE_ORDER = "resourceid";
|
||||
|
||||
@PKColumn(type = CacheColumnType.NUMBER)
|
||||
protected static String PK_NAME = "resourceid";
|
||||
|
||||
@CacheColumn(name = "auto_checkin")
|
||||
protected static int auto_checkin;
|
||||
|
||||
@CacheColumn(name = "auto_checkout")
|
||||
protected static int auto_checkout;
|
||||
|
||||
@CacheColumn(name = "groupid")
|
||||
protected static int groupid;
|
||||
|
||||
public String getId(){
|
||||
return (String)getRowValue(PK_INDEX);
|
||||
}
|
||||
|
||||
public String getAuto_checkin() {
|
||||
return (String)getRowValue(auto_checkin);
|
||||
}
|
||||
public String getAuto_checkin(String key) {
|
||||
return (String)getValue(auto_checkin,key);
|
||||
}
|
||||
|
||||
public String getAuto_checkout() {
|
||||
return (String)getRowValue(auto_checkout);
|
||||
}
|
||||
public String getAuto_checkout(String key) {
|
||||
return (String)getValue(auto_checkout,key);
|
||||
}
|
||||
|
||||
public String getGroupid() {
|
||||
return (String)getRowValue(groupid);
|
||||
}
|
||||
public String getGroupid(String key) {
|
||||
return (String)getValue(groupid,key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import weaver.cache.CacheBase;
|
||||
import weaver.cache.CacheColumn;
|
||||
import weaver.cache.CacheColumnType;
|
||||
import weaver.cache.PKColumn;
|
||||
|
||||
/**
|
||||
* 自动打卡
|
||||
* 打卡范围缓存类
|
||||
*/
|
||||
public class KQAutoTimeRangeComInfo extends CacheBase{
|
||||
protected static String TABLE_NAME = "kq_auto_timerange";
|
||||
/** sql中的where信息,不要以where开始 */
|
||||
protected static String TABLE_WHERE = null;
|
||||
/** sql中的order by信息,不要以order by开始 */
|
||||
protected static String TABLE_ORDER = "id";
|
||||
|
||||
@PKColumn(type = CacheColumnType.NUMBER)
|
||||
protected static String PK_NAME = "user_kq_date";
|
||||
|
||||
@CacheColumn(name = "kq_param")
|
||||
protected static int kq_param;
|
||||
|
||||
public String getId(){
|
||||
return (String)getRowValue(PK_INDEX);
|
||||
}
|
||||
|
||||
public String getKq_param() { return (String)getRowValue(kq_param); }
|
||||
|
||||
public String getKq_param(String key)
|
||||
{
|
||||
return (String)getValue(kq_param,key);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,21 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.engine.kq.log.KQLog;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
/**
|
||||
* 格式化昨天的考勤数据
|
||||
*/
|
||||
public class KQBalanceOfLeaveJob extends BaseCronJob {
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public void execute() {
|
||||
try {
|
||||
kqLog.info("begin do KQBalanceOfLeaveJob invoke ...");
|
||||
KQBalanceOfLeaveBiz.createBalanceOfLeave();
|
||||
kqLog.info("end do KQBalanceOfLeaveJob invoke ...");
|
||||
} catch (Exception e) {
|
||||
kqLog.info(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.engine.kq.bean.KqOldCardFlowFlushBean;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.StaticObj;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 如果补卡流程绑定了多人力,那么历史的数据就会受到影响,因为明细表中添加了个人员字段,所以这里需要将主表的补卡人刷到明细表中的补卡人中去
|
||||
* 查看是否有历史的补卡流程需要调整数据处理,将主表的补卡人更新到明细表中的补卡人
|
||||
*/
|
||||
public class KQCardFlowFlushJob extends TimerTask {
|
||||
private static KQCardFlowFlushJob instance = new KQCardFlowFlushJob();
|
||||
|
||||
private StaticObj staticobj = null;
|
||||
|
||||
public static KQCardFlowFlushJob getInstance(){
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
staticobj = StaticObj.getInstance();
|
||||
if(staticobj.getObject("kq&oldcardflow") != null) {
|
||||
return;
|
||||
}
|
||||
getNeedFlushList();
|
||||
if(staticobj.getObject("kq&oldcardflow") != null) {
|
||||
RecordSet rs = new RecordSet();
|
||||
List<KqOldCardFlowFlushBean> beans = (List<KqOldCardFlowFlushBean>)staticobj.getObject("kq&oldcardflow");
|
||||
for(KqOldCardFlowFlushBean bean : beans) {
|
||||
// 执行刷新历史补卡数据,刷新完后将flush_oldcard_flow表isexecute置为1
|
||||
int id=bean.getId();
|
||||
int prosetid = bean.getProsetid();
|
||||
int workflowid = bean.getWorkflowid();
|
||||
int billid = bean.getBillid();
|
||||
String maintablename = bean.getMaintablename();
|
||||
String detailtablename = bean.getDetailtablename();
|
||||
String mainresourcefield = bean.getMainresourcefield();
|
||||
String detailresourcefield = bean.getDetailresourcefield();
|
||||
String sql = "select id,"+mainresourcefield+" from "+maintablename;
|
||||
rs.executeQuery(sql);
|
||||
Map<String, String> mainResourceIdMap = new HashMap<>();
|
||||
while (rs.next()) {
|
||||
mainResourceIdMap.put(rs.getString("id"), rs.getString(mainresourcefield));
|
||||
}
|
||||
boolean isSuccess = true;
|
||||
for(Map.Entry<String, String> entry : mainResourceIdMap.entrySet()) {
|
||||
String mainId = entry.getKey();
|
||||
String mainUserId = entry.getValue();
|
||||
String updateSql = "update "+detailtablename+" set "+detailresourcefield+" = ? " +
|
||||
"where mainid = ? and "+detailresourcefield+" is null ";
|
||||
boolean flag = rs.executeUpdate(updateSql, mainUserId, mainId);
|
||||
if(!flag) {
|
||||
isSuccess = false;
|
||||
}
|
||||
}
|
||||
if(isSuccess) {
|
||||
rs.executeUpdate("update flush_oldcard_flow set isexecute=1 where id="+id);
|
||||
}
|
||||
}
|
||||
staticobj.removeObject("kq&oldcardflow");
|
||||
}
|
||||
}
|
||||
|
||||
private void getNeedFlushList() {
|
||||
RecordSet recordSet = new RecordSet();
|
||||
KqOldCardFlowFlushBean bean = null;
|
||||
String sql = "select * from flush_oldcard_flow where isexecute=0";
|
||||
recordSet.executeQuery(sql);
|
||||
List<KqOldCardFlowFlushBean> beans = new ArrayList<>();
|
||||
while (recordSet.next()) {
|
||||
bean = new KqOldCardFlowFlushBean();
|
||||
int id = recordSet.getInt("id");
|
||||
bean.setId(id);
|
||||
int prosetid = recordSet.getInt("prosetid");
|
||||
bean.setProsetid(prosetid);
|
||||
bean.setWorkflowid(recordSet.getInt("workflowid"));
|
||||
bean.setBillid(recordSet.getInt("billid"));
|
||||
bean.setMaintablename(recordSet.getString("maintablename"));
|
||||
bean.setDetailtablename(recordSet.getString("detailtablename"));
|
||||
bean.setMainresourcefield(recordSet.getString("mainresourcefield"));
|
||||
bean.setDetailresourcefield(recordSet.getString("detailresourcefield"));
|
||||
bean.setIsexecute(recordSet.getInt("isexecute"));
|
||||
beans.add(bean);
|
||||
}
|
||||
staticobj.putObject("kq&oldcardflow",beans);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import weaver.conn.ConnStatement;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.common.DbFunctionUtil;
|
||||
|
||||
/**
|
||||
* 打卡数据做一个日志记录表
|
||||
*/
|
||||
public class KQCardLogBiz {
|
||||
private static KQLog kqLog = new KQLog();
|
||||
|
||||
/**
|
||||
* 记录一下打卡相关的信息
|
||||
* @param resourceid
|
||||
* @param logMap
|
||||
* @param workTimeEntityLogMap
|
||||
* @param cardtype
|
||||
* @return
|
||||
*/
|
||||
public static String logCardInfo(String resourceid, Map<String, Object> logMap,Map<String,Object> workTimeEntityLogMap, String cardtype) {
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String cardlog_in_table = Util.null2String(kqSettingsComInfo.getMain_val("cardlog_in_table"),"0");
|
||||
if("0".equalsIgnoreCase(cardlog_in_table)){
|
||||
return "";
|
||||
}
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
try{
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String other_info = "";
|
||||
if(logMap != null){
|
||||
other_info = JSON.toJSONString(logMap,SerializerFeature.DisableCheckSpecialChar,SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
String serial_info = "";
|
||||
if(workTimeEntityLogMap != null){
|
||||
serial_info = JSON.toJSONString(workTimeEntityLogMap,SerializerFeature.DisableCheckSpecialChar,SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
boolean isok = false;
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&& Util.null2String(rs.getOrgindbtype()).equals("oracle")){
|
||||
String sql = "insert into kq_card_log(resourceid,createdatetime,serial_info,other_info,uuid,cardtype) "
|
||||
+ " values(?,"+DbFunctionUtil.getCurrentFullTimeFunction(rs.getDBType())+",empty_clob(),empty_clob(),?,?) ";
|
||||
isok = rs.executeUpdate(sql,resourceid,uuid,cardtype);
|
||||
}else{
|
||||
String sql = "insert into kq_card_log(resourceid,createdatetime,serial_info,other_info,uuid,cardtype) "
|
||||
+ " values(?,"+DbFunctionUtil.getCurrentFullTimeFunction(rs.getDBType())+",?,?,?,?) ";
|
||||
boolean isRight = rs.executeUpdate(sql,resourceid,serial_info,other_info,uuid,cardtype);
|
||||
kqLog.info("logCardInfo sql:"+sql+":isRight:"+isRight);
|
||||
}
|
||||
if(isok && rs.getDBType().equalsIgnoreCase("oracle")&& Util.null2String(rs.getOrgindbtype()).equals("oracle")){
|
||||
ConnStatement stat=null;
|
||||
try {
|
||||
stat = new ConnStatement();
|
||||
// 需要使用for update方法来进行更新,
|
||||
// 但是,特别需要注意,如果原来CLOB字段有值,需要使用empty_clob()将其清空。
|
||||
// 如果原来是null,也不能更新,必须是empty_clob()返回的结果。
|
||||
stat.setStatementSql("select serial_info,other_info from kq_card_log where uuid=? for update", false);
|
||||
stat.setString(1,uuid);
|
||||
stat.executeQuery();
|
||||
if (stat.next()) {
|
||||
oracle.sql.CLOB serial_clob = (oracle.sql.CLOB) stat.getClob("serial_info");
|
||||
Writer serial_outStream = serial_clob.getCharacterOutputStream();
|
||||
char[] serial_c = serial_info.toCharArray();
|
||||
serial_outStream.write(serial_c, 0, serial_c.length);
|
||||
serial_outStream.flush();
|
||||
serial_outStream.close();
|
||||
|
||||
oracle.sql.CLOB other_clob = (oracle.sql.CLOB) stat.getClob("other_info");
|
||||
Writer other_outStream = other_clob.getCharacterOutputStream();
|
||||
char[] other_c = other_info.toCharArray();
|
||||
other_outStream.write(other_c, 0, other_c.length);
|
||||
other_outStream.flush();
|
||||
other_outStream.close();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (stat != null) {
|
||||
stat.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
kqLog.info("打卡日志报错:KQCardLogBiz:");
|
||||
StringWriter errorsWriter = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(errorsWriter));
|
||||
kqLog.info(errorsWriter.toString());
|
||||
}
|
||||
return uuid;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import weaver.cache.CacheBase;
|
||||
import weaver.cache.CacheColumn;
|
||||
import weaver.cache.CacheColumnType;
|
||||
import weaver.cache.PKColumn;
|
||||
|
||||
/**
|
||||
* 假期规则缓存类
|
||||
*/
|
||||
public class KQChildrenComInfo extends CacheBase {
|
||||
|
||||
/**
|
||||
* 数据来源
|
||||
*/
|
||||
protected static String TABLE_NAME = "hrmfamilyinfo";
|
||||
/**
|
||||
* sql中的where信息,不要以where开始
|
||||
*/
|
||||
protected static String TABLE_WHERE = " WhetherChildren=1 ";
|
||||
/**
|
||||
* sql中的order by信息,不要以order by开始
|
||||
*/
|
||||
protected static String TABLE_ORDER = " id ";
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@PKColumn(type = CacheColumnType.NUMBER)
|
||||
protected static String PK_NAME = "id";
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
@CacheColumn(name = "birthday")
|
||||
protected static int birthday;
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@CacheColumn(name = "member")
|
||||
protected static int member;
|
||||
/**
|
||||
* 家长id
|
||||
*/
|
||||
@CacheColumn(name = "resourceid")
|
||||
protected static int resourceid;
|
||||
|
||||
|
||||
public String getId(){
|
||||
return (String)getRowValue(PK_INDEX);
|
||||
}
|
||||
|
||||
public String getChildrenName() {
|
||||
return (String)getRowValue(member);
|
||||
}
|
||||
|
||||
public String getChildrenName(String key){
|
||||
return (String) getValue(member,key);
|
||||
}
|
||||
|
||||
public String getBirthday() {
|
||||
return (String)getRowValue(birthday);
|
||||
}
|
||||
|
||||
public String getBirthday(String key){
|
||||
return (String) getValue(birthday,key);
|
||||
}
|
||||
|
||||
public String getResourceid() {
|
||||
return (String)getRowValue(resourceid);
|
||||
}
|
||||
|
||||
public String getResourceid(String key){
|
||||
return (String) getValue(resourceid,key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCache() {
|
||||
super.removeCache();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
/**
|
||||
* 只保留进10天的考勤打卡日志
|
||||
*/
|
||||
public class KQClearCardLogJob extends BaseCronJob{
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
BaseBean bb = new BaseBean();
|
||||
try{
|
||||
bb.writeLog("begin do KQClearCardLogJob invoke ...");
|
||||
RecordSet rs = new RecordSet();
|
||||
String curdate = DateUtil.getCurrentDate();
|
||||
String curdate_10 = DateUtil.addDate(curdate, -10);
|
||||
String sql = "delete from kq_card_log where createdatetime < ? ";
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
sql = "delete from kq_card_log where to_char(createdatetime, 'yyyy-mm-dd') < ? ";
|
||||
}
|
||||
|
||||
boolean isok = rs.executeUpdate(sql,curdate_10);
|
||||
bb.writeLog("KQClearCardLogJob invoke ...curdate::"+curdate+":curdate_10:"+curdate_10+":isok:"+isok);
|
||||
//删除加班
|
||||
String curdate_30 = DateUtil.addDate(curdate, -30);
|
||||
sql = "delete from kq_overtime_log where createdatetime < ? ";
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
sql = "delete from kq_overtime_log where to_char(createdatetime, 'yyyy-mm-dd') < ? ";
|
||||
}
|
||||
isok = rs.executeUpdate(sql,curdate_30);
|
||||
bb.writeLog("KQClearCardLogJob invoke ...curdate::"+curdate+":curdate_30:"+curdate_30+":sql:"+sql+":isok:"+isok);
|
||||
|
||||
sql = "delete from kq_overtime_log_detail where createdatetime < ? ";
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
sql = "delete from kq_overtime_log_detail where to_char(createdatetime, 'yyyy-mm-dd') < ? ";
|
||||
}
|
||||
isok = rs.executeUpdate(sql,curdate_30);
|
||||
bb.writeLog("KQClearCardLogJob invoke ...curdate::"+curdate+":curdate_30:"+curdate_30+":sql:"+sql+":isok:"+isok);
|
||||
|
||||
bb.writeLog("end do KQClearCardLogJob invoke ...");
|
||||
}catch (Exception e) {
|
||||
bb.writeLog(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import weaver.cache.CacheBase;
|
||||
import weaver.cache.CacheColumn;
|
||||
import weaver.cache.CacheColumnType;
|
||||
import weaver.cache.PKColumn;
|
||||
|
||||
/**
|
||||
* 考勤配置缓存表
|
||||
*/
|
||||
public class KQConfigComInfo extends CacheBase{
|
||||
protected static String TABLE_NAME = "kq_config";
|
||||
/** sql中的where信息,不要以where开始 */
|
||||
protected static String TABLE_WHERE = null;
|
||||
/** sql中的order by信息,不要以order by开始 */
|
||||
protected static String TABLE_ORDER = "name";
|
||||
|
||||
@PKColumn(type = CacheColumnType.NUMBER)
|
||||
protected static String PK_NAME = "name";
|
||||
|
||||
@CacheColumn(name = "value")
|
||||
protected static int value;
|
||||
|
||||
public String getId(){
|
||||
return (String)getRowValue(PK_INDEX);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return (String)getRowValue(value);
|
||||
}
|
||||
public String getValue(String key) {
|
||||
return (String)getValue(value,key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.engine.kq.biz;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.kq.service.KQScheduleSignImportService;
|
||||
import com.engine.kq.service.impl.KQScheduleSignImportServiceImpl;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.common.Tools;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class KQDingTalkImportJob extends BaseCronJob{
|
||||
public void execute() {
|
||||
BaseBean bb = new BaseBean();
|
||||
try{
|
||||
|
||||
bb.writeLog("begin do KQDingTalkImportJob invoke ...");
|
||||
KQScheduleSignImportService kqScheduleSignImportService = (KQScheduleSignImportServiceImpl) ServiceUtil.getService(KQScheduleSignImportServiceImpl.class);
|
||||
//导入策略 每天导入前一天和当天数据
|
||||
Map<String,Object> params = new HashMap<>();
|
||||
params.put("fromDate",Tools.getDate(Tools.getToday(),-1));
|
||||
params.put("toDate",Tools.getDate(Tools.getToday()));
|
||||
|
||||
bb.writeLog("do KQDingTalkImportJob invoke.."+ JSONObject.toJSONString(params));
|
||||
|
||||
kqScheduleSignImportService.synDingTalkData(params);
|
||||
|
||||
bb.writeLog("end do KQDingTalkImportJob invoke ...");
|
||||
}catch (Exception e) {
|
||||
bb.writeLog(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Copyright (c) 2001-2017 泛微软件.
|
||||
* 泛微协同商务系统,版权所有.
|
||||
*
|
||||
*/
|
||||
package com.engine.kq.biz;
|
||||
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
|
||||
/**
|
||||
* 给流程组提供方法,即使是只读字段也可以入库的
|
||||
*/
|
||||
public class KQEditFieldInWorkflowBiz {
|
||||
|
||||
/**
|
||||
* 给流程组提供方法,即使是只读字段也可以入库的
|
||||
* @param workflowParam 流程id之类的一些流程的基本信息
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<String> getEditFieldInWorkflow(Map<String,Object> workflowParam) {
|
||||
KQLog kqLog = new KQLog();
|
||||
|
||||
List<String> fieldList = Lists.newArrayList();
|
||||
try{
|
||||
String workflowid = Util.null2String(workflowParam.get("workflowid"));
|
||||
if(workflowid.length() > 0 && Util.getIntValue(workflowid) > 0){
|
||||
String editField = "duration";
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select * from kq_att_proc_relation where field002 in(select id from kq_att_proc_fields where field002 like '%"+editField+"%') and field001 in(select id from kq_att_proc_set where field001="+workflowid+" and field005 =1) ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String workflowFieldid = rs.getString("field003");
|
||||
String fieldid = workflowFieldid;
|
||||
fieldList.add(fieldid);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
StringWriter errorsWriter = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(errorsWriter));
|
||||
kqLog.info("getEditFieldInWorkflow :"+errorsWriter.toString());
|
||||
}
|
||||
|
||||
return fieldList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import weaver.cache.*;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.ThreadVarLanguage;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 考勤提醒,邮件提醒模板缓存类
|
||||
*/
|
||||
public class KQEmailRemindComInfo extends CacheBase {
|
||||
|
||||
/**
|
||||
* 数据来源
|
||||
*/
|
||||
protected static String TABLE_NAME = " kq_emailRemindTemplate ";
|
||||
/**
|
||||
* sql中的where信息,不要以where开始
|
||||
*/
|
||||
protected static String TABLE_WHERE = "";
|
||||
/**
|
||||
* sql中的order by信息,不要以order by开始
|
||||
*/
|
||||
protected static String TABLE_ORDER = "id";
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@PKColumn(type = CacheColumnType.NUMBER)
|
||||
protected static String PK_NAME = "id";
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@CacheColumn(name = "id")
|
||||
protected static int id;
|
||||
|
||||
/**
|
||||
* 班次ID
|
||||
*/
|
||||
@CacheColumn(name = "serialId")
|
||||
protected static int serialId;
|
||||
|
||||
/**
|
||||
* 签到还是签退
|
||||
*/
|
||||
@CacheColumn(name = "signInOrSignOut")
|
||||
protected static int signInOrSignOut;
|
||||
|
||||
/**
|
||||
* 邮件标题
|
||||
*/
|
||||
@CacheColumn(name = "emailTitle")
|
||||
protected static int emailTitle;
|
||||
|
||||
/**
|
||||
* 邮件内容
|
||||
*/
|
||||
@CacheColumn(name = "emailContent")
|
||||
protected static int emailContent;
|
||||
|
||||
@Override
|
||||
public CacheMap initCache() throws Exception {
|
||||
CacheMap localData = super.createCacheMap();
|
||||
RecordSet recordSet = new RecordSet();
|
||||
String sql = "select * from kq_emailRemindTemplate";
|
||||
recordSet.executeQuery(sql);
|
||||
while (recordSet.next()) {
|
||||
String _id = recordSet.getString("id");
|
||||
String _serialId = recordSet.getString("serialId");
|
||||
String _signInOrSignOut = recordSet.getString("signInOrSignOut");
|
||||
String _emailTile = recordSet.getString("emailTtle");
|
||||
String _emailContent = recordSet.getString("emailContent");
|
||||
String PK = _serialId + "-" + _signInOrSignOut;
|
||||
CacheItem cacheItem = createCacheItem();
|
||||
cacheItem.set(PK_INDEX, PK);
|
||||
cacheItem.set(id, _id);
|
||||
cacheItem.set(serialId, _serialId);
|
||||
cacheItem.set(signInOrSignOut, _signInOrSignOut);
|
||||
cacheItem.set(emailTitle, _emailTile);
|
||||
cacheItem.set(emailContent, _emailContent);
|
||||
modifyCacheItem(PK, cacheItem);
|
||||
localData.put(PK, cacheItem);
|
||||
}
|
||||
return localData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CacheItem initCache(String key) {
|
||||
if (key == null || "".equals(key.trim())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String[] keyArr = key.split("-");
|
||||
if (keyArr.length != 2) {
|
||||
return null;
|
||||
}
|
||||
String sql = "select * from kq_emailRemindTemplate where serialId=? and signInOrSignOut=?";
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeQuery(sql, keyArr[0], keyArr[1]);
|
||||
if (recordSet.next()) {
|
||||
String _id = recordSet.getString("id");
|
||||
String _serialId = recordSet.getString("serialId");
|
||||
String _signInOrSignOut = recordSet.getString("signInOrSignOut");
|
||||
String _emailTile = recordSet.getString("emailTtle");
|
||||
String _emailContent = recordSet.getString("emailContent");
|
||||
String PK = _serialId + "-" + _signInOrSignOut;
|
||||
CacheItem cacheItem = createCacheItem();
|
||||
cacheItem.set(PK_INDEX, PK);
|
||||
cacheItem.set(id, _id);
|
||||
cacheItem.set(serialId, _serialId);
|
||||
cacheItem.set(signInOrSignOut, _signInOrSignOut);
|
||||
cacheItem.set(emailTitle, _emailTile);
|
||||
cacheItem.set(emailContent, _emailContent);
|
||||
modifyCacheItem(key, cacheItem);
|
||||
return cacheItem;
|
||||
} else {
|
||||
CacheItem cacheItem = createCacheItem();
|
||||
return cacheItem;
|
||||
}
|
||||
}
|
||||
|
||||
private String getEmailTitle(String key) {
|
||||
return (String) getValue(emailTitle, key);
|
||||
}
|
||||
|
||||
public String getEmailTitle(String serialId, String signInOrSignOut) {
|
||||
String PK = serialId + "-" + signInOrSignOut;
|
||||
String emailTitle = getEmailTitle(PK);
|
||||
if ("".equals(emailTitle)) {
|
||||
if ("1".equals(signInOrSignOut)) {
|
||||
emailTitle = ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005295,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
} else {
|
||||
emailTitle = ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005296,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
}
|
||||
}
|
||||
return emailTitle;
|
||||
}
|
||||
|
||||
private String getEmailContent(String key) {
|
||||
return (String) getValue(emailContent, key);
|
||||
}
|
||||
|
||||
public String getEmailContent(String serialId, String signInOrSignOut) {
|
||||
String PK = serialId + "-" + signInOrSignOut;
|
||||
String emailContent = getEmailContent(PK);
|
||||
if ("".equals(emailContent)) {
|
||||
if ("1".equals(signInOrSignOut)) {
|
||||
emailContent = ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005295,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
} else {
|
||||
emailContent = ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005296,weaver.general.ThreadVarLanguage.getLang())+"";
|
||||
}
|
||||
}
|
||||
if (emailContent.contains("["+ SystemEnv.getHtmlLabelName(18843, ThreadVarLanguage.getLang())+"]") && "1".equals(signInOrSignOut)) {
|
||||
KQShiftManagementComInfo shiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
String minsBeforeSignIn = shiftManagementComInfo.getMinsBeforeSignIn(serialId);
|
||||
emailContent = emailContent.replace("["+ SystemEnv.getHtmlLabelName(18843, ThreadVarLanguage.getLang())+"]", minsBeforeSignIn + ""+ SystemEnv.getHtmlLabelName(15049, ThreadVarLanguage.getLang())+"");
|
||||
}
|
||||
if (emailContent.contains("["+ SystemEnv.getHtmlLabelName(10005342, ThreadVarLanguage.getLang())+"]") && "2".equals(signInOrSignOut)) {
|
||||
KQShiftManagementComInfo shiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
String minsAfterSignOut = shiftManagementComInfo.getMinsAfterSignOut(serialId);
|
||||
emailContent = emailContent.replace("["+ SystemEnv.getHtmlLabelName(10005342, ThreadVarLanguage.getLang())+"]", minsAfterSignOut + ""+ SystemEnv.getHtmlLabelName(15049, ThreadVarLanguage.getLang())+"");
|
||||
}
|
||||
return emailContent;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
|
||||
/**
|
||||
* 公出规则
|
||||
*/
|
||||
public class KQExitRulesBiz {
|
||||
|
||||
/**
|
||||
* 获取最小出差单位
|
||||
* 1-按天出差
|
||||
* 2-按半天出差
|
||||
* 3-按小时出差
|
||||
* 4-按整天出差
|
||||
* 其他:无效数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getMinimumUnit() {
|
||||
KQExitRulesComInfo kqExitRulesComInfo = new KQExitRulesComInfo();
|
||||
return kqExitRulesComInfo.getMinimumUnit("1");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取换算比例
|
||||
* 当公出单位由天、半天、整天切换成小时或者由小时切换成天、半天、整天时,历史数据会按照此换算比例自动进行换算
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getProportion() {
|
||||
KQExitRulesComInfo kqExitRulesComInfo = new KQExitRulesComInfo();
|
||||
return String.format("%.2f", Util.getDoubleValue(kqExitRulesComInfo.getProportion("1")));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取计算出差时长方式
|
||||
* 1-按工作日计算出差时长
|
||||
* 2-按自然日计算出差时长
|
||||
* 其他:无效数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getComputingMode() {
|
||||
KQExitRulesComInfo kqExitRulesComInfo = new KQExitRulesComInfo();
|
||||
return kqExitRulesComInfo.getComputingMode("1");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取日折算时长
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getHoursToDay() {
|
||||
int minimumUnit = -1;//最小出差单位
|
||||
int computingMode = -1;//计算出差时长方式
|
||||
double hoursToDay = -1;//日折算时长
|
||||
KQExitRulesComInfo kqExitRulesComInfo = new KQExitRulesComInfo();
|
||||
minimumUnit = Util.getIntValue(kqExitRulesComInfo.getMinimumUnit("1"), -1);
|
||||
computingMode = Util.getIntValue(kqExitRulesComInfo.getComputingMode("1"), -1);
|
||||
hoursToDay = Util.getDoubleValue(kqExitRulesComInfo.getHoursToDay("1"), -1);
|
||||
return String.valueOf(hoursToDay);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取半天显示类型,是时间还是下拉框
|
||||
* 半天单位 时间选择方式:1-下拉框选择 、2-具体时间
|
||||
* @return
|
||||
*/
|
||||
public static String getTimeselection() {
|
||||
KQExitRulesComInfo kqExitRulesComInfo = new KQExitRulesComInfo();
|
||||
String timeSelection = kqExitRulesComInfo.getTimeSelection("1");
|
||||
if("1".equalsIgnoreCase(timeSelection) || "2".equalsIgnoreCase(timeSelection)){
|
||||
return timeSelection;
|
||||
}else{
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import weaver.cache.CacheBase;
|
||||
import weaver.cache.CacheColumn;
|
||||
import weaver.cache.CacheColumnType;
|
||||
import weaver.cache.PKColumn;
|
||||
|
||||
/**
|
||||
* 公出规则缓存类
|
||||
*/
|
||||
public class KQExitRulesComInfo extends CacheBase {
|
||||
|
||||
/**
|
||||
* 数据来源
|
||||
*/
|
||||
protected static String TABLE_NAME = "kq_ExitRules";
|
||||
/**
|
||||
* sql中的where信息,不要以where开始
|
||||
*/
|
||||
protected static String TABLE_WHERE = " (isDelete is null or isDelete<>1) ";
|
||||
/**
|
||||
* sql中的order by信息,不要以order by开始
|
||||
*/
|
||||
protected static String TABLE_ORDER = "id";
|
||||
|
||||
/** 主键ID */
|
||||
@PKColumn(type = CacheColumnType.NUMBER)
|
||||
protected static String PK_NAME = "id";
|
||||
|
||||
/**
|
||||
* 获取最小公出单位
|
||||
* 1-按天公出
|
||||
* 2-按半天公出
|
||||
* 3-按小时公出
|
||||
* 4-按整天公出
|
||||
* 其他:无效数据
|
||||
*/
|
||||
@CacheColumn(name = "minimumUnit")
|
||||
protected static int minimumUnit;
|
||||
|
||||
/**
|
||||
* 获取换算比例
|
||||
* 当公出单位由天、半天、整天切换成小时或者由小时切换成天、半天、整天时,历史数据会按照此换算比例自动进行换算
|
||||
*/
|
||||
@CacheColumn(name = "proportion")
|
||||
protected static int proportion;
|
||||
|
||||
/**
|
||||
* 获取计算公出时长方式
|
||||
* 1-按工作日计算公出时长
|
||||
* 2-按自然日计算公出时长
|
||||
* 其他:无效数据
|
||||
*/
|
||||
@CacheColumn(name = "computingMode")
|
||||
protected static int computingMode;
|
||||
|
||||
/**
|
||||
* 获取日折算时长
|
||||
* 只有当按天公出、按半天公出、按整天公出并且按照自然日计算公出时长的时候才有效
|
||||
* -1:无效数据
|
||||
*/
|
||||
@CacheColumn(name = "hoursToDay")
|
||||
protected static int hoursToDay;
|
||||
|
||||
/**
|
||||
* 半天单位 时间选择方式:1-下拉框选择 、2-具体时间
|
||||
*/
|
||||
@CacheColumn(name = "timeselection")
|
||||
protected static int timeselection;
|
||||
|
||||
public String getId() {
|
||||
return (String) getRowValue(PK_INDEX);
|
||||
}
|
||||
|
||||
public String getMinimumUnit() {
|
||||
return (String) getRowValue(minimumUnit);
|
||||
}
|
||||
|
||||
public String getMinimumUnit(String key) {
|
||||
return (String) getValue(minimumUnit, key);
|
||||
}
|
||||
|
||||
public String getProportion() {
|
||||
return (String) getRowValue(proportion);
|
||||
}
|
||||
|
||||
public String getProportion(String key) {
|
||||
return (String) getValue(proportion, key);
|
||||
}
|
||||
|
||||
public String getComputingMode() {
|
||||
return (String) getRowValue(computingMode);
|
||||
}
|
||||
|
||||
public String getComputingMode(String key) {
|
||||
return (String) getValue(computingMode, key);
|
||||
}
|
||||
|
||||
public String getHoursToDay() {
|
||||
return (String) getRowValue(hoursToDay);
|
||||
}
|
||||
|
||||
public String getHoursToDay(String key) {
|
||||
return (String) getValue(hoursToDay, key);
|
||||
}
|
||||
|
||||
public String getTimeSelection() {
|
||||
String value = (String) getRowValue(timeselection);
|
||||
if (value == null || value.equals("")) {
|
||||
value = "1";
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getTimeSelection(String key) {
|
||||
String value = (String) getValue(timeselection, key);
|
||||
if (value == null || value.equals("")) {
|
||||
value = "1";
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import java.io.Writer;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import weaver.conn.ConnStatement;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.common.DbFunctionUtil;
|
||||
|
||||
/**
|
||||
* 考勤流程action日志记录
|
||||
* 从流程action的触发到使用到最后进入表
|
||||
*/
|
||||
public class KQFLowEventLogBiz {
|
||||
|
||||
/**
|
||||
* 记录一下流程开始日期结束日期的
|
||||
* @param resourceid
|
||||
* @param eventLogMap
|
||||
* @param eventType
|
||||
* @return
|
||||
*/
|
||||
public String logEvent(String resourceid, Map<String, Object> eventLogMap, String eventType) {
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String event_info = "";
|
||||
if(eventLogMap != null){
|
||||
event_info = JSON.toJSONString(eventLogMap,SerializerFeature.DisableCheckSpecialChar,SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
boolean isok = false;
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&& Util.null2String(rs.getOrgindbtype()).equals("oracle")){
|
||||
String sql = "insert into kq_flow_log(resourceid,createdatetime,event_info,uuid,flowtype) "
|
||||
+ " values('"+resourceid+"',"+ DbFunctionUtil.getCurrentFullTimeFunction(rs.getDBType())+",empty_clob(),'"+uuid+"','"+eventType+"') ";
|
||||
isok = rs.executeUpdate(sql);
|
||||
}else{
|
||||
String sql = "insert into kq_flow_log(resourceid,createdatetime,event_info,uuid,flowtype) "
|
||||
+ " values('"+resourceid+"',"+DbFunctionUtil.getCurrentFullTimeFunction(rs.getDBType())+",?,'"+uuid+"','"+eventType+"') ";
|
||||
rs.executeUpdate(sql,event_info);
|
||||
}
|
||||
if(isok && rs.getDBType().equalsIgnoreCase("oracle")&& Util.null2String(rs.getOrgindbtype()).equals("oracle")){
|
||||
ConnStatement stat=null;
|
||||
try {
|
||||
stat = new ConnStatement();
|
||||
// 需要使用for update方法来进行更新,
|
||||
// 但是,特别需要注意,如果原来CLOB字段有值,需要使用empty_clob()将其清空。
|
||||
// 如果原来是null,也不能更新,必须是empty_clob()返回的结果。
|
||||
stat.setStatementSql("select event_info from kq_flow_log where uuid=? for update", false);
|
||||
stat.setString(1,uuid);
|
||||
stat.executeQuery();
|
||||
if (stat.next()) {
|
||||
oracle.sql.CLOB clob = (oracle.sql.CLOB) stat.getClob("event_info");
|
||||
Writer outStream = clob.getCharacterOutputStream();
|
||||
char[] c = event_info.toCharArray();
|
||||
outStream.write(c, 0, c.length);
|
||||
outStream.flush();
|
||||
outStream.close();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (stat != null) {
|
||||
stat.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
return uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细表里记录一下班次和考勤组信息
|
||||
* @param resourceid
|
||||
* @param workTimeEntityLogMap
|
||||
* @param main_uuid
|
||||
* @param worktimeType
|
||||
* @return
|
||||
*/
|
||||
public String logDetailWorkTimeEntity(String resourceid, Map<String, Object> workTimeEntityLogMap,
|
||||
String main_uuid,String worktimeType) {
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String serial_info = "";
|
||||
if(workTimeEntityLogMap != null){
|
||||
serial_info = JSON.toJSONString(workTimeEntityLogMap,SerializerFeature.DisableCheckSpecialChar,SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
boolean isok = false;
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&& Util.null2String(rs.getOrgindbtype()).equals("oracle")){
|
||||
String sql = "insert into kq_flow_log_detail(resourceid,createdatetime,serial_info,flow_info,event_info,uuid,flowtype,main_uuid) "
|
||||
+ " values("+resourceid+","+ DbFunctionUtil.getCurrentFullTimeFunction(rs.getDBType())+",empty_clob(),empty_clob(),empty_clob(),'"+uuid+"','"+worktimeType+"','"+main_uuid+"') ";
|
||||
isok = rs.executeUpdate(sql);
|
||||
}else{
|
||||
String sql = "insert into kq_flow_log_detail(resourceid,createdatetime,serial_info,uuid,flowtype,main_uuid) "
|
||||
+ " values("+resourceid+","+DbFunctionUtil.getCurrentFullTimeFunction(rs.getDBType())+",?,'"+uuid+"','"+worktimeType+"','"+main_uuid+"') ";
|
||||
rs.executeUpdate(sql,serial_info);
|
||||
}
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&& Util.null2String(rs.getOrgindbtype()).equals("oracle")){
|
||||
ConnStatement stat=null;
|
||||
try {
|
||||
stat = new ConnStatement();
|
||||
// 需要使用for update方法来进行更新,
|
||||
// 但是,特别需要注意,如果原来CLOB字段有值,需要使用empty_clob()将其清空。
|
||||
// 如果原来是null,也不能更新,必须是empty_clob()返回的结果。
|
||||
stat.setStatementSql("select serial_info from kq_flow_log_detail where uuid=? for update", false);
|
||||
stat.setString(1,uuid);
|
||||
stat.executeQuery();
|
||||
if (stat.next()) {
|
||||
oracle.sql.CLOB clob = (oracle.sql.CLOB) stat.getClob("serial_info");
|
||||
Writer outStream = clob.getCharacterOutputStream();
|
||||
char[] c = serial_info.toCharArray();
|
||||
outStream.write(c, 0, c.length);
|
||||
outStream.flush();
|
||||
outStream.close();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (stat != null) {
|
||||
stat.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录一下加班生成明细
|
||||
* @param resourceid
|
||||
* @param overtimeLogMap
|
||||
* @param uuid
|
||||
*/
|
||||
public void logDetailFlowMap(String resourceid, Map<String, Object> overtimeLogMap,String uuid) {
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String flow_info = "";
|
||||
if(overtimeLogMap != null){
|
||||
flow_info = JSON.toJSONString(overtimeLogMap, SerializerFeature.DisableCheckSpecialChar,SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&rs.getOrgindbtype().equalsIgnoreCase("oracle")){
|
||||
ConnStatement stat=null;
|
||||
try {
|
||||
stat = new ConnStatement();
|
||||
// 需要使用for update方法来进行更新,
|
||||
// 但是,特别需要注意,如果原来CLOB字段有值,需要使用empty_clob()将其清空。
|
||||
// 如果原来是null,也不能更新,必须是empty_clob()返回的结果。
|
||||
stat.setStatementSql("select flow_info from kq_overtime_log_detail where uuid=? for update", false);
|
||||
stat.setString(1,uuid);
|
||||
stat.executeQuery();
|
||||
if (stat.next()) {
|
||||
oracle.sql.CLOB clob = (oracle.sql.CLOB) stat.getClob("flow_info");
|
||||
Writer outStream = clob.getCharacterOutputStream();
|
||||
char[] c = flow_info.toCharArray();
|
||||
outStream.write(c, 0, c.length);
|
||||
outStream.flush();
|
||||
outStream.close();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (stat != null) {
|
||||
stat.close();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
String sql = "update kq_overtime_log_detail set flow_info='"+flow_info+"' where uuid='"+uuid+"'";
|
||||
rs.executeUpdate(sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录对应的加班生成过程中使用的表sql和表数据
|
||||
* @param resourceid
|
||||
* @param eventLogMap
|
||||
* @param uuid
|
||||
* @param overtimetype
|
||||
*/
|
||||
public void logDetailEvent(String resourceid, Map<String, Object> eventLogMap, String uuid, String overtimetype) {
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String event_info = "";
|
||||
if(eventLogMap != null){
|
||||
event_info = JSON.toJSONString(eventLogMap,SerializerFeature.DisableCheckSpecialChar,SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&rs.getOrgindbtype().equalsIgnoreCase("oracle")){
|
||||
ConnStatement stat=null;
|
||||
try {
|
||||
stat = new ConnStatement();
|
||||
// 需要使用for update方法来进行更新,
|
||||
// 但是,特别需要注意,如果原来CLOB字段有值,需要使用empty_clob()将其清空。
|
||||
// 如果原来是null,也不能更新,必须是empty_clob()返回的结果。
|
||||
stat.setStatementSql("select event_info from kq_flow_log_detail where uuid=? for update", false);
|
||||
stat.setString(1,uuid);
|
||||
stat.executeQuery();
|
||||
if (stat.next()) {
|
||||
oracle.sql.CLOB clob = (oracle.sql.CLOB) stat.getClob("event_info");
|
||||
Writer outStream = clob.getCharacterOutputStream();
|
||||
char[] c = event_info.toCharArray();
|
||||
outStream.write(c, 0, c.length);
|
||||
outStream.flush();
|
||||
outStream.close();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (stat != null) {
|
||||
stat.close();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
String sql = "update kq_overtime_log_detail set event_info='"+event_info+"' where uuid='"+uuid+"'";
|
||||
rs.executeUpdate(sql);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.engine.kq.log.KQLog;
|
||||
import java.util.List;
|
||||
import weaver.cache.*;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
|
||||
/**
|
||||
* 报表自定义字段
|
||||
*/
|
||||
public class KQFixedSchedulceComInfo extends CacheBase {
|
||||
protected static String TABLE_NAME = "kq_fixedschedulce";
|
||||
/**
|
||||
* sql中的where信息,不要以where开始
|
||||
*/
|
||||
protected static String TABLE_WHERE = null;
|
||||
/**
|
||||
* sql中的order by信息,不要以order by开始
|
||||
*/
|
||||
protected static String TABLE_ORDER = "id";
|
||||
|
||||
@PKColumn(type = CacheColumnType.NUMBER)
|
||||
protected static String PK_NAME = "id";
|
||||
|
||||
@CacheColumn(name = "weekday")
|
||||
protected static int weekday;
|
||||
|
||||
@CacheColumn(name = "serialid")
|
||||
protected static int serialid;
|
||||
|
||||
@CacheColumn(name = "groupid")
|
||||
protected static int groupid;
|
||||
|
||||
// 需要关注:虚拟列,默认不是虚拟列
|
||||
@CacheColumn(isVirtual = true)
|
||||
protected static int virtualKey;
|
||||
|
||||
private boolean isFormat = false;
|
||||
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
protected boolean autoInitIfNotFound() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CacheMap initCache() throws Exception {
|
||||
CacheMap localData = super.initCache();
|
||||
try {
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = " ";
|
||||
if ("mysql".equals(rs.getDBType())) {
|
||||
sql += " select CONCAT(groupid,'_',weekday) as id, serialid from kq_fixedschedulce ";
|
||||
} else if("sqlserver".equals(rs.getDBType())){
|
||||
sql += " select CONVERT(varchar,groupid)+'_'+CONVERT(varchar,weekday) as id, serialid from kq_fixedschedulce ";
|
||||
}else {
|
||||
sql = " select groupid || '_'|| weekday as id, serialid from kq_fixedschedulce ";
|
||||
}
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString(PK_NAME));
|
||||
CacheItem row = createCacheItem();
|
||||
parseResultSetToCacheItem(rs, row);
|
||||
modifyCacheItem(id, row);
|
||||
localData.put(id, row);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
return localData;
|
||||
}
|
||||
|
||||
public String getId(){
|
||||
return (String)getRowValue(PK_INDEX);
|
||||
}
|
||||
|
||||
public String getSerialid() {
|
||||
return (String) getRowValue(serialid);
|
||||
}
|
||||
|
||||
public String getSerialid(String groupid, int weekday) {
|
||||
|
||||
if(!this.isFormat){
|
||||
String key = groupid + "_" + weekday;
|
||||
return (String) getValue(serialid, key);
|
||||
}
|
||||
return getSerialidBySql(groupid,weekday);
|
||||
}
|
||||
|
||||
private String getSerialidBySql(String groupid, int weekday) {
|
||||
String sql_serialid = "";
|
||||
try {
|
||||
String key = groupid + "_" + weekday;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = " ";
|
||||
if ("mysql".equals(rs.getDBType())) {
|
||||
sql += " select CONCAT(groupid,'_',weekday) as id, serialid from kq_fixedschedulce where CONCAT(groupid,'_',weekday)=? ";
|
||||
} else if("sqlserver".equals(rs.getDBType())){
|
||||
sql += " select CONVERT(varchar,groupid)+'_'+CONVERT(varchar,weekday) as id, serialid from kq_fixedschedulce where CONVERT(varchar,groupid)+'_'+CONVERT(varchar,weekday)=? ";
|
||||
}else {
|
||||
sql = " select groupid || '_'|| weekday as id, serialid from kq_fixedschedulce where groupid || '_'|| weekday=? ";
|
||||
}
|
||||
rs.executeQuery(sql,key);
|
||||
if (rs.next()) {
|
||||
sql_serialid = rs.getString("serialid");
|
||||
}
|
||||
kqLog.writeLog("KQFixedSchedulceComInfo getSerialidBySql :sql:"+sql+":sql_serialid:"+sql_serialid);
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
return sql_serialid;
|
||||
}
|
||||
|
||||
public boolean isFormat() {
|
||||
return isFormat;
|
||||
}
|
||||
|
||||
public void setFormat(boolean format) {
|
||||
isFormat = format;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,849 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.engine.kq.enums.FlowReportTypeEnum;
|
||||
import com.engine.kq.enums.KqSplitFlowTypeEnum;
|
||||
import com.engine.kq.wfset.bean.SplitBean;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
|
||||
/**
|
||||
* 考勤流程数据 相关类
|
||||
*/
|
||||
public class KQFlowDataBiz {
|
||||
|
||||
private String resourceid;
|
||||
private String fromDate;
|
||||
private String toDate;
|
||||
private String fromTime;
|
||||
private String toTime;
|
||||
private String belongDate;
|
||||
private String newLeaveType;
|
||||
private String orderby_sql;
|
||||
|
||||
public KQFlowDataBiz(FlowDataParamBuilder build){
|
||||
this.resourceid = build.resourceid;
|
||||
this.fromDate = build.fromDate;
|
||||
this.toDate = build.toDate;
|
||||
this.fromTime = build.fromTime;
|
||||
this.toTime = build.toTime;
|
||||
this.belongDate = build.belongDate;
|
||||
this.newLeaveType = build.newLeaveType;
|
||||
this.orderby_sql = build.orderby_sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的考勤数据
|
||||
* 请假,出差,公出,加班的
|
||||
* @param flowMaps
|
||||
* @param isAll true的时候也返回加班的,false的时候不返回加班的,只返回可以抵扣异常的
|
||||
* @return
|
||||
*/
|
||||
public List<SplitBean> getAllFlowData(Map<String,Object> flowMaps,boolean isAll){
|
||||
List<SplitBean> allSplitBeans = new ArrayList<>();
|
||||
|
||||
Map<String,String> flowDeductCard = getFlowDeductCard();
|
||||
|
||||
|
||||
allSplitBeans.addAll(getEvectionData(flowMaps,flowDeductCard));
|
||||
allSplitBeans.addAll(getOutData(flowMaps,flowDeductCard));
|
||||
allSplitBeans.addAll(getLeaveData(flowMaps,flowDeductCard));
|
||||
if(isAll){
|
||||
allSplitBeans.addAll(getOverTimeData(flowMaps));
|
||||
}
|
||||
allSplitBeans.addAll(getOtherData(flowMaps));
|
||||
|
||||
return allSplitBeans;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程抵扣考勤
|
||||
*/
|
||||
public Map<String,String> getFlowDeductCard() {
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs1 = new RecordSet();
|
||||
Map<String,String> flowDeductCard = new HashMap<>();
|
||||
|
||||
String flowDeductCardSql = "select * from kq_flow_deduct_card t where 1=1 and (isclear is null or isclear<>1) ";
|
||||
String sqlWhere = sqlFlowCardParamWhere();
|
||||
if(sqlWhere.length() > 0){
|
||||
flowDeductCardSql += sqlWhere;
|
||||
}
|
||||
rs.execute(flowDeductCardSql);
|
||||
while(rs.next()){
|
||||
String requestId= rs.getString("requestId");
|
||||
String resourceid= rs.getString("resourceid");
|
||||
String signtype= rs.getString("signtype");
|
||||
String serialnumber= rs.getString("serialnumber");
|
||||
String flowtype= rs.getString("flowtype");
|
||||
String key = requestId+"_"+resourceid+"_"+flowtype;
|
||||
String serial_signtype = serialnumber+"_"+signtype;
|
||||
if(flowDeductCard.containsKey(key)){
|
||||
String tmpSignType = Util.null2String(flowDeductCard.get(key));
|
||||
flowDeductCard.put(key, tmpSignType+","+serial_signtype);
|
||||
}else{
|
||||
flowDeductCard.put(key, serial_signtype);
|
||||
}
|
||||
}
|
||||
return flowDeductCard;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请假相关的数据
|
||||
*/
|
||||
public List<SplitBean> getLeaveData(Map<String, Object> flowMaps,
|
||||
Map<String, String> flowDeductCard){
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs1 = new RecordSet();
|
||||
|
||||
String tablename = "select a.* from "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" a left join workflow_requestbase b on a.requestid = b.requestid where b.requestid > 0 ";
|
||||
String sqlWhere = sqlParamWhere();
|
||||
if(sqlWhere.length() > 0){
|
||||
tablename += sqlWhere;
|
||||
}
|
||||
String leaveSql = "select * from ("+tablename+") t where 1=1 and (status is null or status <> '1') ";
|
||||
|
||||
if(sqlWhere.length() > 0){
|
||||
leaveSql += sqlWhere;
|
||||
}
|
||||
List<SplitBean> splitBeans = new ArrayList<>();
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
|
||||
int[] initArrays = kqTimesArrayComInfo.getInitArr();
|
||||
|
||||
rs.execute(leaveSql);
|
||||
while(rs.next()){
|
||||
SplitBean splitBean = new SplitBean();
|
||||
String requestId= rs.getString("requestId");
|
||||
String resourceid= rs.getString("resourceid");
|
||||
String fromdate= rs.getString("fromdate");
|
||||
String belongdate= rs.getString("belongdate");
|
||||
String fromtime= rs.getString("fromtime");
|
||||
String todate= rs.getString("todate");
|
||||
String totime= rs.getString("totime");
|
||||
String newleavetype= rs.getString("newleavetype");
|
||||
String duration= rs.getString("duration");
|
||||
String durationrule= rs.getString("durationrule");
|
||||
String leavebackrequestid= Util.null2String(rs.getString("leavebackrequestid"));
|
||||
|
||||
String fromtimedb= rs.getString("fromtimedb");
|
||||
String totimedb= rs.getString("totimedb");
|
||||
String repeatType = Util.null2String(rs.getString("repeat_type"));
|
||||
String repeatLate = Util.null2String(rs.getString("repeat_late"));
|
||||
String repeatEarly = Util.null2String(rs.getString("repeat_early"));
|
||||
|
||||
if(Util.getDoubleValue(duration) <= 0){
|
||||
if(repeatType.length() > 0){
|
||||
//哺乳假的不需要时长
|
||||
}else{
|
||||
// continue;
|
||||
}
|
||||
}
|
||||
//计算规则 1-按天请假 2-按半天请假 3-按小时请假 4-按整天请假
|
||||
String unitType = "4".equalsIgnoreCase(durationrule)?"1":"2";
|
||||
String card_key = requestId+"_"+resourceid+"_"+KqSplitFlowTypeEnum.LEAVE.getFlowtype();
|
||||
String serial_signtype = "";
|
||||
String serial = "";
|
||||
String signtype = "";
|
||||
if(!flowDeductCard.isEmpty() && flowDeductCard.containsKey(card_key)){
|
||||
serial_signtype = Util.null2String(flowDeductCard.get(card_key));
|
||||
if(serial_signtype.split("_") != null && serial_signtype.split("_").length == 2){
|
||||
serial = serial_signtype.split("_")[0];
|
||||
signtype = serial_signtype.split("_")[1];
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,String> infoMap = new HashMap<>();
|
||||
infoMap.put("requestId", requestId);
|
||||
infoMap.put(newleavetype, duration);
|
||||
infoMap.put("begintime", fromtime);
|
||||
infoMap.put("endtime", totime);
|
||||
infoMap.put("unitType", unitType);
|
||||
infoMap.put("durationrule", durationrule);
|
||||
if("2".equals(durationrule) && Util.getDoubleValue(duration)<1){
|
||||
infoMap.put("ishalf", "true");
|
||||
}else{
|
||||
infoMap.put("ishalf", "false");
|
||||
}
|
||||
infoMap.put("flowtype", FlowReportTypeEnum.LEAVE.getFlowType());
|
||||
infoMap.put("newleavetype", newleavetype);
|
||||
infoMap.put("signtype", signtype);
|
||||
infoMap.put("serial", serial);
|
||||
infoMap.put("fromtimedb", fromtimedb);
|
||||
infoMap.put("totimedb", totimedb);
|
||||
infoMap.put("repeatType", repeatType);
|
||||
infoMap.put("repeatLate", repeatLate);
|
||||
infoMap.put("repeatEarly", repeatEarly);
|
||||
|
||||
String key = resourceid+"|"+belongdate;
|
||||
String keyRepeat = resourceid+"|"+belongdate+"|repeat";
|
||||
if(flowMaps != null){
|
||||
if(flowMaps.get(key) != null){
|
||||
if(leavebackrequestid.length() > 0 && leavebackrequestid.startsWith(",")){
|
||||
initArrays = kqTimesArrayComInfo.getInitArr();
|
||||
int fromTimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(fromtime);
|
||||
int toTimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(totime);
|
||||
Arrays.fill(initArrays, fromTimeIndex, toTimeIndex+1, 1);
|
||||
leavebackrequestid = leavebackrequestid.substring(1);
|
||||
String backSql = "select * from "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" where "+Util.getSubINClause(leavebackrequestid, "requestid", "in")+" and fromdate= '"+fromdate+"'";
|
||||
rs1.executeQuery(backSql);
|
||||
|
||||
while (rs1.next()){
|
||||
String back_fromtime = rs1.getString("fromtime");
|
||||
String back_totime = rs1.getString("totime");
|
||||
if(repeatType.length() > 0){
|
||||
//如果是哺乳假似的重复校验,不需要考虑时间
|
||||
back_fromtime = fromtime;
|
||||
back_totime = totime;
|
||||
}
|
||||
String back_duration= rs.getString("duration");
|
||||
if(Util.getDoubleValue(back_duration) <= 0){
|
||||
// continue;
|
||||
}
|
||||
if(back_fromtime.equalsIgnoreCase(fromtime)){
|
||||
Arrays.fill(initArrays, kqTimesArrayComInfo.getArrayindexByTimes(back_fromtime), kqTimesArrayComInfo.getArrayindexByTimes(back_totime)+1, -1);
|
||||
}else{
|
||||
Arrays.fill(initArrays, kqTimesArrayComInfo.getArrayindexByTimes(back_fromtime)+1, kqTimesArrayComInfo.getArrayindexByTimes(back_totime)+1, -1);
|
||||
}
|
||||
}
|
||||
List<List<String>> backLists = new ArrayList<>();
|
||||
List<String> backList = new ArrayList<>();
|
||||
for(int i = fromTimeIndex ; i <= toTimeIndex ; i ++){
|
||||
if(initArrays[i] == 1){
|
||||
backList.add(kqTimesArrayComInfo.getTimesByArrayindex(i));
|
||||
}else{
|
||||
if(!backList.isEmpty()){
|
||||
backLists.add(backList);
|
||||
backList = new ArrayList<>();
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!backList.isEmpty()){
|
||||
backLists.add(backList);
|
||||
}
|
||||
if(backLists != null && !backLists.isEmpty()){
|
||||
List<Map<String,String>> time_list_tmp = (List<Map<String,String>>)flowMaps.get(key);
|
||||
for(int j = 0 ; j < backLists.size() ;j++){
|
||||
List<String> backListTmp = backLists.get(j);
|
||||
String back_tmp_fromtime = backListTmp.get(0);
|
||||
String back_tmp_totime = backListTmp.get(backListTmp.size()-1);
|
||||
infoMap = new HashMap<>();
|
||||
infoMap.put("requestId", requestId);
|
||||
infoMap.put(newleavetype, duration);
|
||||
infoMap.put("begintime", back_tmp_fromtime);
|
||||
infoMap.put("endtime", back_tmp_totime);
|
||||
infoMap.put("unitType", unitType);
|
||||
infoMap.put("durationrule", durationrule);
|
||||
if("2".equals(durationrule)){
|
||||
infoMap.put("ishalf", "true");
|
||||
}
|
||||
infoMap.put("flowtype", FlowReportTypeEnum.LEAVE.getFlowType());
|
||||
infoMap.put("newleavetype", newleavetype);
|
||||
infoMap.put("repeatType", repeatType);
|
||||
infoMap.put("repeatLate", repeatLate);
|
||||
infoMap.put("repeatEarly", repeatEarly);
|
||||
time_list_tmp.add(infoMap);
|
||||
}
|
||||
if(repeatType.length() > 0) {
|
||||
if (flowMaps.containsKey(keyRepeat)) {
|
||||
List<Map<String,String>> time_list_tmp1 = (List<Map<String,String>>)flowMaps.get(keyRepeat);
|
||||
time_list_tmp1.add(infoMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
List<Map<String,String>> time_list_tmp = (List<Map<String,String>>)flowMaps.get(key);
|
||||
time_list_tmp.add(infoMap);
|
||||
}
|
||||
}else{
|
||||
if(leavebackrequestid.length() > 0 && leavebackrequestid.startsWith(",")){
|
||||
initArrays = kqTimesArrayComInfo.getInitArr();
|
||||
int fromTimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(fromtime);
|
||||
int toTimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(totime);
|
||||
Arrays.fill(initArrays, fromTimeIndex, toTimeIndex+1, 1);
|
||||
leavebackrequestid = leavebackrequestid.substring(1);
|
||||
String backSql = "select * from "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" where "+Util.getSubINClause(leavebackrequestid, "requestid", "in")+" and fromdate= '"+fromdate+"'";
|
||||
rs1.executeQuery(backSql);
|
||||
|
||||
while (rs1.next()){
|
||||
String back_fromtime = rs1.getString("fromtime");
|
||||
String back_totime = rs1.getString("totime");
|
||||
if(repeatType.length() > 0){
|
||||
//如果是哺乳假似的重复校验,不需要考虑时间
|
||||
back_fromtime = fromtime;
|
||||
back_totime = totime;
|
||||
}
|
||||
if(back_fromtime.equalsIgnoreCase(fromtime)){
|
||||
Arrays.fill(initArrays, kqTimesArrayComInfo.getArrayindexByTimes(back_fromtime), kqTimesArrayComInfo.getArrayindexByTimes(back_totime)+1, -1);
|
||||
}else{
|
||||
if(back_fromtime.compareTo(back_totime) < 0){
|
||||
Arrays.fill(initArrays, kqTimesArrayComInfo.getArrayindexByTimes(back_fromtime)+1, kqTimesArrayComInfo.getArrayindexByTimes(back_totime)+1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<List<String>> backLists = new ArrayList<>();
|
||||
List<String> backList = new ArrayList<>();
|
||||
for(int i = fromTimeIndex ; i <= toTimeIndex ; i ++){
|
||||
if(initArrays[i] == 1){
|
||||
backList.add(kqTimesArrayComInfo.getTimesByArrayindex(i));
|
||||
}else{
|
||||
if(!backList.isEmpty()){
|
||||
backLists.add(backList);
|
||||
backList = new ArrayList<>();
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!backList.isEmpty()){
|
||||
backLists.add(backList);
|
||||
}
|
||||
if(backLists != null && !backLists.isEmpty()){
|
||||
List<Map<String,String>> time_list = new ArrayList<>();
|
||||
for(int j = 0 ; j < backLists.size() ;j++){
|
||||
List<String> backListTmp = backLists.get(j);
|
||||
String back_tmp_fromtime = backListTmp.get(0);
|
||||
String back_tmp_totime = backListTmp.get(backListTmp.size()-1);
|
||||
infoMap = new HashMap<>();
|
||||
infoMap.put("requestId", requestId);
|
||||
infoMap.put(newleavetype, duration);
|
||||
infoMap.put("begintime", back_tmp_fromtime);
|
||||
infoMap.put("endtime", back_tmp_totime);
|
||||
infoMap.put("unitType", unitType);
|
||||
infoMap.put("durationrule", durationrule);
|
||||
if("2".equals(durationrule)){
|
||||
infoMap.put("ishalf", "true");
|
||||
}
|
||||
infoMap.put("flowtype", FlowReportTypeEnum.LEAVE.getFlowType());
|
||||
infoMap.put("newleavetype", newleavetype);
|
||||
infoMap.put("repeatType", repeatType);
|
||||
infoMap.put("repeatLate", repeatLate);
|
||||
infoMap.put("repeatEarly", repeatEarly);
|
||||
time_list.add(infoMap);
|
||||
}
|
||||
flowMaps.put(key, time_list);
|
||||
if(repeatType.length() > 0){
|
||||
//单独存一份哺乳假的重复校验
|
||||
flowMaps.put(keyRepeat, time_list);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
List<Map<String,String>> time_list = new ArrayList<>();
|
||||
time_list.add(infoMap);
|
||||
flowMaps.put(key, time_list);
|
||||
if(repeatType.length() > 0){
|
||||
//单独存一份哺乳假的重复校验
|
||||
flowMaps.put(keyRepeat, time_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return splitBeans;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取出差相关的数据
|
||||
*/
|
||||
public List<SplitBean> getEvectionData(Map<String, Object> flowMaps,
|
||||
Map<String, String> flowDeductCard){
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
String tablename = "select a.* from "+KqSplitFlowTypeEnum.EVECTION.getTablename()+" a left join workflow_requestbase b on a.requestid = b.requestid where b.requestid > 0 ";
|
||||
String sqlWhere = sqlParamWhere();
|
||||
if(sqlWhere.length() > 0){
|
||||
tablename += sqlWhere;
|
||||
}
|
||||
String leaveSql = "select * from ("+tablename+") t where 1=1 and (status is null or status <> '1') ";
|
||||
|
||||
if(sqlWhere.length() > 0){
|
||||
leaveSql += sqlWhere;
|
||||
}
|
||||
|
||||
List<SplitBean> splitBeans = new ArrayList<>();
|
||||
rs.execute(leaveSql);
|
||||
while(rs.next()){
|
||||
SplitBean splitBean = new SplitBean();
|
||||
String requestId= rs.getString("requestId");
|
||||
String resourceid= rs.getString("resourceid");
|
||||
String fromdate= rs.getString("fromdate");
|
||||
String belongdate= rs.getString("belongdate");
|
||||
String fromtime= rs.getString("fromtime");
|
||||
String todate= rs.getString("todate");
|
||||
String totime= rs.getString("totime");
|
||||
String newleavetype= rs.getString("newleavetype");
|
||||
String duration= rs.getString("duration");
|
||||
String durationrule= rs.getString("durationrule");
|
||||
|
||||
splitBean.setRequestId(requestId);
|
||||
splitBean.setResourceId(resourceid);
|
||||
splitBean.setFromDate(fromdate);
|
||||
splitBean.setFromTime(fromtime);
|
||||
splitBean.setToDate(todate);
|
||||
splitBean.setToTime(totime);
|
||||
splitBean.setNewLeaveType(newleavetype);
|
||||
splitBean.setDuration(duration);
|
||||
splitBean.setDurationrule(durationrule);
|
||||
splitBeans.add(splitBean);
|
||||
|
||||
if(Util.getDoubleValue(duration) <= 0){
|
||||
// continue;
|
||||
}
|
||||
//计算规则 1-按天请假 2-按半天请假 3-按小时请假 4-按整天请假
|
||||
String unitType = "4".equalsIgnoreCase(durationrule)?"1":"2";
|
||||
String card_key = requestId+"_"+resourceid+"_"+KqSplitFlowTypeEnum.EVECTION.getFlowtype();
|
||||
String serial_signtype = "";
|
||||
String serial = "";
|
||||
String signtype = "";
|
||||
if(!flowDeductCard.isEmpty() && flowDeductCard.containsKey(card_key)){
|
||||
serial_signtype = Util.null2String(flowDeductCard.get(card_key));
|
||||
if(serial_signtype.split("_") != null && serial_signtype.split("_").length == 2){
|
||||
serial = serial_signtype.split("_")[0];
|
||||
signtype = serial_signtype.split("_")[1];
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,String> infoMap = new HashMap<>();
|
||||
infoMap.put(FlowReportTypeEnum.businessLeave.getFlowType(), duration);
|
||||
infoMap.put("requestId", requestId);
|
||||
infoMap.put("begintime", fromtime);
|
||||
infoMap.put("endtime", totime);
|
||||
infoMap.put("unitType", unitType);
|
||||
infoMap.put("durationrule", durationrule);
|
||||
if("2".equals(durationrule) && Util.getDoubleValue(duration)<1){
|
||||
infoMap.put("ishalf", "true");
|
||||
}else{
|
||||
infoMap.put("ishalf", "false");
|
||||
}
|
||||
infoMap.put("duration", duration);
|
||||
infoMap.put("flowtype", FlowReportTypeEnum.EVECTION.getFlowType());
|
||||
infoMap.put("signtype", signtype);
|
||||
infoMap.put("serial", serial);
|
||||
|
||||
String key = resourceid+"|"+belongdate;
|
||||
if(flowMaps != null){
|
||||
if(flowMaps.get(key) != null){
|
||||
List<Map<String,String>> time_list_tmp = (List<Map<String,String>>)flowMaps.get(key);
|
||||
time_list_tmp.add(infoMap);
|
||||
}else{
|
||||
List<Map<String,String>> time_list = new ArrayList<>();
|
||||
time_list.add(infoMap);
|
||||
flowMaps.put(key, time_list);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return splitBeans;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公出相关的数据
|
||||
*/
|
||||
public List<SplitBean> getOutData(Map<String, Object> flowMaps,
|
||||
Map<String, String> flowDeductCard){
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
String tablename = "select a.* from "+KqSplitFlowTypeEnum.OUT.getTablename()+" a left join workflow_requestbase b on a.requestid = b.requestid where b.requestid > 0 ";
|
||||
String sqlWhere = sqlParamWhere();
|
||||
if(sqlWhere.length() > 0){
|
||||
tablename += sqlWhere;
|
||||
}
|
||||
String leaveSql = "select * from ("+tablename+") t where 1=1 and (status is null or status <> '1') ";
|
||||
|
||||
if(sqlWhere.length() > 0){
|
||||
leaveSql += sqlWhere;
|
||||
}
|
||||
List<SplitBean> splitBeans = new ArrayList<>();
|
||||
rs.execute(leaveSql);
|
||||
while(rs.next()){
|
||||
SplitBean splitBean = new SplitBean();
|
||||
String requestId= rs.getString("requestId");
|
||||
String resourceid= rs.getString("resourceid");
|
||||
String fromdate= rs.getString("fromdate");
|
||||
String belongdate= rs.getString("belongdate");
|
||||
String fromtime= rs.getString("fromtime");
|
||||
String todate= rs.getString("todate");
|
||||
String totime= rs.getString("totime");
|
||||
String newleavetype= rs.getString("newleavetype");
|
||||
String duration= rs.getString("duration");
|
||||
String durationrule= rs.getString("durationrule");
|
||||
|
||||
splitBean.setRequestId(requestId);
|
||||
splitBean.setResourceId(resourceid);
|
||||
splitBean.setFromDate(fromdate);
|
||||
splitBean.setFromTime(fromtime);
|
||||
splitBean.setToDate(todate);
|
||||
splitBean.setToTime(totime);
|
||||
splitBean.setNewLeaveType(newleavetype);
|
||||
splitBean.setDuration(duration);
|
||||
splitBean.setDurationrule(durationrule);
|
||||
splitBeans.add(splitBean);
|
||||
|
||||
if(Util.getDoubleValue(duration) <= 0){
|
||||
// continue;
|
||||
}
|
||||
//计算规则 1-按天请假 2-按半天请假 3-按小时请假 4-按整天请假
|
||||
String unitType = "4".equalsIgnoreCase(durationrule)?"1":"2";
|
||||
String card_key = requestId+"_"+resourceid+"_"+KqSplitFlowTypeEnum.OUT.getFlowtype();
|
||||
String serial_signtype = "";
|
||||
String serial = "";
|
||||
String signtype = "";
|
||||
if(!flowDeductCard.isEmpty() && flowDeductCard.containsKey(card_key)){
|
||||
serial_signtype = Util.null2String(flowDeductCard.get(card_key));
|
||||
if(serial_signtype.split("_") != null && serial_signtype.split("_").length == 2){
|
||||
serial = serial_signtype.split("_")[0];
|
||||
signtype = serial_signtype.split("_")[1];
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,String> infoMap = new HashMap<>();
|
||||
infoMap.put(FlowReportTypeEnum.officialBusiness.getFlowType(), duration);
|
||||
infoMap.put("requestId", requestId);
|
||||
infoMap.put("begintime", fromtime);
|
||||
infoMap.put("endtime", totime);
|
||||
infoMap.put("unitType", unitType);
|
||||
infoMap.put("durationrule", durationrule);
|
||||
if("2".equals(durationrule) && Util.getDoubleValue(duration)<1){
|
||||
infoMap.put("ishalf", "true");
|
||||
}else{
|
||||
infoMap.put("ishalf", "false");
|
||||
}
|
||||
infoMap.put("duration", duration);
|
||||
infoMap.put("flowtype", FlowReportTypeEnum.OUT.getFlowType());
|
||||
infoMap.put("signtype", signtype);
|
||||
infoMap.put("serial", serial);
|
||||
|
||||
String key = resourceid+"|"+belongdate;
|
||||
if(flowMaps != null){
|
||||
if(flowMaps.get(key) != null){
|
||||
List<Map<String,String>> time_list_tmp = (List<Map<String,String>>)flowMaps.get(key);
|
||||
time_list_tmp.add(infoMap);
|
||||
}else{
|
||||
List<Map<String,String>> time_list = new ArrayList<>();
|
||||
time_list.add(infoMap);
|
||||
flowMaps.put(key, time_list);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return splitBeans;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取加班相关的数据
|
||||
*/
|
||||
public List<SplitBean> getOverTimeData(Map<String,Object> flowMaps){
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
String tablename = "select a.* from "+KqSplitFlowTypeEnum.OVERTIME.getTablename()+" a left join workflow_requestbase b on a.requestid = b.requestid where b.requestid > 0 ";
|
||||
String sqlWhere = sqlParamWhere();
|
||||
if(sqlWhere.length() > 0){
|
||||
tablename += sqlWhere;
|
||||
}
|
||||
String leaveSql = "select * from ("+tablename+") t where 1=1 ";
|
||||
|
||||
if(sqlWhere.length() > 0){
|
||||
leaveSql += sqlWhere;
|
||||
}
|
||||
List<SplitBean> splitBeans = new ArrayList<>();
|
||||
if(orderby_sql.length() > 0){
|
||||
leaveSql = leaveSql+orderby_sql;
|
||||
}
|
||||
rs.execute(leaveSql);
|
||||
while(rs.next()){
|
||||
SplitBean splitBean = new SplitBean();
|
||||
String dataid= rs.getString("dataid");
|
||||
String detailid= rs.getString("detailid");
|
||||
String requestId= rs.getString("requestId");
|
||||
String resourceid= rs.getString("resourceid");
|
||||
String fromdate= rs.getString("fromdate");
|
||||
String belongdate= rs.getString("belongdate");
|
||||
String fromtime= rs.getString("fromtime");
|
||||
String todate= rs.getString("todate");
|
||||
String totime= rs.getString("totime");
|
||||
String newleavetype= rs.getString("newleavetype");
|
||||
String duration= rs.getString("duration");
|
||||
String durationrule= rs.getString("durationrule");
|
||||
String changetype= rs.getString("changetype");
|
||||
String d_mins= rs.getString("d_mins");
|
||||
String overtime_type= rs.getString("overtime_type");
|
||||
|
||||
String fromdatedb= rs.getString("fromdatedb");
|
||||
String fromtimedb= rs.getString("fromtimedb");
|
||||
String todatedb= rs.getString("todatedb");
|
||||
String totimedb= rs.getString("totimedb");
|
||||
|
||||
splitBean.setDataId(dataid);
|
||||
splitBean.setDetailId(detailid);
|
||||
splitBean.setRequestId(requestId);
|
||||
splitBean.setResourceId(resourceid);
|
||||
splitBean.setFromDate(fromdate);
|
||||
splitBean.setFromTime(fromtime);
|
||||
splitBean.setToDate(todate);
|
||||
splitBean.setToTime(totime);
|
||||
splitBean.setNewLeaveType(newleavetype);
|
||||
splitBean.setDuration(duration);
|
||||
splitBean.setDurationrule(durationrule);
|
||||
splitBean.setChangeType(Util.getIntValue(changetype));
|
||||
splitBean.setD_Mins(Util.getDoubleValue(d_mins));
|
||||
splitBean.setOvertime_type(overtime_type);
|
||||
splitBean.setFromdatedb(fromdatedb);
|
||||
splitBean.setFromtimedb(fromtimedb);
|
||||
splitBean.setTodatedb(todatedb);
|
||||
splitBean.setTotimedb(totimedb);
|
||||
splitBeans.add(splitBean);
|
||||
|
||||
//计算规则 1-按天请假 2-按半天请假 3-按小时请假 4-按整天请假
|
||||
String unitType = "4".equalsIgnoreCase(durationrule)?"1":"2";
|
||||
unitType = "2".equalsIgnoreCase(durationrule)?"1":"2";
|
||||
|
||||
Map<String,String> infoMap = new HashMap<>();
|
||||
infoMap.put(FlowReportTypeEnum.businessLeave.getFlowType(), duration);
|
||||
infoMap.put("begintime", fromtime);
|
||||
infoMap.put("endtime", totime);
|
||||
infoMap.put("unitType", unitType);
|
||||
infoMap.put("duration", duration);
|
||||
infoMap.put("flowtype", FlowReportTypeEnum.OVERTIME.getFlowType());
|
||||
|
||||
String key = resourceid+"|"+belongdate;
|
||||
if(flowMaps != null){
|
||||
if(flowMaps.get(key) != null){
|
||||
List<Map<String,String>> time_list_tmp = (List<Map<String,String>>)flowMaps.get(key);
|
||||
time_list_tmp.add(infoMap);
|
||||
}else{
|
||||
List<Map<String,String>> time_list = new ArrayList<>();
|
||||
time_list.add(infoMap);
|
||||
flowMaps.put(key, time_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
return splitBeans;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取异常流程的数据
|
||||
*/
|
||||
public List<SplitBean> getOtherData(Map<String,Object> flowMaps){
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
String tablename = "select a.* from "+KqSplitFlowTypeEnum.OTHER.getTablename()+" a left join workflow_requestbase b on a.requestid = b.requestid where b.requestid > 0 ";
|
||||
String sqlWhere = sqlParamWhere();
|
||||
if(sqlWhere.length() > 0){
|
||||
tablename += sqlWhere;
|
||||
}
|
||||
String leaveSql = "select * from ("+tablename+") t where 1=1 ";
|
||||
|
||||
if(sqlWhere.length() > 0){
|
||||
leaveSql += sqlWhere;
|
||||
}
|
||||
List<SplitBean> splitBeans = new ArrayList<>();
|
||||
rs.execute(leaveSql);
|
||||
while(rs.next()){
|
||||
SplitBean splitBean = new SplitBean();
|
||||
String requestId= rs.getString("requestId");
|
||||
String resourceid= rs.getString("resourceid");
|
||||
String fromdate= rs.getString("fromdate");
|
||||
String belongdate= rs.getString("belongdate");
|
||||
String fromtime= rs.getString("fromtime");
|
||||
String todate= rs.getString("todate");
|
||||
String totime= rs.getString("totime");
|
||||
String newleavetype= rs.getString("newleavetype");
|
||||
String duration= rs.getString("duration");
|
||||
String durationrule= rs.getString("durationrule");
|
||||
|
||||
splitBean.setRequestId(requestId);
|
||||
splitBean.setResourceId(resourceid);
|
||||
splitBean.setFromDate(fromdate);
|
||||
splitBean.setFromTime(fromtime);
|
||||
splitBean.setToDate(todate);
|
||||
splitBean.setToTime(totime);
|
||||
splitBean.setNewLeaveType(newleavetype);
|
||||
splitBean.setDuration(duration);
|
||||
splitBean.setDurationrule(durationrule);
|
||||
splitBeans.add(splitBean);
|
||||
|
||||
//计算规则 1-按天请假 2-按半天请假 3-按小时请假 4-按整天请假
|
||||
String unitType = "4".equalsIgnoreCase(durationrule)?"1":"2";
|
||||
|
||||
Map<String,String> infoMap = new HashMap<>();
|
||||
infoMap.put(FlowReportTypeEnum.businessLeave.getFlowType(), duration);
|
||||
infoMap.put("begintime", fromtime);
|
||||
infoMap.put("endtime", totime);
|
||||
infoMap.put("unitType", unitType);
|
||||
|
||||
String key = resourceid+"|"+belongdate;
|
||||
if(flowMaps != null){
|
||||
if(flowMaps.get(key) != null){
|
||||
List<Map<String,String>> time_list_tmp = (List<Map<String,String>>)flowMaps.get(key);
|
||||
time_list_tmp.add(infoMap);
|
||||
}else{
|
||||
List<Map<String,String>> time_list = new ArrayList<>();
|
||||
time_list.add(infoMap);
|
||||
flowMaps.put(key, time_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
return splitBeans;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据请假类型判断是否被流程引用
|
||||
* @param ruleid
|
||||
* @return true表示被引用
|
||||
*/
|
||||
public static boolean leaveTypeUsed(String ruleid){
|
||||
KQFlowDataBiz kqFlowDataBiz = new KQFlowDataBiz.FlowDataParamBuilder().newLeaveTypeParam(ruleid).build();
|
||||
List<SplitBean> splitBeans = kqFlowDataBiz.getLeaveData(null, new HashMap<>());
|
||||
if(!splitBeans.isEmpty()){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成相应的查询条件
|
||||
* @return
|
||||
*/
|
||||
private String sqlParamWhere() {
|
||||
String sqlWhere = "";
|
||||
if(resourceid.length() > 0){
|
||||
sqlWhere += " and resourceid in ( "+resourceid+" )";
|
||||
}
|
||||
if(fromDate.length() > 0 && toDate.length() > 0){
|
||||
sqlWhere += " and ( fromdate between '"+fromDate+"' and '"+toDate+"' or todate between '"+fromDate+"' and '"+toDate+"' )";
|
||||
}else{
|
||||
if(fromDate.length() > 0){
|
||||
sqlWhere += " and fromdate between '"+fromDate+"' and '"+fromDate+"' ";
|
||||
}
|
||||
if(toDate.length() > 0){
|
||||
sqlWhere += " and todate between '"+toDate+"' and '"+toDate+"' ";
|
||||
}
|
||||
}
|
||||
if(belongDate.length() > 0){
|
||||
sqlWhere += " and belongdate = '"+belongDate+"' ";
|
||||
}
|
||||
if(fromTime.length() > 0){
|
||||
sqlWhere += " and fromtime >= '"+fromTime+"' ";
|
||||
}
|
||||
if(toTime.length() > 0){
|
||||
sqlWhere += " and totime <= '"+toTime+"' ";
|
||||
}
|
||||
if(newLeaveType.length() > 0){
|
||||
sqlWhere += " and newleavetype in ( "+newLeaveType+" )";
|
||||
}
|
||||
return sqlWhere;
|
||||
}
|
||||
|
||||
private String sqlFlowCardParamWhere() {
|
||||
String sqlWhere = "";
|
||||
if(resourceid.length() > 0){
|
||||
sqlWhere += " and resourceid in ( "+resourceid+" )";
|
||||
}
|
||||
if(fromDate.length() > 0 && toDate.length() > 0){
|
||||
sqlWhere += " and ( fromdate between '"+fromDate+"' and '"+toDate+"' or todate between '"+fromDate+"' and '"+toDate+"' )";
|
||||
}else{
|
||||
if(fromDate.length() > 0){
|
||||
sqlWhere += " and fromdate between '"+fromDate+"' and '"+fromDate+"' ";
|
||||
}
|
||||
if(toDate.length() > 0){
|
||||
sqlWhere += " and todate between '"+toDate+"' and '"+toDate+"' ";
|
||||
}
|
||||
}
|
||||
if(belongDate.length() > 0){
|
||||
sqlWhere += " and belongdate = '"+belongDate+"' ";
|
||||
}
|
||||
if(fromTime.length() > 0){
|
||||
sqlWhere += " and fromtime >= '"+fromTime+"' ";
|
||||
}
|
||||
if(toTime.length() > 0){
|
||||
sqlWhere += " and totime <= '"+toTime+"' ";
|
||||
}
|
||||
return sqlWhere;
|
||||
}
|
||||
|
||||
/**
|
||||
* 针对可能存在的多种参数类型 创建参数静态内部类Builder
|
||||
*/
|
||||
public static class FlowDataParamBuilder {
|
||||
|
||||
private String resourceid = "";
|
||||
private String fromDate = "";
|
||||
private String toDate = "";
|
||||
private String fromTime = "";
|
||||
private String toTime = "";
|
||||
private String belongDate = "";
|
||||
/**
|
||||
* 请假用的请假类型
|
||||
*/
|
||||
private String newLeaveType = "";
|
||||
private String orderby_sql = "";
|
||||
|
||||
public FlowDataParamBuilder() {
|
||||
this.resourceid = "";
|
||||
//初始化的时候需要把其他参数先清空下
|
||||
this.fromDate = "";
|
||||
this.toDate = "";
|
||||
this.fromTime = "";
|
||||
this.toTime = "";
|
||||
this.newLeaveType = "";
|
||||
this.belongDate = "";
|
||||
this.orderby_sql = "";
|
||||
}
|
||||
|
||||
//成员方法返回其自身,所以可以链式调用
|
||||
public KQFlowDataBiz.FlowDataParamBuilder resourceidParam(final String resourceid) {
|
||||
this.resourceid = resourceid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public KQFlowDataBiz.FlowDataParamBuilder fromDateParam(final String fromDate) {
|
||||
this.fromDate = fromDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public KQFlowDataBiz.FlowDataParamBuilder toDateParam(final String toDate) {
|
||||
this.toDate = toDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public KQFlowDataBiz.FlowDataParamBuilder fromTimeParam(final String fromTime) {
|
||||
this.fromTime = fromTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public KQFlowDataBiz.FlowDataParamBuilder toTimeParam(final String toTime) {
|
||||
this.toTime = toTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public KQFlowDataBiz.FlowDataParamBuilder newLeaveTypeParam(final String newLeaveType) {
|
||||
this.newLeaveType = newLeaveType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public KQFlowDataBiz.FlowDataParamBuilder belongDateParam(final String belongDate) {
|
||||
this.belongDate = belongDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public KQFlowDataBiz.FlowDataParamBuilder orderby_sqlParam(final String orderby_sql) {
|
||||
this.orderby_sql = orderby_sql;
|
||||
return this;
|
||||
}
|
||||
|
||||
//Builder的build方法,返回外部类的实例
|
||||
public KQFlowDataBiz build() {
|
||||
return new KQFlowDataBiz(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
public class KQFormat4ReportJob extends BaseCronJob{
|
||||
public void execute() {
|
||||
BaseBean bb = new BaseBean();
|
||||
try{
|
||||
bb.writeLog("begin do KQFormat4ReportJob invoke ...");
|
||||
String date = DateUtil.getCurrentDate();
|
||||
//初始化今天数据
|
||||
new KQFormatBiz().formatDateByKQDate(date);
|
||||
bb.writeLog("end do KQFormat4ReportJob invoke ...");
|
||||
}catch (Exception e) {
|
||||
bb.writeLog(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,371 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.engine.kq.entity.TimeScopeEntity;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.BatchRecordSet;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 考勤数据格式化
|
||||
*/
|
||||
public class KQFormatBiz extends BaseBean {
|
||||
private String today = DateUtil.getCurrentDate();
|
||||
protected KQLog kqLog = new KQLog();
|
||||
|
||||
/**
|
||||
* 考勤报表格式化-带批次
|
||||
*
|
||||
* @param lsFormatParams
|
||||
*/
|
||||
public void formatWithBatchId(List<List<Object>> lsFormatParams) {
|
||||
BatchRecordSet bRs = new BatchRecordSet();
|
||||
String sql = "";
|
||||
List<Object> params = null;
|
||||
try {
|
||||
if (KQSettingsBiz.getKqformatthread()) {
|
||||
sql = " insert into kq_format_pool (resourceid, kqdate,batchid) values (?,?,?)";
|
||||
if (KQSettingsBiz.getKqformatAccurate()){
|
||||
sql = " insert into kq_format_pool (resourceid, kqdate, exectime,batchid) values (?,?,?,?)";
|
||||
lsFormatParams = processFormatParams(lsFormatParams);
|
||||
}
|
||||
bRs.executeBatchSql(sql, lsFormatParams);
|
||||
} else {
|
||||
String resourceid = "";
|
||||
String kqdate = "";
|
||||
for (int i = 0; lsFormatParams != null && i < lsFormatParams.size(); i++) {
|
||||
params = lsFormatParams.get(i);
|
||||
resourceid = Util.null2String(params.get(0));
|
||||
kqdate = Util.null2String(params.get(1));
|
||||
new KQFormatData().formatKqDate(resourceid, kqdate);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog(" KQFormatData.formatKqDate lsFormatParams >>>>>>>>>" + e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 考勤报表格式化
|
||||
*
|
||||
* @param lsFormatParams
|
||||
*/
|
||||
public void format(List<List<Object>> lsFormatParams) {
|
||||
format(lsFormatParams, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 考勤报表格式化
|
||||
* @param lsFormatParams
|
||||
* @param formatType -1: 其他; 11:右键重新计算考勤数据; 12: 考勤自动和手动同步;13:钉钉同步或者导入; 14:云桥考勤同步 15: 考勤导入;16:排班更新
|
||||
*/
|
||||
public void format(List<List<Object>> lsFormatParams, int formatType) {
|
||||
BatchRecordSet bRs = new BatchRecordSet();
|
||||
String sql = "";
|
||||
List<Object> params = null;
|
||||
try {
|
||||
for(List<Object> list : lsFormatParams) {
|
||||
list.add(formatType);
|
||||
}
|
||||
if (KQSettingsBiz.getKqformatthread()) {
|
||||
sql = " insert into kq_format_pool (resourceid, kqdate, formattype) values (?,?,?)";
|
||||
if (KQSettingsBiz.getKqformatAccurate()){
|
||||
sql = " insert into kq_format_pool (resourceid, kqdate, exectime,formattype) values (?,?,?,?)";
|
||||
lsFormatParams = processFormatParams(lsFormatParams);
|
||||
}
|
||||
bRs.executeBatchSqlNew(sql, lsFormatParams);
|
||||
} else {
|
||||
String resourceid = "";
|
||||
String kqdate = "";
|
||||
for (int i = 0; lsFormatParams != null && i < lsFormatParams.size(); i++) {
|
||||
params = lsFormatParams.get(i);
|
||||
resourceid = Util.null2String(params.get(0));
|
||||
kqdate = Util.null2String(params.get(1));
|
||||
new KQFormatData().formatKqDateByLock(resourceid, kqdate,formatType);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog(" KQFormatData.formatKqDate lsFormatParams >>>>>>>>>" + e);
|
||||
}
|
||||
}
|
||||
|
||||
public void formatDateByKQDate(String kqdate) {
|
||||
String sql = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
List<List<Object>> lsFormatParams = new ArrayList<>();
|
||||
List<Object> formatParams = null;
|
||||
try {
|
||||
if (DateUtil.timeInterval(kqdate, today) < 0) {
|
||||
kqLog.info("今天之后的无需处理的数据:kqdate==" + kqdate + "today==" + today);
|
||||
return;//今天之后的无需处理
|
||||
}
|
||||
|
||||
sql = " SELECT distinct resourceid FROM ( " +
|
||||
new KQGroupBiz().getGroupMemberSql() + ") t ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = rs.getString("resourceid");
|
||||
if(Util.null2String(kqdate).length()!=10)return;
|
||||
formatParams = new ArrayList<>();
|
||||
formatParams.add(resourceid);
|
||||
formatParams.add(kqdate);
|
||||
lsFormatParams.add(formatParams);
|
||||
}
|
||||
this.format(lsFormatParams);
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
kqLog.info(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void formatDateByGroupId(String groupid, String kqdate) {
|
||||
String sql = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
List<List<Object>> lsFormatParams = new ArrayList<>();
|
||||
List<Object> formatParams = null;
|
||||
try {
|
||||
if (DateUtil.timeInterval(kqdate, today) < 0) {
|
||||
kqLog.info("今天之后的无需处理的数据:groupid==" + groupid + "kqdate==" + kqdate + "today==" + today);
|
||||
return;//今天之后的无需处理
|
||||
}
|
||||
KQGroupComInfo kqGroupComInfo = new KQGroupComInfo();
|
||||
KQGroupBiz kqGroupBiz = new KQGroupBiz();
|
||||
String kqtype = kqGroupComInfo.getKqtype(groupid);
|
||||
if (kqtype.equals("2")) {//排班
|
||||
sql = "select resourceid, kqdate from kq_shiftschedule where groupid=" + groupid + " and kqdate='" + kqdate + "' and (isdelete is null or isdelete <> '1') ";
|
||||
} else {
|
||||
sql = "select resourceid,'" + kqdate + "' from (" + kqGroupBiz.getGroupMemberSql(groupid) + ") t ";
|
||||
}
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = rs.getString("resourceid");
|
||||
if(Util.null2String(kqdate).length()!=10)return;
|
||||
formatParams = new ArrayList<>();
|
||||
formatParams.add(resourceid);
|
||||
formatParams.add(kqdate);
|
||||
lsFormatParams.add(formatParams);
|
||||
}
|
||||
this.format(lsFormatParams);
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
kqLog.info(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void formatDate(String resourceid, String kqdate) {
|
||||
List<List<Object>> lsFormatParams = new ArrayList<>();
|
||||
List<Object> formatParams = null;
|
||||
try {
|
||||
if (DateUtil.timeInterval(kqdate, today) < 0) {
|
||||
kqLog.info("今天之后的无需处理的数据:resourceid==" + resourceid + "kqdate==" + kqdate + "today==" + today);
|
||||
return;//今天之后的无需处理
|
||||
}
|
||||
if(Util.null2String(kqdate).length()!=10)return;
|
||||
formatParams = new ArrayList<>();
|
||||
formatParams.add(resourceid);
|
||||
formatParams.add(kqdate);
|
||||
lsFormatParams.add(formatParams);
|
||||
this.format(lsFormatParams);
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
kqLog.info(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void delFormatData(String resourceid, String kqdate) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
sql = " delete from kq_format_detail where resourceid =? and kqdate = ? ";//删除非工作日数据
|
||||
rs.executeUpdate(sql, resourceid, kqdate);
|
||||
|
||||
sql = " delete from kq_format_total where resourceid =? and kqdate = ? ";//删除非工作日数据
|
||||
rs.executeUpdate(sql, resourceid, kqdate);
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
kqLog.info(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearFormatPool() {
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
//删除三天前的数据格式化数据
|
||||
if (rs.getDBType().equals("sqlserver")) {
|
||||
sql = " delete from kq_format_pool where status = 1 and datediff(day,created,getdate()) > 1";
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " delete from kq_format_pool where status = 1 and datediff(now(),created) > 1";
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " delete from kq_format_pool where status = 1 and datediff(now(),created) > 1";
|
||||
}
|
||||
else if (rs.getOrgindbtype().equals("st")) {
|
||||
sql = " delete from kq_format_pool where status = 1 and to_number(trunc(sysdate) - trunc(created)) > 1";
|
||||
} else {
|
||||
sql = " delete from kq_format_pool where status = 1 and trunc(sysdate) - trunc(created) > 1";
|
||||
}
|
||||
rs.executeUpdate(sql);
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String,Object> getDefinedField(){
|
||||
Map<String,Object> retMap = new HashMap<>();
|
||||
String definedField = "";
|
||||
String definedFieldSum = "";
|
||||
String definedParam = "";
|
||||
String definedParamSum = "";
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (!Util.null2String(kqReportFieldComInfo.getIsenable()).equals("1")) continue;
|
||||
if (Util.null2String(kqReportFieldComInfo.getIsSystem()).equals("1")) continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
|
||||
if(definedField.length()>0)definedField+=",";
|
||||
definedField+=kqReportFieldComInfo.getFieldname();
|
||||
|
||||
if(definedFieldSum.length()>0)definedFieldSum+=",";
|
||||
definedFieldSum+="sum("+kqReportFieldComInfo.getFieldname()+") as "+kqReportFieldComInfo.getFieldname();
|
||||
|
||||
if(definedParam.length()>0)definedParam+=",";
|
||||
definedParam+="?";
|
||||
|
||||
if(definedParamSum.length()>0)definedParamSum+=",";
|
||||
definedParamSum+="sum("+kqReportFieldComInfo.getFieldname()+")";
|
||||
|
||||
String[] cascadekeys = Util.splitString(Util.null2String(kqReportFieldComInfo.getCascadekey()),",");
|
||||
for(int i=0;cascadekeys!=null&&i<cascadekeys.length;i++){
|
||||
String fieldname = Util.null2String(cascadekeys[i]);
|
||||
if(fieldname.length()==0)continue;
|
||||
|
||||
if(definedField.length()>0)definedField+=",";
|
||||
definedField+=fieldname;
|
||||
|
||||
if(definedFieldSum.length()>0)definedFieldSum+=",";
|
||||
definedFieldSum+="sum("+fieldname+") as "+fieldname;
|
||||
|
||||
if(definedParam.length()>0)definedParam+=",";
|
||||
definedParam+="?";
|
||||
|
||||
if(definedParamSum.length()>0)definedParamSum+=",";
|
||||
definedParamSum+="sum("+fieldname+")";
|
||||
}
|
||||
}
|
||||
retMap.put("definedField",definedField);
|
||||
retMap.put("definedFieldSum",definedFieldSum);
|
||||
retMap.put("definedParam",definedParam);
|
||||
retMap.put("definedParamSum",definedParamSum);
|
||||
return retMap;
|
||||
}
|
||||
|
||||
public boolean needCal(String workDate, String workTime){
|
||||
boolean needCalForgotCheckMins = true;
|
||||
if (KQSettingsBiz.getKqformatAccurate()) {
|
||||
workTime = new KQTimesArrayComInfo().turn48to24Time(workTime);
|
||||
if (workDate.length() > 0 && workTime.length() > 0) {
|
||||
String currentFullTime = DateUtil.getFullDate();
|
||||
String endTime = workDate + " " + workTime;
|
||||
if (DateUtil.timeInterval(currentFullTime, endTime) > 0) {
|
||||
//当前时间之后的状态无效计算
|
||||
needCalForgotCheckMins = false;
|
||||
}
|
||||
kqLog.writeLog("currentFullTime:"+currentFullTime+"wroktime:"+endTime+"needCalForgotCheckMins:"+needCalForgotCheckMins);
|
||||
}
|
||||
}
|
||||
return needCalForgotCheckMins;
|
||||
}
|
||||
|
||||
public boolean needCal(String workDate, String workTime,String isneedcal){
|
||||
boolean needCalForgotCheckMins = true;
|
||||
boolean isneedformat = "1".equals(isneedcal);
|
||||
if (isneedformat) {
|
||||
workTime = new KQTimesArrayComInfo().turn48to24Time(workTime);
|
||||
if (workDate.length() > 0 && workTime.length() > 0) {
|
||||
String currentFullTime = DateUtil.getFullDate();
|
||||
String endTime = workDate + " " + workTime;
|
||||
if (DateUtil.timeInterval(currentFullTime, endTime) > 0) {
|
||||
//当前时间之后的状态无效计算
|
||||
needCalForgotCheckMins = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return needCalForgotCheckMins;
|
||||
}
|
||||
|
||||
private List<List<Object>> processFormatParams(List<List<Object>> lsFormatParams) {
|
||||
List<List<Object>> lsFormatParamsTmp = new ArrayList<>();
|
||||
try {
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
List<Object> formatParams = null;
|
||||
for(int i=0;i<lsFormatParams.size();i++){
|
||||
formatParams = lsFormatParams.get(i);
|
||||
String resourceId = Util.null2String(formatParams.get(0));
|
||||
String kqDate = Util.null2String(formatParams.get(1));
|
||||
String formattype = "";
|
||||
if(formatParams.size() > 2) {
|
||||
formattype = Util.null2String(formatParams.get(2));
|
||||
}
|
||||
|
||||
formatParams = new ArrayList<>();
|
||||
formatParams.add(resourceId);
|
||||
formatParams.add(kqDate);
|
||||
formatParams.add(new java.sql.Timestamp(DateUtil.getCalendar(DateUtil.getFullDate()).getTimeInMillis()));
|
||||
formatParams.add(formattype);
|
||||
lsFormatParamsTmp.add(formatParams);
|
||||
|
||||
String nextDate = DateUtil.addDate(kqDate, 1);//下一天日期
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceId, kqDate);
|
||||
List<TimeScopeEntity> lsWorkTime = new ArrayList<>();
|
||||
if (workTime != null) {
|
||||
lsWorkTime = workTime.getWorkTime();//工作时间
|
||||
for (int j = 0; lsWorkTime != null && j < lsWorkTime.size(); j++) {
|
||||
TimeScopeEntity workTimeScope = lsWorkTime.get(j);
|
||||
String workBeginDateTime = workTimeScope.getBeginTimeAcross() ? nextDate : kqDate;
|
||||
workBeginDateTime+=" "+kqTimesArrayComInfo.turn48to24Time(workTimeScope.getBeginTime())+":00:00";
|
||||
String workEndDateTime = workTimeScope.getEndTimeAcross() ? nextDate : kqDate;
|
||||
workEndDateTime+=" "+kqTimesArrayComInfo.turn48to24Time(workTimeScope.getEndTime())+":00:00";
|
||||
|
||||
formatParams = new ArrayList<>();
|
||||
formatParams.add(resourceId);
|
||||
formatParams.add(kqDate);
|
||||
formatParams.add(new java.sql.Timestamp(DateUtil.getCalendar(workBeginDateTime).getTimeInMillis()));
|
||||
formatParams.add(formattype);
|
||||
lsFormatParamsTmp.add(formatParams);
|
||||
|
||||
formatParams = new ArrayList<>();
|
||||
formatParams.add(resourceId);
|
||||
formatParams.add(kqDate);
|
||||
formatParams.add(new java.sql.Timestamp(DateUtil.getCalendar(workEndDateTime).getTimeInMillis()));
|
||||
formatParams.add(formattype);
|
||||
lsFormatParamsTmp.add(formatParams);
|
||||
}
|
||||
}else{
|
||||
formatParams = new ArrayList<>();
|
||||
formatParams.add(resourceId);
|
||||
formatParams.add(kqDate);
|
||||
formatParams.add(formattype);
|
||||
lsFormatParamsTmp.add(formatParams);
|
||||
}
|
||||
}
|
||||
|
||||
}catch (Exception e) {
|
||||
StringWriter errorsWriter = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(errorsWriter));
|
||||
kqLog.info(errorsWriter.toString());
|
||||
}
|
||||
return lsFormatParamsTmp;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,48 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.engine.kq.log.KQLog;
|
||||
import java.util.List;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.tools.HrmDateCheck;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
/**
|
||||
* 格式化入职日期、离职日期发生变化的考勤数据
|
||||
*/
|
||||
public class KQFormatDateChangeJob extends BaseCronJob{
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
RecordSet rs = new RecordSet();
|
||||
try{
|
||||
kqLog.info("begin do KQFormatDateChangeJob invoke ...");
|
||||
|
||||
List<String> upSqls = Lists.newArrayList();
|
||||
RecordSet rs1 = new RecordSet();
|
||||
String sql = "select * from kq_date_change_log where status ='0'";
|
||||
kqLog.info("begin do KQFormatDateChangeJob invoke ...sql::"+sql);
|
||||
rs1.execute(sql);
|
||||
while (rs1.next()){
|
||||
String id = Util.null2String(rs1.getString("id"));
|
||||
String resourceid = Util.null2String(rs1.getString("resourceid"));
|
||||
String changefromdate = Util.null2String(rs1.getString("changefromdate"));
|
||||
String changetodate = Util.null2String(rs1.getString("changetodate"));
|
||||
kqLog.info("KQScheduleFormatJob:id:"+id+":resourceid:"+resourceid+":changefromdate:"+changefromdate+":changetodate:"+changetodate);
|
||||
new HrmDateCheck().calKqData(changefromdate,changetodate,resourceid);
|
||||
String upsql = "update kq_date_change_log set status='1' where id = "+id;
|
||||
upSqls.add(upsql);
|
||||
}
|
||||
|
||||
for (String upsql :upSqls) {
|
||||
rs1.executeUpdate(upsql);
|
||||
}
|
||||
kqLog.info("end do KQFormatDateChangeJob invoke ...");
|
||||
}catch (Exception e) {
|
||||
kqLog.info(e) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,358 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.jucailin.genid.IdGenerator;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.engine.kq.enums.FlowReportTypeEnum;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.google.common.collect.Maps;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
||||
/**
|
||||
* 格式化自由工时数据
|
||||
*/
|
||||
public class KQFormatFreeData extends BaseBean{
|
||||
private static DecimalFormat df = new DecimalFormat("0.00");
|
||||
protected KQLog kqLog = new KQLog();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @param kqDate
|
||||
* @param workFlowInfo
|
||||
* @return
|
||||
*/
|
||||
public List<List<Object>> format(String userId, String kqDate, Map<String,Object> workFlowInfo){
|
||||
List<List<Object>> lsParam = new ArrayList<>();
|
||||
List<Object> params = new ArrayList<>();
|
||||
try{
|
||||
Timestamp date = new Timestamp(System.currentTimeMillis());
|
||||
int workMins = 0;
|
||||
String signInId = "";
|
||||
String signInDate = "";
|
||||
String signInTime = "";
|
||||
String signOutId = "";
|
||||
String signOutDate = "";
|
||||
String signOutTime = "";
|
||||
|
||||
String temp_signInDate = "";
|
||||
String temp_signInTime = "";
|
||||
String temp_signOutDate = "";
|
||||
String temp_signOutTime = "";
|
||||
|
||||
String cal_signInId = "";
|
||||
String cal_signInDate = "";
|
||||
String cal_signInTime = "";
|
||||
String cal_signOutId = "";
|
||||
String cal_signOutDate = "";
|
||||
String cal_signOutTime = "";
|
||||
|
||||
int signMins = 0;
|
||||
int attendanceMins=0;
|
||||
String serialid = "";
|
||||
String groupid = "";
|
||||
int beLateMins = 0;
|
||||
int graveBeLateMins = 0;
|
||||
int leaveEarlyMins =0;
|
||||
int graveLeaveEarlyMins =0;
|
||||
int absenteeismMins =0;
|
||||
int leaveMins = 0;//请假时长
|
||||
int evectionMins = 0;//出差时长
|
||||
int outMins = 0;//公出时长
|
||||
Map<String,Integer> leaveInfo = new HashMap<>();//请假信息
|
||||
Map<String,Object> otherinfo = new HashMap<>();//存一些用得到的信息
|
||||
Map<String,Object> flowinfo = new HashMap<>();//流程信息
|
||||
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
|
||||
int workBeginIdx = 0;
|
||||
int beginIdx = 0;
|
||||
int endIdx = 0;
|
||||
String dateKey = userId +"|"+ kqDate;
|
||||
String nextDate = DateUtil.addDate(kqDate, 1);
|
||||
|
||||
List<Object> workFlow = null;
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId,kqDate);
|
||||
String signstart = "";
|
||||
String calmethod = "2";
|
||||
if(workTime!=null) {
|
||||
groupid = Util.null2String(workTime.getGroupId());
|
||||
signstart = Util.null2String(workTime.getSignStart());//签到开始时间
|
||||
workMins = Util.getIntValue(Util.null2String(workTime.getWorkMins()));//工作时长
|
||||
workBeginIdx = kqTimesArrayComInfo.getArrayindexByTimes(signstart);
|
||||
calmethod = Util.null2s(workTime.getCalmethod(),"1");//自由班制计算方式
|
||||
}
|
||||
// 弹性工作制是否可以跨天
|
||||
boolean isFreezeAcross = KQSettingsBiz.is_freeAcross();
|
||||
|
||||
int kqSize = 1440;
|
||||
if(isFreezeAcross){
|
||||
kqSize = kqTimesArrayComInfo.getIndexSize();
|
||||
}
|
||||
int[] dayMins = new int[kqSize];//一天所有分钟数
|
||||
|
||||
if(workFlowInfo.get(dateKey)!=null){
|
||||
workFlow = (List<Object>)workFlowInfo.get(dateKey);
|
||||
}
|
||||
|
||||
for(int j=0;workFlow!=null&&j<workFlow.size();j++) {
|
||||
Map<String, Object> data = (Map<String, Object>) workFlow.get(j);
|
||||
String flowType = Util.null2String(data.get("flowtype"));
|
||||
String newLeaveType = Util.null2String(data.get("newleavetype"));
|
||||
String begintime = Util.null2String(data.get("begintime"));
|
||||
String endtime = Util.null2String(data.get("endtime"));
|
||||
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(begintime);
|
||||
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(endtime);
|
||||
|
||||
Map<String,String> flowMap = Maps.newHashMap();
|
||||
flowMap.put("newLeaveType", newLeaveType);
|
||||
flowMap.put("begintime", begintime);
|
||||
flowMap.put("endtime", endtime);
|
||||
List<Map<String,String>> flowMapList = Lists.newArrayList();
|
||||
if(flowinfo.containsKey(flowType)){
|
||||
List<Map<String,String>> tmpFlowMapList = (List<Map<String, String>>) flowinfo.get(flowType);
|
||||
tmpFlowMapList.add(flowMap);
|
||||
}else{
|
||||
flowMapList.add(flowMap);
|
||||
flowinfo.put(flowType, flowMapList);
|
||||
}
|
||||
if(flowType.equals(FlowReportTypeEnum.EVECTION.getFlowType())){
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 7);//出差抵扣时段标识 7
|
||||
}else if(flowType.equals(FlowReportTypeEnum.OUT.getFlowType())){
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 8);//公出抵扣时段标识 8
|
||||
}else{
|
||||
if (endIdx > beginIdx) {
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 5);//流程抵扣时段标识 5
|
||||
if(flowType.equalsIgnoreCase(FlowReportTypeEnum.LEAVE.getFlowType())){
|
||||
int tmpBeginIdx = beginIdx;
|
||||
int tmpEndIdx = endIdx;
|
||||
int val = 0;
|
||||
if(leaveInfo.get(newLeaveType)==null){
|
||||
leaveInfo.put(newLeaveType,val);
|
||||
}else{
|
||||
val = leaveInfo.get(newLeaveType);
|
||||
}
|
||||
if(beginIdx<workBeginIdx)tmpBeginIdx=workBeginIdx;
|
||||
if(tmpEndIdx>tmpBeginIdx){
|
||||
leaveInfo.put(newLeaveType,val+(tmpEndIdx-tmpBeginIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String signBeginDateTime = kqDate + " "+ signstart+":00";
|
||||
String signEndDateTime = kqDate + " 23:59:59";
|
||||
if(isFreezeAcross){
|
||||
signEndDateTime = nextDate + " "+ signstart+":00";
|
||||
}
|
||||
String workBeginDateTime = "";
|
||||
String workEndDateTime = "";
|
||||
List<Object> lsCheckInfo = new KQFormatSignData().getSignInfoForAll(userId,signBeginDateTime,signEndDateTime,workBeginDateTime,workEndDateTime);
|
||||
|
||||
if("2".equalsIgnoreCase(calmethod)){
|
||||
//成对出现
|
||||
if(!lsCheckInfo.isEmpty()) {
|
||||
if(lsCheckInfo.size()%2==1 && lsCheckInfo.size() > 1){
|
||||
lsCheckInfo.remove(lsCheckInfo.size()-1);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(!lsCheckInfo.isEmpty()) {
|
||||
List<Object> tmplsCheckInfo = Lists.newArrayList();
|
||||
tmplsCheckInfo.add(lsCheckInfo.get(0));
|
||||
if(lsCheckInfo.size()>1) {
|
||||
tmplsCheckInfo.add(lsCheckInfo.get(lsCheckInfo.size() - 1));
|
||||
}
|
||||
lsCheckInfo.clear();
|
||||
lsCheckInfo.addAll(tmplsCheckInfo);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i<lsCheckInfo.size(); i++) {//有签到签退才算出勤,漏签无法统计出勤时间
|
||||
Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(i);
|
||||
String signId = Util.null2String(checkInfo.get("signId"));
|
||||
String signDate = Util.null2String(checkInfo.get("signDate"));
|
||||
String signTime = Util.null2String(checkInfo.get("signTime"));
|
||||
if (signTime.length() > 8) {
|
||||
signTime = signTime.substring(0, 8);
|
||||
}
|
||||
|
||||
//用于计算打卡时长
|
||||
if (checkInfo.get("signType").equals("1")) {//签到
|
||||
temp_signInDate = signDate;
|
||||
if(temp_signInDate.compareTo(kqDate) > 0){
|
||||
temp_signInTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}else{
|
||||
temp_signInTime = signTime;
|
||||
}
|
||||
} else if (checkInfo.get("signType").equals("2")) {//签退
|
||||
temp_signOutDate = signDate;
|
||||
if(temp_signOutDate.compareTo(kqDate) > 0){
|
||||
temp_signOutTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}else{
|
||||
temp_signOutTime = signTime;
|
||||
}
|
||||
}
|
||||
|
||||
if (i==0 && checkInfo.get("signType").equals("1")) {//签到
|
||||
signInId = signId;
|
||||
signInDate = signDate;
|
||||
signInTime = signTime;
|
||||
if(temp_signInDate.compareTo(kqDate) > 0){
|
||||
temp_signInTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}else{
|
||||
temp_signInTime = signTime;
|
||||
}
|
||||
} else if (i==lsCheckInfo.size()-1&&checkInfo.get("signType").equals("2")) {//签退
|
||||
signOutId = signId;
|
||||
signOutDate = signDate;
|
||||
signOutTime = signTime;
|
||||
}
|
||||
|
||||
if("2".equalsIgnoreCase(calmethod)){
|
||||
if(i%2==1){
|
||||
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(temp_signInTime);
|
||||
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(temp_signOutTime);
|
||||
if(endIdx>beginIdx) {
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 1);//工作时段标识 1
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(i == 0){
|
||||
cal_signInId = signId;
|
||||
cal_signInDate = signDate;
|
||||
cal_signInTime = signTime;
|
||||
}else {
|
||||
cal_signOutId = signId;
|
||||
cal_signOutDate = signDate;
|
||||
cal_signOutTime = signTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if("1".equalsIgnoreCase(calmethod)){
|
||||
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(cal_signInTime);
|
||||
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(cal_signOutTime);
|
||||
if(cal_signInDate.compareTo(kqDate) > 0){
|
||||
beginIdx = kqTimesArrayComInfo.turn24to48TimeIndex(beginIdx);
|
||||
}
|
||||
if(cal_signOutDate.compareTo(kqDate) > 0){
|
||||
endIdx = kqTimesArrayComInfo.turn24to48TimeIndex(endIdx);
|
||||
}
|
||||
if(endIdx>beginIdx) {
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 1);//工作时段标识 1
|
||||
}
|
||||
signInId = cal_signInId;
|
||||
signInDate = cal_signInDate;
|
||||
signInTime = cal_signInTime;
|
||||
signOutId = cal_signOutId;
|
||||
signOutDate = cal_signOutDate;
|
||||
signOutTime = cal_signOutTime;
|
||||
}
|
||||
|
||||
int workFlowMins = 0;
|
||||
for(int i=workBeginIdx;i<kqSize;i++) {
|
||||
switch(dayMins[i]){
|
||||
case 1://出勤分钟数
|
||||
attendanceMins++;
|
||||
break;
|
||||
case 5:
|
||||
leaveMins++;//请假分钟数
|
||||
break;
|
||||
case 7:
|
||||
evectionMins++;
|
||||
break;
|
||||
case 8:
|
||||
outMins++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//计算实际出勤时间(打卡、出差、公出算出勤)
|
||||
signMins = attendanceMins;
|
||||
attendanceMins = attendanceMins+evectionMins+outMins;
|
||||
if(attendanceMins>workMins)attendanceMins=workMins;
|
||||
|
||||
absenteeismMins = workMins - attendanceMins-leaveMins;
|
||||
if(absenteeismMins<0){
|
||||
absenteeismMins=0;
|
||||
}
|
||||
|
||||
if (workTime.getIsExclude()) {//无需考勤人员没有异常状态
|
||||
attendanceMins = workMins;
|
||||
beLateMins = 0;
|
||||
graveBeLateMins = 0;
|
||||
leaveEarlyMins = 0;
|
||||
graveLeaveEarlyMins = 0;
|
||||
absenteeismMins = 0;
|
||||
}
|
||||
|
||||
params.add(userId);
|
||||
params.add(kqDate);
|
||||
params.add(groupid.length() == 0 ? null : groupid);
|
||||
params.add(serialid.length() == 0 ? null : serialid);
|
||||
params.add(0);
|
||||
params.add(null);
|
||||
params.add(null);
|
||||
params.add(null);
|
||||
params.add(null);
|
||||
params.add(workMins);
|
||||
params.add(signInDate);
|
||||
params.add(signInTime);
|
||||
params.add(signInId.length() == 0 ? null : signInId);
|
||||
params.add(signOutDate);
|
||||
params.add(signOutTime);
|
||||
params.add(signOutId.length() == 0 ? null : signOutId);
|
||||
params.add(signMins);
|
||||
params.add(attendanceMins);
|
||||
params.add(beLateMins);
|
||||
params.add(graveBeLateMins);
|
||||
params.add(leaveEarlyMins);
|
||||
params.add(graveLeaveEarlyMins);
|
||||
params.add(absenteeismMins);
|
||||
params.add(null);
|
||||
params.add(leaveMins);
|
||||
params.add(JSONObject.toJSONString(leaveInfo));
|
||||
params.add(evectionMins);
|
||||
params.add(outMins);
|
||||
params.add(null);
|
||||
params.add(JSONObject.toJSONString(otherinfo));
|
||||
Long id = IdGenerator.generate();
|
||||
params.add(workTime.getDayType());
|
||||
params.add(date);
|
||||
params.add(date);
|
||||
params.add(id);
|
||||
params.add(JSONObject.toJSONString(flowinfo));
|
||||
if(absenteeismMins<=0) {
|
||||
params.add(0);
|
||||
params.add(0);
|
||||
} else {
|
||||
params.add(attendanceMins/2);
|
||||
params.add(attendanceMins/2);
|
||||
}
|
||||
lsParam.add(params);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
kqLog.info(e);
|
||||
}
|
||||
return lsParam;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.weaver.util.threadPool.ThreadPoolUtil;
|
||||
import com.weaver.util.threadPool.constant.ModulePoolEnum;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.ConnStatement;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.general.WArrayList;
|
||||
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* 考勤数据格式化定时任务
|
||||
*/
|
||||
public class KQFormatJob extends TimerTask {
|
||||
private static KQFormatJob instance = new KQFormatJob();
|
||||
public static WArrayList kqformatIds = new WArrayList();
|
||||
private static boolean flag = false;
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public static KQFormatJob getInstance(){
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
KQFormatThread kqFormatThread = null;
|
||||
ConnStatement cs = new ConnStatement();
|
||||
String sql = "";
|
||||
try{
|
||||
if(flag) return;
|
||||
flag = true;
|
||||
if(kqformatIds.size()>0){
|
||||
flag = false;
|
||||
return;
|
||||
}
|
||||
sql = " select id, kqdate, resourceid,formattype from kq_format_pool where status = 0 order by kqdate, resourceid asc";
|
||||
boolean kqformatAccurate = KQSettingsBiz.getKqformatAccurate();
|
||||
if (kqformatAccurate){
|
||||
String currentFullTime = DateUtil.getFullDate();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
sql = " select id, kqdate, resourceid,exectime,formattype from kq_format_pool where status = 0 and exectime is not null and exectime < to_date('"+currentFullTime+"','yyyy-mm-dd hh24:mi:ss') order by kqdate, resourceid, exectime asc";
|
||||
}
|
||||
else if(rs.getDBType().equals("postgresql")){
|
||||
sql = " select id, kqdate, resourceid,exectime,formattype from kq_format_pool where status = 0 and exectime is not null and exectime < TO_TIMESTAMP('"+currentFullTime+"','yyyy-mm-dd hh24:mi:ss') order by kqdate, resourceid, exectime asc";
|
||||
}
|
||||
else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select id, kqdate, resourceid,exectime,formattype from kq_format_pool where status = 0 and exectime is not null and exectime<STR_TO_DATE('"+currentFullTime+"', '%Y-%m-%d %H:%i:%s') order by kqdate, resourceid, exectime asc";
|
||||
}else{
|
||||
sql = " select id, kqdate, resourceid,exectime,formattype from kq_format_pool where status = 0 and exectime is not null and exectime<CONVERT(datetime,'"+currentFullTime+"',120) order by kqdate, resourceid, exectime asc";
|
||||
}
|
||||
}
|
||||
//rs.executeQuery(sql);
|
||||
cs.setStatementSql(sql);
|
||||
cs.executeQuery();
|
||||
while (cs.next()) {
|
||||
String key = cs.getString("kqdate") +"|"+cs.getString("resourceid");
|
||||
if(kqformatIds.contains(key))continue;
|
||||
kqformatIds.add(key);
|
||||
kqFormatThread = new KQFormatThread();
|
||||
kqFormatThread.setId(cs.getString("id"));
|
||||
kqFormatThread.setKqdate(cs.getString("kqdate"));
|
||||
kqFormatThread.setResourceid(cs.getString("resourceid"));
|
||||
kqFormatThread.setFormatType(Util.getIntValue(cs.getInt("formattype")));
|
||||
if(kqformatAccurate) {
|
||||
kqLog.info(Thread.currentThread().getId() + "===KQFormatJob in>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + cs.getString("id") + "==" + cs.getString("kqdate") + "==" + cs.getString("resourceid") + "==" + cs.getString("exectime"));
|
||||
}else{
|
||||
kqLog.info(Thread.currentThread().getId() + "===KQFormatJob in>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + cs.getString("id") + "==" + cs.getString("kqdate") + "==" + cs.getString("resourceid"));
|
||||
}
|
||||
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.HRM, "KQFormatJob", kqFormatThread);
|
||||
}
|
||||
|
||||
flag = false;
|
||||
}catch (Exception e){
|
||||
flag = false;
|
||||
new BaseBean().writeLog(e);
|
||||
kqLog.info("考勤数据格式化定时任务错误:",e);
|
||||
}finally {
|
||||
try {
|
||||
cs.close();
|
||||
}catch(Exception ex) {new BaseBean().writeLog("关闭考勤数据格式化定时任务数据库链接错误");}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,561 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kq.biz.chain.shiftinfo.ShiftInfoBean;
|
||||
import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum;
|
||||
import com.engine.kq.entity.KQShiftRuleEntity;
|
||||
import com.engine.kq.entity.TimeScopeEntity;
|
||||
import com.engine.kq.entity.TimeSignScopeEntity;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 格式化数据 人性化规则
|
||||
*/
|
||||
public class KQFormatShiftRule extends BaseBean {
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public KQShiftRuleEntity doShiftRule(WorkTimeEntity workTime, KQShiftRuleEntity kqShiftRuleEntity) {
|
||||
Map<String, Object> shiftRuleInfo = workTime.getShiftRuleInfo();
|
||||
//人性化处理
|
||||
if (shiftRuleInfo != null && shiftRuleInfo.size() > 0) {
|
||||
Map<String, Object> ruleDetail = (Map<String, Object>) shiftRuleInfo.get("ruleDetail");
|
||||
//允许迟到分钟数
|
||||
boolean usepermitlateminutes = Util.null2String(shiftRuleInfo.get("permitlatestatus")).equals("1");
|
||||
int permitlateminutes = Util.getIntValue(Util.null2String(shiftRuleInfo.get("permitlateminutes")), 0);
|
||||
boolean enableexcludelate = Util.null2String(shiftRuleInfo.get("enableexcludelate")).equals("1");
|
||||
//允许早退分钟数
|
||||
boolean usepermitleaveearlyminutes = Util.null2String(shiftRuleInfo.get("permitleaveearlystatus")).equals("1");
|
||||
int permitleaveearlyminutes = Util.getIntValue(Util.null2String(shiftRuleInfo.get("permitleaveearlyminutes")), 0);
|
||||
boolean enableexcludeleaveearly = Util.null2String(shiftRuleInfo.get("enableexcludeleaveearly")).equals("1");
|
||||
|
||||
//严重迟到分钟数
|
||||
boolean useseriouslateminutes = Util.null2String(shiftRuleInfo.get("seriouslatestatus")).equals("1");
|
||||
int seriouslateminutes = Util.getIntValue(Util.null2String(shiftRuleInfo.get("seriouslateminutes")), 0);
|
||||
//严重早退分钟数
|
||||
boolean useseriousleaveearlyminutes = Util.null2String(shiftRuleInfo.get("seriousleaveearlystatus")).equals("1");
|
||||
int seriousleaveearlyminutes = Util.getIntValue(Util.null2String(shiftRuleInfo.get("seriousleaveearlyminutes")), 0);
|
||||
//迟到多少钟数算旷工
|
||||
boolean uselateabsentminutes = Util.null2String(shiftRuleInfo.get("lateabsentstatus")).equals("1");
|
||||
int lateabsentminutes = Util.getIntValue(Util.null2String(shiftRuleInfo.get("lateabsentminutes")), 0);
|
||||
//早退多少钟数算旷工
|
||||
boolean useleaveearlyabsentminutes = Util.null2String(shiftRuleInfo.get("leaveearlyabsentstatus")).equals("1");
|
||||
int leaveearlyabsentminutes = Util.getIntValue(Util.null2String(shiftRuleInfo.get("leaveearlyabsentminutes")), 0);
|
||||
//允许下班不打卡
|
||||
boolean isoffdutyfreecheck = Util.null2String(shiftRuleInfo.get("isoffdutyfreecheck")).equals("1");
|
||||
|
||||
String userId = kqShiftRuleEntity.getUserId();
|
||||
String kqDate = kqShiftRuleEntity.getKqDate();
|
||||
int beLateMins = kqShiftRuleEntity.getBelatemins();
|
||||
int graveBeLateMins = 0;
|
||||
int leaveEarlyMins = kqShiftRuleEntity.getLeaveearlymins();
|
||||
int graveLeaveEarlyMins = 0;
|
||||
int absenteeismMins = kqShiftRuleEntity.getAbsenteeismmins();
|
||||
int forgotcheckMins = kqShiftRuleEntity.getForgotcheckmins();
|
||||
int forgotBeginWorkCheckMins = kqShiftRuleEntity.getForgotBeginWorkCheckMins();
|
||||
int earlyInMins = kqShiftRuleEntity.getEarlyInMins();
|
||||
int lateOutMins = kqShiftRuleEntity.getLateOutMins();
|
||||
String nosign_is_absent = kqShiftRuleEntity.getNosign_is_absent();
|
||||
String early_one_mins = kqShiftRuleEntity.getEarly_one_mins();
|
||||
String signInTime = kqShiftRuleEntity.getSignInTime();
|
||||
String signOutTime = kqShiftRuleEntity.getSignOutTime();
|
||||
|
||||
|
||||
|
||||
List<Object> earlyinearlyout = null;//早到早走规则
|
||||
List<Object> lateinlateout = null;//晚到晚走规则
|
||||
List<Object> lateoutlatein = null;//晚走晚到规则
|
||||
|
||||
//这里个性化没法处理流程数据,逻辑改为在前面直接虚拟改掉了上下班时间
|
||||
if (ruleDetail != null && ruleDetail.size() > 0 && false) {//处理人性化设置其他规则
|
||||
earlyinearlyout = (List<Object>) ruleDetail.get("earlyinearlyout");
|
||||
lateinlateout = (List<Object>) ruleDetail.get("lateinlateout");
|
||||
lateoutlatein = (List<Object>) ruleDetail.get("lateoutlatein");
|
||||
|
||||
if (earlyinearlyout != null && earlyinearlyout.size() > 0 && leaveEarlyMins > 0) {
|
||||
for (int i = 0; earlyInMins > 0 && i < earlyinearlyout.size(); i++) {
|
||||
Map<String, Object> rule = (Map<String, Object>) earlyinearlyout.get(i);
|
||||
if (Util.null2String(rule.get("enable")).equals("1")) {
|
||||
int advancetime = new Double((Util.getDoubleValue(Util.null2String(rule.get("advancetime"))))).intValue();//早到时间
|
||||
int postponetime = new Double((Util.getDoubleValue(Util.null2String(rule.get("postponetime"))))).intValue();//允许早走时间
|
||||
if (Util.null2String(rule.get("enablesame")).equals("1")) {
|
||||
if (earlyInMins > postponetime) {
|
||||
leaveEarlyMins -= postponetime;
|
||||
if (leaveEarlyMins < 0) leaveEarlyMins = 0;
|
||||
} else {
|
||||
leaveEarlyMins -= earlyInMins;
|
||||
if (leaveEarlyMins < 0) leaveEarlyMins = 0;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if (earlyInMins >= advancetime) {
|
||||
leaveEarlyMins -= postponetime;
|
||||
if (leaveEarlyMins < 0) leaveEarlyMins = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lateinlateout != null && lateinlateout.size() > 0 && beLateMins > 0) {
|
||||
for (int i = 0; lateOutMins > 0 && i < lateinlateout.size(); i++) {
|
||||
Map<String, Object> rule = (Map<String, Object>) lateinlateout.get(i);
|
||||
if (Util.null2String(rule.get("enable")).equals("1")) {
|
||||
int advancetime = new Double((Util.getDoubleValue(Util.null2String(rule.get("advancetime"))))).intValue();//晚到时间
|
||||
int postponetime = new Double((Util.getDoubleValue(Util.null2String(rule.get("postponetime"))))).intValue();//需要晚走时间
|
||||
if (Util.null2String(rule.get("enablesame")).equals("1")) {
|
||||
if (lateOutMins > postponetime) {
|
||||
beLateMins -= postponetime;
|
||||
if (beLateMins < 0) beLateMins = 0;
|
||||
} else {
|
||||
beLateMins -= lateOutMins;
|
||||
if (beLateMins < 0) beLateMins = 0;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if (lateOutMins >= postponetime) {
|
||||
beLateMins -= advancetime;
|
||||
if (beLateMins < 0) beLateMins = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lateoutlatein != null && lateoutlatein.size() > 0 && beLateMins > 0) {
|
||||
int preDayLateOutMins = getPreDayLateOutMins(userId, kqDate);
|
||||
for (int i = 0; preDayLateOutMins > 0 && i < lateoutlatein.size(); i++) {
|
||||
Map<String, Object> rule = (Map<String, Object>) lateoutlatein.get(i);
|
||||
if (Util.null2String(rule.get("enable")).equals("1")) {
|
||||
int advancetime = new Double((Util.getDoubleValue(Util.null2String(rule.get("advancetime"))))).intValue();//晚走时间
|
||||
int postponetime = new Double((Util.getDoubleValue(Util.null2String(rule.get("postponetime"))))).intValue();//允许晚到时间
|
||||
|
||||
if (Util.null2String(rule.get("enablesame")).equals("1")) {
|
||||
if (preDayLateOutMins > postponetime) {
|
||||
beLateMins -= postponetime;
|
||||
if (beLateMins < 0) beLateMins = 0;
|
||||
} else {
|
||||
beLateMins -= preDayLateOutMins;
|
||||
if (beLateMins < 0) beLateMins = 0;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if (preDayLateOutMins >= advancetime) {
|
||||
beLateMins -= postponetime;
|
||||
if (beLateMins < 0) beLateMins = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (beLateMins > 0) {//迟到人性化设置
|
||||
if (usepermitlateminutes) {//允许迟到分钟数
|
||||
if (permitlateminutes >= beLateMins) {
|
||||
beLateMins = 0;
|
||||
} else if (enableexcludelate) {
|
||||
beLateMins = beLateMins - permitlateminutes;
|
||||
}
|
||||
}
|
||||
|
||||
if (uselateabsentminutes && beLateMins >= lateabsentminutes) {//旷工
|
||||
absenteeismMins += beLateMins;
|
||||
beLateMins = 0;
|
||||
kqShiftRuleEntity.setOn_absenteeismMins(absenteeismMins);
|
||||
kqShiftRuleEntity.setAMAbsent(true);
|
||||
//leaveEarlyMins = 0;
|
||||
if ("1".equals(nosign_is_absent)) {
|
||||
/**
|
||||
* 在漏签算实际出勤的情况,才需要清空漏签时长(forgotcheckMins),原由如下:比如09:00--18:00,这是11:00打上班卡,下班卡没有打卡
|
||||
* 情况1:没有开启迟到或者早退算旷工的情况,正常应该显示:【迟到120分钟 漏签】,这时候实际出勤应该是0
|
||||
* 情况2:开启了迟到60分钟算旷工之后,应该显示【旷工120分钟 漏签】,这时候实际出勤应该是0。而如果清空漏签时长(forgotcheckMins) ,那么就有实际出勤时长了,因为实际出勤=应出勤-迟到-早退-旷工-请假-漏签时长
|
||||
* 所以:在漏签算实际出勤的时候才需要清空,也就原标准逻辑,反之不需要清空
|
||||
* ,
|
||||
*/
|
||||
forgotcheckMins = 0;
|
||||
} else {
|
||||
kqShiftRuleEntity.setNosign_ishandle("1");
|
||||
}
|
||||
} else if (useseriouslateminutes && beLateMins >= seriouslateminutes) {//严重迟到
|
||||
graveBeLateMins += beLateMins;
|
||||
//TODO 这有个问题,严重迟到了,还要不要算迟到?这两个是同时存在的吗?
|
||||
beLateMins = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (leaveEarlyMins > 0) {//早退人性化设置
|
||||
if (usepermitleaveearlyminutes) {//允许早退分钟数
|
||||
if (permitleaveearlyminutes >= leaveEarlyMins) {
|
||||
leaveEarlyMins = 0;
|
||||
} else if (enableexcludeleaveearly) {
|
||||
leaveEarlyMins = leaveEarlyMins - permitleaveearlyminutes;
|
||||
}
|
||||
}
|
||||
if (useleaveearlyabsentminutes && leaveEarlyMins >= leaveearlyabsentminutes) {//旷工
|
||||
absenteeismMins += leaveEarlyMins;
|
||||
//beLateMins = 0;
|
||||
leaveEarlyMins = 0;
|
||||
kqShiftRuleEntity.setOff_absenteeismMins(absenteeismMins);
|
||||
kqShiftRuleEntity.setPMAbsent(true);
|
||||
if ("1".equals(nosign_is_absent)) {
|
||||
/**
|
||||
* 在漏签算实际出勤的情况,才需要清空漏签时长(forgotcheckMins),原由如下:比如09:00--18:00,这是11:00打上班卡,下班卡没有打卡
|
||||
* 情况1:没有开启迟到或者早退算旷工的情况,正常应该显示:【迟到120分钟 漏签】,这时候实际出勤应该是0
|
||||
* 情况2:开启了迟到60分钟算旷工之后,应该显示【旷工120分钟 漏签】,这时候实际出勤应该是0。而如果清空漏签时长(forgotcheckMins) ,那么就有实际出勤时长了,因为实际出勤=应出勤-迟到-早退-旷工-请假-漏签时长
|
||||
* 所以:在漏签算实际出勤的时候才需要清空,也就原标准逻辑,反之不需要清空
|
||||
* ,
|
||||
*/
|
||||
forgotcheckMins = 0;
|
||||
forgotBeginWorkCheckMins = 0;
|
||||
} else {
|
||||
kqShiftRuleEntity.setNosign_ishandle("2");
|
||||
}
|
||||
|
||||
} else if (useseriousleaveearlyminutes && leaveEarlyMins >= seriousleaveearlyminutes) {//严重早退
|
||||
graveLeaveEarlyMins += leaveEarlyMins;
|
||||
//TODO 这有个问题,严重早退了,还要不要算早退?这两个是同时存在的吗?
|
||||
leaveEarlyMins = 0;
|
||||
}
|
||||
}
|
||||
//允许下班不打卡
|
||||
if (isoffdutyfreecheck) {
|
||||
forgotcheckMins = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 含泪加上
|
||||
* 晚到晚走导致的早退1分钟特殊处理下,
|
||||
* 2024-02-28 上班时间是:2024-02-28 08:30:00,签到时间是:2024-02-28 08:34:26,晚到5分钟, 开启了晚到晚走,相对时间
|
||||
* 所以2024-02-28的上班时间和下班时间变化了,上班时间变成了:2024-02-28 08:35,下班时间变成了:2024-02-28 17:35
|
||||
* 现在签到是08:34:26,签退是17:34:48,导致早退1分钟
|
||||
*/
|
||||
if("1".equals(early_one_mins)){
|
||||
if (ruleDetail != null && ruleDetail.size() > 0) {//处理人性化设置其他规则
|
||||
earlyinearlyout = (List<Object>) ruleDetail.get("earlyinearlyout");
|
||||
lateinlateout = (List<Object>) ruleDetail.get("lateinlateout");
|
||||
}
|
||||
|
||||
String signInTime_Sec = (signInTime != null && signInTime.length() == 8) ? signInTime.substring(6, 8) : "";
|
||||
String signOutTime_Sec = (signOutTime != null && signOutTime.length() == 8) ? signOutTime.substring(6, 8) : "";
|
||||
writeLog("signInTime="+signInTime+",signInTime_Sec="+signInTime_Sec+",signOutTime="+signOutTime+",signOutTime_Sec="+signOutTime_Sec+",leaveEarlyMins="+leaveEarlyMins);
|
||||
// writeLog("leaveEarlyMins="+leaveEarlyMins+",lateinlateout="+JSONObject.toJSONString(lateinlateout));
|
||||
if (((lateinlateout != null && lateinlateout.size() > 0)||(earlyinearlyout != null && earlyinearlyout.size() > 0))
|
||||
&& leaveEarlyMins == 1) {
|
||||
if (signInTime_Sec.compareTo(signOutTime_Sec) <= 0) {
|
||||
leaveEarlyMins = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// writeLog("leaveEarlyMins="+leaveEarlyMins+",early_one_mins="+early_one_mins);
|
||||
|
||||
kqShiftRuleEntity.setBelatemins(beLateMins);
|
||||
kqShiftRuleEntity.setGravebelatemins(graveBeLateMins);
|
||||
kqShiftRuleEntity.setLeaveearlymins(leaveEarlyMins);
|
||||
kqShiftRuleEntity.setGraveleaveearlymins(graveLeaveEarlyMins);
|
||||
kqShiftRuleEntity.setAbsenteeismmins(absenteeismMins);
|
||||
kqShiftRuleEntity.setForgotcheckmins(forgotcheckMins);
|
||||
kqShiftRuleEntity.setForgotBeginWorkCheckMins(forgotBeginWorkCheckMins);
|
||||
}
|
||||
return kqShiftRuleEntity;
|
||||
}
|
||||
public int getEarlyInMins(String userId, String kqDate) {
|
||||
return getEarlyInMins(userId,kqDate,0);
|
||||
}
|
||||
|
||||
public int getEarlyInMins(String userId, String kqDate,int signoutOnlyoff) {
|
||||
int earlyInMins = 0;
|
||||
boolean oneSign = false;
|
||||
String preDate = DateUtil.addDate(kqDate, -1);//上一天日期
|
||||
String nextDate = DateUtil.addDate(kqDate, 1);//下一天日期
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId, kqDate);
|
||||
List<TimeScopeEntity> lsSignTime = new ArrayList<>();
|
||||
List<TimeScopeEntity> lsWorkTime = new ArrayList<>();
|
||||
if (workTime != null) {
|
||||
lsSignTime = workTime.getSignTime();//允许打卡时间
|
||||
lsWorkTime = workTime.getWorkTime();//工作时间
|
||||
oneSign = lsWorkTime != null && lsWorkTime.size() == 1;
|
||||
}
|
||||
|
||||
if (oneSign) {
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
TimeScopeEntity signTimeScope = lsSignTime.get(0);
|
||||
TimeScopeEntity workTimeScope = lsWorkTime.get(0);
|
||||
int workBeginIdx = kqTimesArrayComInfo.getArrayindexByTimes(workTimeScope.getBeginTime());
|
||||
|
||||
List<Object> lsCheckInfo = new KQFormatSignData().getSignInfo(userId, signTimeScope, workTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo
|
||||
,Lists.newArrayList(), "",0,0,signoutOnlyoff);
|
||||
for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) {
|
||||
Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(j);
|
||||
String signDate = Util.null2String(checkInfo.get("signDate"));
|
||||
String signTime = Util.null2String(checkInfo.get("signTime"));
|
||||
String deduct_signintime = Util.null2String(checkInfo.get("deduct_signintime"));
|
||||
if (checkInfo.get("signType").equals("1")) {//签到
|
||||
//有签到但是没有signTime是因为开启了流程抵扣打卡
|
||||
if (null == signTime || signTime.length() < 5) {
|
||||
continue;
|
||||
} else {
|
||||
writeLog("signDate:" + signDate + ",signTime=" + signTime + ",checkInfo=" + checkInfo.toString());
|
||||
}
|
||||
String signMinTime = signTime.substring(0, 5) + ":00";
|
||||
boolean signInWorkBeginTime = false;
|
||||
if (signTime.compareTo(signMinTime) > 0) {
|
||||
//如果签到时间是带秒的且是迟到,那么签到时间多一秒和多一分钟是一样的
|
||||
signInWorkBeginTime = true;
|
||||
}
|
||||
String signInTime = signTime;
|
||||
int signInTimeIndx = kqTimesArrayComInfo.getArrayindexByTimes(signInTime);
|
||||
String flow_signInTime = "";
|
||||
if (deduct_signintime.length() > 0) {
|
||||
if (signTime.length() > 0) {
|
||||
if (deduct_signintime.compareTo(signTime) < 0) {
|
||||
flow_signInTime = deduct_signintime;
|
||||
}
|
||||
} else {
|
||||
flow_signInTime = deduct_signintime;
|
||||
}
|
||||
}
|
||||
if (flow_signInTime.length() > 0) {
|
||||
signInTimeIndx = kqTimesArrayComInfo.getArrayindexByTimes(flow_signInTime);
|
||||
}
|
||||
if (kqDate.compareTo(signDate) < 0) signInTimeIndx += 1440;
|
||||
if (signInWorkBeginTime) {
|
||||
signInTimeIndx = signInTimeIndx + 1;
|
||||
}
|
||||
if (workBeginIdx > signInTimeIndx) {
|
||||
earlyInMins = workBeginIdx - signInTimeIndx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return earlyInMins;
|
||||
}
|
||||
|
||||
public int getLateOutMins(String userId, String kqDate) {
|
||||
return getLateOutMins(userId,kqDate,0);
|
||||
}
|
||||
|
||||
public int getLateOutMins(String userId, String kqDate,int signoutOnlyoff) {
|
||||
int lateOutMins = 0;
|
||||
boolean oneSign = false;
|
||||
String preDate = DateUtil.addDate(kqDate, -1);//上一天日期
|
||||
String nextDate = DateUtil.addDate(kqDate, 1);//下一天日期
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId, kqDate);
|
||||
List<TimeScopeEntity> lsSignTime = new ArrayList<>();
|
||||
List<TimeScopeEntity> lsWorkTime = new ArrayList<>();
|
||||
if (workTime != null) {
|
||||
lsSignTime = workTime.getSignTime();//允许打卡时间
|
||||
lsWorkTime = workTime.getWorkTime();//工作时间
|
||||
oneSign = lsWorkTime != null && lsWorkTime.size() == 1;
|
||||
}
|
||||
|
||||
if (oneSign) {
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
TimeScopeEntity signTimeScope = lsSignTime.get(0);
|
||||
TimeScopeEntity workTimeScope = lsWorkTime.get(0);
|
||||
int workEndIdx = kqTimesArrayComInfo.getArrayindexByTimes(workTimeScope.getEndTime());
|
||||
|
||||
List<Object> lsCheckInfo = new KQFormatSignData().getSignInfo(userId, signTimeScope, workTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo
|
||||
,Lists.newArrayList(), "",0,0,signoutOnlyoff);
|
||||
for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) {
|
||||
Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(j);
|
||||
String signDate = Util.null2String(checkInfo.get("signDate"));
|
||||
String signTime = Util.null2String(checkInfo.get("signTime"));
|
||||
String deduct_signofftime = Util.null2String(checkInfo.get("deduct_signofftime"));
|
||||
if (checkInfo.get("signType").equals("2")) {//签退
|
||||
String signOutTime = signTime;
|
||||
int signInTimeOutdx = kqTimesArrayComInfo.getArrayindexByTimes(signOutTime);
|
||||
String flow_signOutTime = signOutTime;
|
||||
if (deduct_signofftime.length() > 0) {
|
||||
if (signTime.length() > 0) {
|
||||
if (deduct_signofftime.compareTo(signTime) > 0) {
|
||||
flow_signOutTime = deduct_signofftime;
|
||||
}
|
||||
} else {
|
||||
flow_signOutTime = deduct_signofftime;
|
||||
}
|
||||
}
|
||||
if (flow_signOutTime.length() > 0) {
|
||||
signInTimeOutdx = kqTimesArrayComInfo.getArrayindexByTimes(flow_signOutTime);
|
||||
}
|
||||
if (kqDate.compareTo(signDate) < 0) signInTimeOutdx += 1440;
|
||||
if (signInTimeOutdx > workEndIdx) {
|
||||
lateOutMins = signInTimeOutdx - workEndIdx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return lateOutMins;
|
||||
}
|
||||
|
||||
public int getPreDayLateOutMins(String userId, String kqDate) {
|
||||
return getPreDayLateOutMins(userId, kqDate, Lists.newArrayList());
|
||||
}
|
||||
public int getPreDayLateOutMins(String userId, String kqDate, List<String> logList) {
|
||||
return getPreDayLateOutMins(userId, kqDate,logList,0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 前一天晚走分钟数
|
||||
*/
|
||||
public int getPreDayLateOutMins(String userId, String kqDate, List<String> logList,int signoutOnlyoff) {
|
||||
int preDayLateOutMins = 0;
|
||||
|
||||
boolean oneSign = false;
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
//前一天是非工作日,往前取到工作日
|
||||
String tmpKQPreDate = DateUtil.addDate(kqDate, -1);
|
||||
for (int i = 0; i < 31; i++) {
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId, tmpKQPreDate);
|
||||
if (workTime.getWorkMins() > 0) {
|
||||
kqDate = DateUtil.addDate(tmpKQPreDate, 1);
|
||||
break;
|
||||
}
|
||||
tmpKQPreDate = DateUtil.addDate(tmpKQPreDate, -1);
|
||||
}
|
||||
String kqPreDate = DateUtil.addDate(kqDate, -1);
|
||||
;
|
||||
String kqPrePreDate = DateUtil.addDate(kqDate, -2);
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId, kqPreDate);
|
||||
List<TimeScopeEntity> lsSignTime = new ArrayList<>();
|
||||
List<TimeScopeEntity> lsWorkTime = new ArrayList<>();
|
||||
if (workTime != null) {
|
||||
lsSignTime = workTime.getSignTime();//允许打卡时间
|
||||
lsWorkTime = workTime.getWorkTime();//工作时间
|
||||
oneSign = lsWorkTime != null && lsWorkTime.size() == 1;
|
||||
}
|
||||
|
||||
if (oneSign) {
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
TimeScopeEntity signTimeScope = lsSignTime.get(0);
|
||||
TimeScopeEntity workTimeScope = lsWorkTime.get(0);
|
||||
String signBeginDateTime = signTimeScope.getBeginTimeAcross() ? kqPrePreDate : kqPreDate;
|
||||
signBeginDateTime += " " + kqTimesArrayComInfo.turn48to24Time(signTimeScope.getBeginTime()) + ":00";
|
||||
String signEndDateTime = signTimeScope.getEndTimeAcross() ? kqDate : kqPreDate;
|
||||
signEndDateTime += " " + kqTimesArrayComInfo.turn48to24Time(signTimeScope.getEndTime()) + ":00";
|
||||
String workBeginDateTime = workTimeScope.getBeginTimeAcross() ? kqPrePreDate : kqPreDate;
|
||||
workBeginDateTime += " " + kqTimesArrayComInfo.turn48to24Time(workTimeScope.getBeginTime()) + ":00";
|
||||
String workEndDateTime = workTimeScope.getEndTimeAcross() ? kqDate : kqPreDate;
|
||||
workEndDateTime += " " + kqTimesArrayComInfo.turn48to24Time(workTimeScope.getEndTime()) + ":00";
|
||||
|
||||
Map<String, String> shifRuleMap = Maps.newHashMap();
|
||||
String shif_workEndTime = "";
|
||||
getPre_ShiftRuleInfo(kqPreDate, workTime, lsSignTime, lsWorkTime, userId, shifRuleMap, logList);
|
||||
if (!shifRuleMap.isEmpty()) {
|
||||
if (shifRuleMap.containsKey("shift_endworktime")) {
|
||||
String shift_endworktime = Util.null2String(shifRuleMap.get("shift_endworktime"));
|
||||
if (shift_endworktime.length() > 0) {
|
||||
shif_workEndTime = Util.null2String(shift_endworktime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Object> lsCheckInfo = new KQFormatSignData().getSignInfo(userId, signTimeScope, workTimeScope, kqPreDate, kqPrePreDate, kqDate, kqTimesArrayComInfo
|
||||
,Lists.newArrayList(), "",0,0,signoutOnlyoff);
|
||||
Map<String, Object> checkInfo = null;
|
||||
if (lsCheckInfo.size() == 2) {
|
||||
for (int i = 0; i < lsCheckInfo.size(); i++) {
|
||||
checkInfo = (Map<String, Object>) lsCheckInfo.get(i);
|
||||
String signType = Util.null2String(checkInfo.get("signType"));
|
||||
if ("2".equalsIgnoreCase(signType)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
String signDate = Util.null2String(checkInfo.get("signDate"));
|
||||
String signTime = Util.null2String(checkInfo.get("signTime"));
|
||||
String workEndTime = Util.null2String(workTimeScope.getEndTime());
|
||||
int workEndIdx = kqTimesArrayComInfo.getArrayindexByTimes(workEndTime);
|
||||
if (shif_workEndTime.length() > 0) {
|
||||
workEndIdx = kqTimesArrayComInfo.getArrayindexByTimes(shif_workEndTime);
|
||||
}
|
||||
if (!kqPreDate.equals(signDate)) { //跨天
|
||||
signTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}
|
||||
int signOutTimeIdx = kqTimesArrayComInfo.getArrayindexByTimes(signTime);
|
||||
if (signOutTimeIdx > workEndIdx) {
|
||||
preDayLateOutMins = signOutTimeIdx - workEndIdx;
|
||||
logList.add("签退时间是:" + (signDate + " " + kqTimesArrayComInfo.turn48to24Time(signTime)) + ",晚走了" + preDayLateOutMins + "分钟");
|
||||
}
|
||||
} else if (!lsCheckInfo.isEmpty()) {
|
||||
for (int i = 0; i < lsCheckInfo.size(); i++) {
|
||||
Map<String, Object> checkInfoMap = (Map<String, Object>) lsCheckInfo.get(i);
|
||||
String signType = Util.null2String(checkInfoMap.get("signType"));
|
||||
if ("2".equalsIgnoreCase(signType)) {
|
||||
String signDate = Util.null2String(checkInfoMap.get("signDate"));
|
||||
String signTime = Util.null2String(checkInfoMap.get("signTime"));
|
||||
String workEndTime = Util.null2String(workTimeScope.getEndTime());
|
||||
int workEndIdx = kqTimesArrayComInfo.getArrayindexByTimes(workEndTime);
|
||||
if (shif_workEndTime.length() > 0) {
|
||||
workEndIdx = kqTimesArrayComInfo.getArrayindexByTimes(shif_workEndTime);
|
||||
}
|
||||
if (!kqPreDate.equals(signDate)) { //跨天
|
||||
signTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}
|
||||
int signOutTimeIdx = kqTimesArrayComInfo.getArrayindexByTimes(signTime);
|
||||
if (signOutTimeIdx > workEndIdx) {
|
||||
preDayLateOutMins = signOutTimeIdx - workEndIdx;
|
||||
logList.add(",签退时间是:" + (signDate + " " + signTime) + ",晚走了" + preDayLateOutMins + "分钟");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return preDayLateOutMins;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取前一天的弹性时间
|
||||
*
|
||||
* @param kqPreDate
|
||||
* @param workTime
|
||||
* @param lsSignTime
|
||||
* @param lsWorkTime
|
||||
* @param userId
|
||||
* @param logList
|
||||
*/
|
||||
public void getPre_ShiftRuleInfo(String kqPreDate, WorkTimeEntity workTime,
|
||||
List<TimeScopeEntity> lsSignTime, List<TimeScopeEntity> lsWorkTime, String userId,
|
||||
Map<String, String> shifRuleMap, List<String> logList) {
|
||||
ShiftInfoBean shiftInfoBean = new ShiftInfoBean();
|
||||
shiftInfoBean.setSplitDate(kqPreDate);
|
||||
shiftInfoBean.setShiftRuleMap(workTime.getShiftRuleInfo());
|
||||
shiftInfoBean.setSignTime(lsSignTime);
|
||||
shiftInfoBean.setWorkTime(lsWorkTime);
|
||||
KQShiftRuleInfoBiz.getShiftRuleInfo(shiftInfoBean, userId, shifRuleMap, false, logList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班次设置里面的上下班不打卡数据
|
||||
*
|
||||
* @param i
|
||||
* @param serialId
|
||||
*/
|
||||
public Map<String, String> getModel_ShiftRule(int i, String serialId) {
|
||||
RecordSet rs = new RecordSet();
|
||||
HashMap<String, String> sectionMap = new HashMap<>();
|
||||
String getStartWorkSections = "select * from kq_ShiftOnOffWorkSections where SERIALID=? and record=? ";
|
||||
rs.executeQuery(getStartWorkSections, serialId, i);
|
||||
while (rs.next()) {
|
||||
String onoffworktype = Util.null2String(rs.getString("onoffworktype"));
|
||||
String clockinnot = Util.null2s(Util.null2String(rs.getString("clockinnot")), "0");
|
||||
sectionMap.put(onoffworktype, clockinnot);
|
||||
}
|
||||
return sectionMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,758 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum;
|
||||
import com.engine.kq.entity.TimeScopeEntity;
|
||||
import com.engine.kq.entity.TimeSignScopeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.UtilKQ;
|
||||
import com.engine.kq.wfset.util.KQSignUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 获取班次打卡数据
|
||||
*/
|
||||
public class KQFormatSignData extends BaseBean {
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public List<Object> getSignInfo(String userId, TimeScopeEntity signTimeScope,
|
||||
TimeScopeEntity workTimeScope, String kqDate, String preDate,
|
||||
String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo) {
|
||||
return getSignInfo(userId, signTimeScope, workTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo,
|
||||
Lists.newArrayList(), "");
|
||||
}
|
||||
|
||||
public List<Object> getSignInfo(String userId, TimeScopeEntity signTimeScope,
|
||||
TimeScopeEntity workTimeScope, String kqDate, String preDate,
|
||||
String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo, ArrayList<String> hostIps, String uuid) {
|
||||
return getSignInfo(userId, signTimeScope, workTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo, hostIps, uuid, 0, 0);
|
||||
}
|
||||
|
||||
public List<Object> getSignInfo(String userId, TimeScopeEntity signTimeScope,
|
||||
TimeScopeEntity workTimeScope, String kqDate, String preDate,
|
||||
String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo, ArrayList<String> hostIps, String uuid, int shiftCount, int shiftI) {
|
||||
return getSignInfo(userId, signTimeScope, workTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo, hostIps, uuid, shiftCount, shiftI, 0);
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取班次打卡数据
|
||||
* @param userId
|
||||
* @param signTimeScope
|
||||
* @param workTimeScope
|
||||
* @param kqDate
|
||||
* @param preDate
|
||||
* @param nextDate
|
||||
* @param kqTimesArrayComInfo
|
||||
* @return
|
||||
*/
|
||||
public List<Object> getSignInfo(String userId, TimeScopeEntity signTimeScope,
|
||||
TimeScopeEntity workTimeScope, String kqDate, String preDate,
|
||||
String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo, ArrayList<String> hostIps, String uuid, int shiftCount, int shiftI, int signoutOnlyoff) {
|
||||
kqLog.info("in getSignInfo ::userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid + " in ");
|
||||
List<Object> lsCheckInfo = new ArrayList<>();
|
||||
String count4NoonStartDateTime = "";
|
||||
String count4NoonEndDateTime = "";
|
||||
try {
|
||||
Map<String, Object> checkInfo = null;
|
||||
String base_sql = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
String dbtype = rs.getDBType();
|
||||
|
||||
//获取工作上下班时间
|
||||
String workBeginDateTime = workTimeScope.getBeginTimeAcross() ? nextDate : kqDate;
|
||||
workBeginDateTime += " " + kqTimesArrayComInfo.turn48to24Time(workTimeScope.getBeginTime()) + ":00";
|
||||
kqLog.info("in getSignInfo ::userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid + "::workBeginDateTime::" + workBeginDateTime);
|
||||
|
||||
//获取工作上下班时间
|
||||
String workEndDateTime = workTimeScope.getEndTimeAcross() ? nextDate : kqDate;
|
||||
workEndDateTime += " " + kqTimesArrayComInfo.turn48to24Time(workTimeScope.getEndTime()) + ":00";
|
||||
kqLog.info("in getSignInfo ::userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid + "::workEndDateTime::" + workEndDateTime);
|
||||
|
||||
Map<String, String> flow_deduct_card_map = getflowDeductCardSql(userId, kqDate, workTimeScope.getBeginTime(), workTimeScope.getEndTime());
|
||||
|
||||
kqLog.info("in getSignInfo ::userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid + "::flow_deduct_card_map::" + flow_deduct_card_map);
|
||||
kqLog.info("in getSignInfo ::userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid + "::signTimeScope::" + JSON.toJSONString(signTimeScope));
|
||||
|
||||
List<Map<String, String>> sqlConditions = getCanSignInfo(signTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo, workTimeScope, shiftCount, shiftI, signoutOnlyoff);
|
||||
base_sql = signSignSql(rs);
|
||||
new KQLog().info("sqlConditions:(userId:" + userId + ":base_sql" + base_sql + ":::userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid + "::flow_deduct_card_map::" + flow_deduct_card_map + "::sqlConditions::" + JSONObject.toJSONString(sqlConditions));
|
||||
if (sqlConditions != null && !sqlConditions.isEmpty()) {
|
||||
if (shiftCount == 2) {
|
||||
String fieldName = "";
|
||||
if (shiftI == 0) {
|
||||
fieldName = "signEndDateTime";
|
||||
} else if (shiftI == 1) {
|
||||
fieldName = "signBeginDateTime";
|
||||
}
|
||||
Map<String, String> sqlMap = sqlConditions.get(0);
|
||||
count4NoonStartDateTime = Util.null2String(sqlMap.get(fieldName));
|
||||
if (count4NoonStartDateTime.length() == 19) {
|
||||
count4NoonStartDateTime = count4NoonStartDateTime.substring(0, 17) + "00";
|
||||
}
|
||||
sqlMap = sqlConditions.get(0);
|
||||
count4NoonEndDateTime = Util.null2String(sqlMap.get(fieldName));
|
||||
if (sqlConditions.size() >= 2) {
|
||||
sqlMap = sqlConditions.get(1);
|
||||
count4NoonEndDateTime = Util.null2String(sqlMap.get(fieldName));
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasSignIn = false;
|
||||
for (Map<String, String> sqlMap : sqlConditions) {
|
||||
String sql = "";
|
||||
String orderSql = "";
|
||||
int idx = 0;
|
||||
String signBeginDateTime = Util.null2String(sqlMap.get("signBeginDateTime"));
|
||||
String signEndDateTime = Util.null2String(sqlMap.get("signEndDateTime"));
|
||||
String type = Util.null2String(sqlMap.get("type"));
|
||||
String signoutOnlyoff_flag = Util.null2String(sqlMap.get("signoutOnlyoff"));
|
||||
if (type.length() > 0) {
|
||||
if ("signoff".equalsIgnoreCase(type)) {
|
||||
orderSql = " order by signdate desc, signtime desc ";
|
||||
} else if ("signin".equalsIgnoreCase(type)) {
|
||||
orderSql = " order by signdate asc, signtime asc ";
|
||||
}
|
||||
if ("oracle".equalsIgnoreCase(dbtype)) {
|
||||
sql = "select * from (" + base_sql + " " + orderSql + ") a where rownum=1";
|
||||
} else if ("mysql".equalsIgnoreCase(dbtype)) {
|
||||
sql = "select * from (" + base_sql + " " + orderSql + ") a limit 0,1";
|
||||
} else if ("postgresql".equalsIgnoreCase(dbtype)) {
|
||||
sql = "select * from (" + base_sql + " " + orderSql + ") a limit 1 offset 0";
|
||||
} else if ("sqlserver".equalsIgnoreCase(dbtype)) {
|
||||
sql = "select top 1 * from (" + base_sql + ") a " + " " + orderSql;
|
||||
} else {
|
||||
sql = "select * from (" + base_sql + " " + orderSql + ") a where rownum=1";
|
||||
}
|
||||
} else {
|
||||
orderSql = " order by signdate asc, signtime asc ";
|
||||
sql = base_sql + " " + orderSql;
|
||||
}
|
||||
rs.executeQuery(sql, userId, signBeginDateTime, signEndDateTime);
|
||||
new KQLog().info("getSignInfo:(userId:" + userId + ":signBeginDateTime:" +
|
||||
signBeginDateTime + ":signEndDateTime:" + signEndDateTime + "):sql" + sql + ":counts:" + rs.getCounts() + ":::userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid + "::flow_deduct_card_map::" + flow_deduct_card_map);
|
||||
while (rs.next()) {
|
||||
String signId = Util.null2String(rs.getString("id"));
|
||||
String signdate = Util.null2String(rs.getString("signdate"));
|
||||
String signtime = Util.null2String(rs.getString("signtime"));
|
||||
|
||||
checkInfo = new HashMap<>();
|
||||
checkInfo.put("signId", signId);//签到签退标识
|
||||
checkInfo.put("signDate", signdate);//签到签退日期
|
||||
checkInfo.put("signTime", signtime);//签到签退时间
|
||||
String signDateTime = signdate + " " + signtime;
|
||||
idx++;
|
||||
if (type.length() > 0) {
|
||||
if ("signin".equalsIgnoreCase(type)) {
|
||||
checkInfo.put("signType", "1");
|
||||
if (workBeginDateTime.length() > 0) {
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("1", signDateTime, workBeginDateTime));
|
||||
}
|
||||
if (!Util.null2String(checkInfo.get("signStatus")).equalsIgnoreCase(ButtonStatusEnum.NORMAL.getStatusCode())) {
|
||||
if (flow_deduct_card_map.containsKey("signin")) {
|
||||
String deduct_signintime = Util.null2String(flow_deduct_card_map.get("signin"));
|
||||
if (deduct_signintime.length() > 0) {
|
||||
signDateTime = signdate + " " + deduct_signintime;
|
||||
checkInfo.put("deduct_signintime", deduct_signintime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("1", signDateTime, workBeginDateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
lsCheckInfo.add(checkInfo);
|
||||
} else {
|
||||
checkInfo.put("signType", "2");
|
||||
if (workEndDateTime.length() > 0) {
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("2", signDateTime, workEndDateTime));
|
||||
}
|
||||
if (!Util.null2String(checkInfo.get("signStatus")).equalsIgnoreCase(ButtonStatusEnum.NORMAL.getStatusCode())) {
|
||||
if (flow_deduct_card_map.containsKey("signoff")) {
|
||||
String deduct_signofftime = Util.null2String(flow_deduct_card_map.get("signoff"));
|
||||
if (deduct_signofftime.length() > 0) {
|
||||
signDateTime = signdate + " " + deduct_signofftime;
|
||||
checkInfo.put("deduct_signofftime", deduct_signofftime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("2", signDateTime, workEndDateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
} else {
|
||||
if (signoutOnlyoff_flag.length()>0) {
|
||||
if("signin".equals(signoutOnlyoff_flag) && idx == 1){
|
||||
checkInfo.put("signType", "1");
|
||||
if (workBeginDateTime.length() > 0) {
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("1", signDateTime, workBeginDateTime));
|
||||
}
|
||||
if (!Util.null2String(checkInfo.get("signStatus")).equalsIgnoreCase(ButtonStatusEnum.NORMAL.getStatusCode())) {
|
||||
if (flow_deduct_card_map.containsKey("signin")) {
|
||||
String deduct_signintime = Util.null2String(flow_deduct_card_map.get("signin"));
|
||||
if (deduct_signintime.length() > 0) {
|
||||
signDateTime = signdate + " " + deduct_signintime;
|
||||
checkInfo.put("deduct_signintime", deduct_signintime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("1", signDateTime, workBeginDateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
lsCheckInfo.add(checkInfo);
|
||||
hasSignIn = true;
|
||||
}
|
||||
if("signoff".equals(signoutOnlyoff_flag)){
|
||||
if ((hasSignIn && idx == rs.getCounts() && idx > 1) || (!hasSignIn && idx == rs.getCounts())) {//第一条可能是签到卡需要处理下,否则可能会导致一条上班卡同时识别为上班卡和下班卡
|
||||
checkInfo.put("signType", "2");
|
||||
if (workEndDateTime.length() > 0) {
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("2", signDateTime, workEndDateTime));
|
||||
}
|
||||
if (!Util.null2String(checkInfo.get("signStatus")).equalsIgnoreCase(ButtonStatusEnum.NORMAL.getStatusCode())) {
|
||||
if (flow_deduct_card_map.containsKey("signoff")) {
|
||||
String deduct_signofftime = Util.null2String(flow_deduct_card_map.get("signoff"));
|
||||
if (deduct_signofftime.length() > 0) {
|
||||
signDateTime = signdate + " " + deduct_signofftime;
|
||||
checkInfo.put("deduct_signofftime", deduct_signofftime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("2", signDateTime, workEndDateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (idx == 1) {//第一条算签到
|
||||
checkInfo.put("signType", "1");
|
||||
if (workBeginDateTime.length() > 0) {
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("1", signDateTime, workBeginDateTime));
|
||||
}
|
||||
if (!Util.null2String(checkInfo.get("signStatus")).equalsIgnoreCase(ButtonStatusEnum.NORMAL.getStatusCode())) {
|
||||
if (flow_deduct_card_map.containsKey("signin")) {
|
||||
String deduct_signintime = Util.null2String(flow_deduct_card_map.get("signin"));
|
||||
if (deduct_signintime.length() > 0) {
|
||||
signDateTime = signdate + " " + deduct_signintime;
|
||||
checkInfo.put("deduct_signintime", deduct_signintime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("1", signDateTime, workBeginDateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
lsCheckInfo.add(checkInfo);
|
||||
hasSignIn = true;
|
||||
} else if (idx == rs.getCounts()) {//最后一条算签退
|
||||
checkInfo.put("signType", "2");
|
||||
if (workEndDateTime.length() > 0) {
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("2", signDateTime, workEndDateTime));
|
||||
}
|
||||
if (!Util.null2String(checkInfo.get("signStatus")).equalsIgnoreCase(ButtonStatusEnum.NORMAL.getStatusCode())) {
|
||||
if (flow_deduct_card_map.containsKey("signoff")) {
|
||||
String deduct_signofftime = Util.null2String(flow_deduct_card_map.get("signoff"));
|
||||
if (deduct_signofftime.length() > 0) {
|
||||
signDateTime = signdate + " " + deduct_signofftime;
|
||||
checkInfo.put("deduct_signofftime", deduct_signofftime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("2", signDateTime, workEndDateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//如果签到,签退不成对,流程抵扣异常存在,那么需要判断下是不是可以补足
|
||||
if (lsCheckInfo.size() < 2 && !flow_deduct_card_map.isEmpty()) {
|
||||
if (lsCheckInfo.isEmpty()) {
|
||||
if (flow_deduct_card_map.containsKey("signin")) {
|
||||
String deduct_signintime = Util.null2String(flow_deduct_card_map.get("signin"));
|
||||
if (deduct_signintime.length() > 0) {
|
||||
checkInfo = new HashMap<>();
|
||||
String[] workBeginDateTimes = workBeginDateTime.split(" ");
|
||||
String tmp_workBeginDate = workBeginDateTimes[0];
|
||||
String tmp_workBeginTime = workBeginDateTimes[1];
|
||||
checkInfo.put("signType", "1");
|
||||
checkInfo.put("signDate", tmp_workBeginDate);//签到签退日期
|
||||
checkInfo.put("signTime", "");//签到签退时间
|
||||
checkInfo.put("deduct_signintime", tmp_workBeginTime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
if (flow_deduct_card_map.containsKey("signoff")) {
|
||||
String deduct_signofftime = Util.null2String(flow_deduct_card_map.get("signoff"));
|
||||
if (deduct_signofftime.length() > 0) {
|
||||
checkInfo = new HashMap<>();
|
||||
String[] workEndDateTimes = workEndDateTime.split(" ");
|
||||
String tmp_workEndDate = workEndDateTimes[0];
|
||||
String tmp_workEndTime = workEndDateTimes[1];
|
||||
checkInfo.put("signType", "2");
|
||||
checkInfo.put("signDate", tmp_workEndDate);//签到签退日期
|
||||
checkInfo.put("signTime", "");//签到签退时间
|
||||
checkInfo.put("deduct_signofftime", tmp_workEndTime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Map<String, Object> checkCardMap = (Map<String, Object>) lsCheckInfo.get(0);
|
||||
if (!checkCardMap.isEmpty()) {
|
||||
String signType = Util.null2String(checkCardMap.get("signType"));
|
||||
if ("1".equalsIgnoreCase(signType)) {
|
||||
//如果签到数据有了,检测下是不是有签退的流程抵扣打卡
|
||||
if (flow_deduct_card_map.containsKey("signoff")) {
|
||||
String deduct_signofftime = Util.null2String(flow_deduct_card_map.get("signoff"));
|
||||
if (deduct_signofftime.length() > 0) {
|
||||
checkInfo = new HashMap<>();
|
||||
String[] workEndDateTimes = workEndDateTime.split(" ");
|
||||
String tmp_workEndDate = workEndDateTimes[0];
|
||||
String tmp_workEndTime = workEndDateTimes[1];
|
||||
checkInfo.put("signType", "2");
|
||||
checkInfo.put("signDate", tmp_workEndDate);//签到签退日期
|
||||
checkInfo.put("signTime", "");//签到签退时间
|
||||
checkInfo.put("deduct_signofftime", tmp_workEndTime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (flow_deduct_card_map.containsKey("signin")) {
|
||||
String deduct_signintime = Util.null2String(flow_deduct_card_map.get("signin"));
|
||||
if (deduct_signintime.length() > 0) {
|
||||
checkInfo = new HashMap<>();
|
||||
String[] workBeginDateTimes = workBeginDateTime.split(" ");
|
||||
String tmp_workBeginDate = workBeginDateTimes[0];
|
||||
String tmp_workBeginTime = workBeginDateTimes[1];
|
||||
checkInfo.put("signType", "1");
|
||||
checkInfo.put("signDate", tmp_workBeginDate);//签到签退日期
|
||||
checkInfo.put("signTime", "");//签到签退时间
|
||||
checkInfo.put("deduct_signintime", tmp_workBeginTime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 上午的签退取中间时段的第一次打卡
|
||||
if (shiftCount == 2 && shiftI == 0) {
|
||||
String noonSignTimeSql = KQSignUtil.buildSignSql(count4NoonStartDateTime, count4NoonEndDateTime);
|
||||
String baseSql = "select * from hrmschedulesign where 1=1 and isInCom='1' and userid=" + userId + " ";
|
||||
String sql = baseSql;
|
||||
sql += " and " + noonSignTimeSql + " order by signdate, signtime";
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()) {
|
||||
String signId = Util.null2String(rs.getString("id"));
|
||||
String signDate = Util.null2String(rs.getString("signdate"));
|
||||
String signTime = Util.null2String(rs.getString("signtime"));
|
||||
String signDateTime = signDate + " " + signTime;
|
||||
for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) {
|
||||
Map<String, Object> checkInfoInner = (Map<String, Object>) lsCheckInfo.get(j);
|
||||
if (checkInfoInner.get("signType").equals("2")) {//签退
|
||||
String signDateInner = Util.null2String(checkInfoInner.get("signDate"));
|
||||
String signTimeInner = Util.null2String(checkInfoInner.get("signTime"));
|
||||
String deduct_signofftime = Util.null2String(checkInfoInner.get("deduct_signofftime"));
|
||||
if (!"".equals(signTimeInner)) {
|
||||
String signDateTimeInner = signDateInner + " " + signTimeInner;
|
||||
if (signDateTime.compareTo(signDateTimeInner) < 0) {
|
||||
checkInfoInner.put("signId", signId);//签到签退标识
|
||||
checkInfoInner.put("signType", "2");
|
||||
checkInfoInner.put("signDate", signDateInner);//签到签退日期
|
||||
checkInfoInner.put("signTime", signTime);//签到签退时间
|
||||
checkInfoInner.put("deduct_signofftime", deduct_signofftime);//流程抵扣作为打卡时间
|
||||
checkInfoInner.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (shiftCount == 2 && shiftI == 1) { // 下午的签到取中间时段的第二次打卡
|
||||
String noonSignTimeSql = KQSignUtil.buildSignSql(count4NoonStartDateTime, count4NoonEndDateTime);
|
||||
String baseSql = "select * from hrmschedulesign where 1=1 and isInCom='1' and userid=" + userId + " ";
|
||||
String sql = baseSql;
|
||||
sql += " and " + noonSignTimeSql + " order by signdate, signtime";
|
||||
rs.executeQuery(sql);
|
||||
int count = 0;
|
||||
int counts = rs.getCounts();
|
||||
if (counts == 1) {
|
||||
lsCheckInfo.clear();
|
||||
}
|
||||
while (rs.next()) {
|
||||
if (count == 0) {
|
||||
count++;
|
||||
continue;
|
||||
}
|
||||
String signId = Util.null2String(rs.getString("id"));
|
||||
String signTime = Util.null2String(rs.getString("signtime"));
|
||||
for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) {
|
||||
Map<String, Object> checkInfoInner = (Map<String, Object>) lsCheckInfo.get(j);
|
||||
if (checkInfoInner.get("signType").equals("1")) {//签退
|
||||
String signDateInner = Util.null2String(checkInfoInner.get("signDate"));
|
||||
String signTimeInner = Util.null2String(checkInfoInner.get("signTime"));
|
||||
String deduct_signofftime = Util.null2String(checkInfoInner.get("deduct_signofftime"));
|
||||
checkInfoInner.put("signId", signId);//签到签退标识
|
||||
checkInfoInner.put("signType", "1");
|
||||
checkInfoInner.put("signDate", signDateInner);//签到签退日期
|
||||
checkInfoInner.put("signTime", signTime);//签到签退时间
|
||||
checkInfoInner.put("deduct_signofftime", deduct_signofftime);//流程抵扣作为打卡时间
|
||||
checkInfoInner.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
kqLog.info("报表错:getSignInfo:");
|
||||
StringWriter errorsWriter = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(errorsWriter));
|
||||
kqLog.info(errorsWriter.toString());
|
||||
}
|
||||
|
||||
//writeLog(sql,userId +"=="+ signBeginDateTime+"=="+signEndDateTime);
|
||||
return lsCheckInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据上下班时间获取到是否有流程抵扣打卡的数据
|
||||
*
|
||||
* @param userId
|
||||
* @param kqDate
|
||||
* @param workBeginDateTime
|
||||
* @param workEndDateTime
|
||||
*/
|
||||
public Map<String, String> getflowDeductCardSql(String userId, String kqDate, String workBeginDateTime, String workEndDateTime) {
|
||||
Map<String, String> flow_deduct_card_map = new HashMap<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String flow_deduct_card_sql = "select * from kq_flow_deduct_card where 1=1 and (isclear is null or isclear<>1) ";
|
||||
if (userId.length() > 0) {
|
||||
flow_deduct_card_sql += " and resourceid=" + userId;
|
||||
}
|
||||
if (kqDate.length() > 0) {
|
||||
flow_deduct_card_sql += " and belongDate='" + kqDate + "'";
|
||||
}
|
||||
if (workBeginDateTime.length() > 0) {
|
||||
flow_deduct_card_sql += " and workBeginTime='" + workBeginDateTime + "'";
|
||||
}
|
||||
if (workEndDateTime.length() > 0) {
|
||||
flow_deduct_card_sql += " and workEndTime='" + workEndDateTime + "'";
|
||||
}
|
||||
rs.executeQuery(flow_deduct_card_sql);
|
||||
while (rs.next()) {
|
||||
String signtype = rs.getString("signtype");
|
||||
if ("1".equalsIgnoreCase(signtype)) {
|
||||
flow_deduct_card_map.put("signin", workBeginDateTime);
|
||||
}
|
||||
if ("2".equalsIgnoreCase(signtype)) {
|
||||
flow_deduct_card_map.put("signoff", workEndDateTime);
|
||||
}
|
||||
}
|
||||
return flow_deduct_card_map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据打卡的范围生成上班,下班数据获取的sql
|
||||
*
|
||||
* @param signTimeScope
|
||||
* @param kqDate
|
||||
* @param preDate
|
||||
* @param nextDate
|
||||
* @param kqTimesArrayComInfo
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, String>> getCanSignInfo(TimeScopeEntity signTimeScope, String kqDate, String preDate, String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo) {
|
||||
return getCanSignInfo(signTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo, null);
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getCanSignInfo(TimeScopeEntity signTimeScope, String kqDate, String preDate, String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo,TimeScopeEntity workTimeScope,int signoutOnlyoff) {
|
||||
return getCanSignInfo(signTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo, workTimeScope, 0, 0, signoutOnlyoff);
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getCanSignInfo(TimeScopeEntity signTimeScope, String kqDate, String preDate, String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo, TimeScopeEntity workTimeScope) {
|
||||
return getCanSignInfo(signTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo, workTimeScope, 0, 0);
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getCanSignInfo(TimeScopeEntity signTimeScope, String kqDate, String preDate, String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo, TimeScopeEntity workTimeScope, int shiftCount, int shiftI) {
|
||||
return getCanSignInfo(signTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo, workTimeScope, shiftCount, shiftI, 0);
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getCanSignInfo(TimeScopeEntity signTimeScope, String kqDate, String preDate, String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo, TimeScopeEntity workTimeScope, int shiftCount, int shiftI, int signoutOnlyoff) {
|
||||
|
||||
List<Map<String, String>> sqlConditions = new ArrayList<>();
|
||||
Map<String, String> conditionMap = new HashMap<>();
|
||||
|
||||
TimeSignScopeEntity timeSignScopeEntity = signTimeScope.getTimeSignScopeEntity();
|
||||
|
||||
String signBeginDateTime = "";
|
||||
String signEndDateTime = "";
|
||||
signBeginDateTime = signTimeScope.getBeginTimeAcross() ? nextDate : kqDate;
|
||||
if (signTimeScope.isBeginTimePreAcross()) {
|
||||
signBeginDateTime = preDate;
|
||||
}
|
||||
signBeginDateTime += " " + kqTimesArrayComInfo.turn48to24Time(signTimeScope.getBeginTime()) + ":00";
|
||||
|
||||
signEndDateTime = signTimeScope.getEndTimeAcross() ? nextDate : kqDate;
|
||||
|
||||
// if (workTimeScope != null && workTimeScope.getEndTimeAcross() && signTimeScope.getEndTimeAcross() ) {
|
||||
// if(workTimeScope.getEndTime().compareTo(signTimeScope.getEndTime())>=0){
|
||||
// signEndDateTime = DateUtil.addDate(kqDate, 2);//下下一天日期;
|
||||
// }
|
||||
// }
|
||||
signEndDateTime += " " + kqTimesArrayComInfo.turn48to24Time(signTimeScope.getEndTime()) + ":59";
|
||||
|
||||
|
||||
if (timeSignScopeEntity == null) {
|
||||
//没有设置 签到最晚时间和签退最早时间,比如是09:00-18:00,打卡范围是【08:00---19:00】
|
||||
if (signoutOnlyoff == 1 && workTimeScope != null) {//开启了下班后只能签退的按钮,那么考勤格式化的打卡数据查询范围也搞一下
|
||||
String signBeginDateEndTime = "";
|
||||
String signEndDateStartTime = "";
|
||||
String workEndTime = workTimeScope.getEndTime();
|
||||
boolean workEndTimeAcross = workTimeScope.getEndTimeAcross();
|
||||
|
||||
String workEndTimeNew = kqTimesArrayComInfo.getTimesByArrayindex(kqTimesArrayComInfo.getArrayindexByTimes(workEndTime) - 1);//17:59
|
||||
signBeginDateEndTime = workEndTimeAcross ? nextDate : kqDate;
|
||||
signBeginDateEndTime += " " + kqTimesArrayComInfo.turn48to24Time(workEndTimeNew) + ":59";//17:59:59
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signBeginDateTime);//08:00:00
|
||||
conditionMap.put("signEndDateTime", signBeginDateEndTime);//17:59:59
|
||||
// conditionMap.put("type", "signin");
|
||||
conditionMap.put("signoutOnlyoff", "signin");
|
||||
sqlConditions.add(conditionMap);
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signBeginDateTime);//08:00:00,这里为什么从上班开始打卡时间起算,因为存在上班有打卡,连续打卡的情况,那么需要将除上班卡之后的打卡都识别为下班卡
|
||||
conditionMap.put("signEndDateTime", signEndDateTime);//19:00:59
|
||||
//这里不能传type=signoff,否则上班打卡可能会同时识别为上班卡和下班卡
|
||||
conditionMap.put("signoutOnlyoff", "signoff");
|
||||
sqlConditions.add(conditionMap);
|
||||
|
||||
} else {//走标准原逻辑
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signBeginDateTime);
|
||||
conditionMap.put("signEndDateTime", signEndDateTime);
|
||||
sqlConditions.add(conditionMap);
|
||||
}
|
||||
|
||||
} else {
|
||||
String beginTimeEnd = timeSignScopeEntity.getBeginTimeEnd();
|
||||
boolean beginTimeEndAcross = timeSignScopeEntity.isBeginTimeEndAcross();
|
||||
|
||||
String endTimeStart = timeSignScopeEntity.getEndTimeStart();
|
||||
boolean endTimeStartAcross = timeSignScopeEntity.isEndTimeStartAcross();
|
||||
|
||||
if (beginTimeEnd.length() > 0) {
|
||||
//如果设置了 上班结束时间
|
||||
if (endTimeStart.length() > 0) {
|
||||
//设置了下班开始时间
|
||||
String signBeginDateEndTime = "";
|
||||
String signEndDateStartTime = "";
|
||||
signBeginDateEndTime = beginTimeEndAcross ? nextDate : kqDate;
|
||||
signBeginDateEndTime += " " + kqTimesArrayComInfo.turn48to24Time(beginTimeEnd) + ":59";
|
||||
|
||||
//张总表示设了打卡归属,以设置的为准,这个开关相当于不起作用,代码含泪注释
|
||||
// if(signoutOnlyoff == 1 && workTimeScope != null){//开启了下班后只能签退的按钮,那么考勤格式化的打卡数据查询范围也搞一下
|
||||
// String workEndTime = workTimeScope.getEndTime();
|
||||
// boolean workEndTimeAcross = workTimeScope.getEndTimeAcross();
|
||||
// signBeginDateEndTime = workEndTimeAcross ? nextDate : kqDate;
|
||||
// signBeginDateEndTime+=" "+kqTimesArrayComInfo.turn48to24Time(workEndTime)+":59";
|
||||
// conditionMap = new HashMap<>();
|
||||
// conditionMap.put("signBeginDateTime", signBeginDateTime);
|
||||
// conditionMap.put("signEndDateTime", signBeginDateEndTime);
|
||||
// conditionMap.put("type", "signin");
|
||||
// sqlConditions.add(conditionMap);
|
||||
//
|
||||
// conditionMap = new HashMap<>();
|
||||
// conditionMap.put("signBeginDateTime", signBeginDateEndTime);
|
||||
// conditionMap.put("signEndDateTime", signEndDateTime);
|
||||
// conditionMap.put("type", "signoff");
|
||||
// sqlConditions.add(conditionMap);
|
||||
//
|
||||
// }else{
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signBeginDateTime);
|
||||
conditionMap.put("signEndDateTime", signBeginDateEndTime);
|
||||
conditionMap.put("type", "signin");
|
||||
sqlConditions.add(conditionMap);
|
||||
|
||||
signEndDateStartTime = endTimeStartAcross ? nextDate : kqDate;
|
||||
signEndDateStartTime += " " + kqTimesArrayComInfo.turn48to24Time(endTimeStart) + ":00";
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signEndDateStartTime);
|
||||
conditionMap.put("signEndDateTime", signEndDateTime);
|
||||
conditionMap.put("type", "signoff");
|
||||
sqlConditions.add(conditionMap);
|
||||
// }
|
||||
} else {
|
||||
//没有设置下班开始时间
|
||||
String signBeginDateEndTime = "";
|
||||
String signEndDateStartTime = "";
|
||||
signBeginDateEndTime = beginTimeEndAcross ? nextDate : kqDate;
|
||||
signBeginDateEndTime += " " + kqTimesArrayComInfo.turn48to24Time(beginTimeEnd) + ":59";
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signBeginDateTime);
|
||||
conditionMap.put("signEndDateTime", signBeginDateEndTime);
|
||||
conditionMap.put("type", "signin");
|
||||
sqlConditions.add(conditionMap);
|
||||
|
||||
//如果设置了上班结束时间,相当于下班开始时间也被限定了
|
||||
String endTimeByBeginTime = kqTimesArrayComInfo.getTimesByArrayindex(kqTimesArrayComInfo.getArrayindexByTimes(beginTimeEnd) + 1);
|
||||
signEndDateStartTime = beginTimeEndAcross ? nextDate : kqDate;
|
||||
signEndDateStartTime += " " + kqTimesArrayComInfo.turn48to24Time(endTimeByBeginTime) + ":00";
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signEndDateStartTime);
|
||||
conditionMap.put("signEndDateTime", signEndDateTime);
|
||||
conditionMap.put("type", "signoff");
|
||||
sqlConditions.add(conditionMap);
|
||||
}
|
||||
} else if (endTimeStart.length() > 0) {
|
||||
//如果没有设置上班结束时间,设置了下班开始时间
|
||||
String signBeginDateEndTime = "";
|
||||
String signEndDateStartTime = "";
|
||||
|
||||
//如果设置了下班开始时间,相当于上班结束时间也被限定了
|
||||
String BeginTimeByendTime = kqTimesArrayComInfo.getTimesByArrayindex(kqTimesArrayComInfo.getArrayindexByTimes(endTimeStart) - 1);
|
||||
signBeginDateEndTime = endTimeStartAcross ? nextDate : kqDate;
|
||||
signBeginDateEndTime += " " + kqTimesArrayComInfo.turn48to24Time(BeginTimeByendTime) + ":59";
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signBeginDateTime);
|
||||
conditionMap.put("signEndDateTime", signBeginDateEndTime);
|
||||
conditionMap.put("type", "signin");
|
||||
sqlConditions.add(conditionMap);
|
||||
|
||||
signEndDateStartTime = endTimeStartAcross ? nextDate : kqDate;
|
||||
signEndDateStartTime += " " + kqTimesArrayComInfo.turn48to24Time(endTimeStart) + ":00";
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signEndDateStartTime);
|
||||
conditionMap.put("signEndDateTime", signEndDateTime);
|
||||
conditionMap.put("type", "signoff");
|
||||
sqlConditions.add(conditionMap);
|
||||
}
|
||||
}
|
||||
return sqlConditions;
|
||||
}
|
||||
|
||||
public String signSignSql(RecordSet rs) {
|
||||
String sql = "";
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select id,signdate,signtime from hrmschedulesign where isincom=1 and userid = ? and signdate||' '||signtime >= ? and signdate||' '||signtime <= ? " +
|
||||
" ";
|
||||
} else if ("sqlserver".equals(rs.getDBType())) {
|
||||
sql = " select id,signdate,signtime from hrmschedulesign where isincom=1 and userid = ? and signdate + ' ' + signtime >= ? and signdate + ' ' + signtime <= ? " +
|
||||
" ";
|
||||
} else {
|
||||
sql = " select id,signdate,signtime from hrmschedulesign where isincom=1 and userid = ? and concat(signdate,' ',signtime) >= ? and concat(signdate,' ',signtime) <= ? " +
|
||||
" ";
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
|
||||
public List<Object> getSignInfoForAll(String userId, String signBeginDateTime, String signEndDateTime, String workBeginDateTime, String workEndDateTime) {
|
||||
List<Object> lsCheckInfo = new ArrayList<>();
|
||||
Map<String, Object> checkInfo = null;
|
||||
String sql = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
int idx = 0;
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select id,signdate,signtime from hrmschedulesign where isincom=1 and userid = ? and signdate||' '||signtime >= ? and signdate||' '||signtime <= ? " +
|
||||
" order by signdate asc, signtime asc ";
|
||||
} else if ("sqlserver".equals(rs.getDBType())) {
|
||||
sql = " select id,signdate,signtime from hrmschedulesign where isincom=1 and userid = ? and signdate + ' ' + signtime >= ? and signdate + ' ' + signtime <= ? " +
|
||||
" order by signdate asc, signtime asc ";
|
||||
} else {
|
||||
sql = " select id,signdate,signtime from hrmschedulesign where isincom=1 and userid = ? and concat(signdate,' ',signtime) >= ? and concat(signdate,' ',signtime) <= ? " +
|
||||
" order by signdate asc, signtime asc ";
|
||||
}
|
||||
rs.executeQuery(sql, userId, signBeginDateTime, signEndDateTime);
|
||||
//writeLog(sql,userId +"=="+ signBeginDateTime+"=="+signEndDateTime);
|
||||
while (rs.next()) {
|
||||
String signId = Util.null2String(rs.getString("id"));
|
||||
String signdate = Util.null2String(rs.getString("signdate"));
|
||||
String signtime = Util.null2String(rs.getString("signtime"));
|
||||
|
||||
checkInfo = new HashMap<>();
|
||||
checkInfo.put("signId", signId);//签到签退标识
|
||||
checkInfo.put("signDate", signdate);//签到签退日期
|
||||
checkInfo.put("signTime", signtime);//签到签退时间
|
||||
String signDateTime = signdate + " " + signtime;
|
||||
|
||||
idx++;
|
||||
if (idx % 2 == 1) {
|
||||
checkInfo.put("signType", "1");
|
||||
} else {
|
||||
checkInfo.put("signType", "2");
|
||||
}
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
return lsCheckInfo;
|
||||
}
|
||||
|
||||
public List<Object> getNonWorkSignInfo(String userId, String preDate, String kqDate,
|
||||
List<TimeScopeEntity> pre_lsSignTime,
|
||||
List<TimeScopeEntity> next_lsSignTime) {
|
||||
List<Object> lsCheckInfo = new ArrayList<>();
|
||||
Map<String, Object> checkInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String pre_Worktime4Today = "";
|
||||
if (!pre_lsSignTime.isEmpty()) {
|
||||
TimeScopeEntity pre_signTimeScope = pre_lsSignTime.get(pre_lsSignTime.size() - 1);
|
||||
if (pre_signTimeScope.getEndTimeAcross()) {
|
||||
pre_Worktime4Today = pre_signTimeScope.getEndTime();
|
||||
}
|
||||
}
|
||||
String next_Worktime4Today = "";
|
||||
if (!next_lsSignTime.isEmpty()) {
|
||||
TimeScopeEntity next_signTimeScope = next_lsSignTime.get(next_lsSignTime.size() - 1);
|
||||
if (next_signTimeScope.isBeginTimePreAcross()) {
|
||||
next_Worktime4Today = next_signTimeScope.getBeginTime();
|
||||
}
|
||||
}
|
||||
String sql = "select * from hrmschedulesign where userid=" + userId + " and signdate = '" + kqDate + "' ";
|
||||
if (pre_Worktime4Today.length() > 0) {
|
||||
if (pre_Worktime4Today.length() == 5) {
|
||||
pre_Worktime4Today += ":59";
|
||||
}
|
||||
sql += " and signtime > '" + pre_Worktime4Today + "'";
|
||||
}
|
||||
if (next_Worktime4Today.length() > 0) {
|
||||
if (next_Worktime4Today.length() == 5) {
|
||||
next_Worktime4Today += ":00";
|
||||
}
|
||||
sql += " and signtime < '" + next_Worktime4Today + "'";
|
||||
}
|
||||
sql += " order by signdate asc,signtime asc ";
|
||||
rs.executeQuery(sql);
|
||||
int idx = 0;
|
||||
while (rs.next()) {
|
||||
String signId = Util.null2String(rs.getString("id"));
|
||||
String signdate = Util.null2String(rs.getString("signdate"));
|
||||
String signtime = Util.null2String(rs.getString("signtime"));
|
||||
|
||||
checkInfo = new HashMap<>();
|
||||
checkInfo.put("signId", signId);//签到签退标识
|
||||
checkInfo.put("signDate", signdate);//签到签退日期
|
||||
checkInfo.put("signTime", signtime);//签到签退时间
|
||||
idx++;
|
||||
if (idx == 1) {//第一条算签到
|
||||
checkInfo.put("signType", "1");
|
||||
lsCheckInfo.add(checkInfo);
|
||||
} else if (idx == rs.getCounts()) {//最后一条算签退
|
||||
checkInfo.put("signType", "2");
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
return lsCheckInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.engine.kq.log.KQLog;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
public class KQFormatThread extends com.weaver.util.threadPool.entity.LocalRunnable {
|
||||
private String id;
|
||||
private String resourceid;
|
||||
private String kqdate;
|
||||
|
||||
private int formatType;
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
RecordSet rs = new RecordSet();
|
||||
//更新已处理的记录
|
||||
String key = this.kqdate+ "|"+ this.resourceid;
|
||||
try {
|
||||
kqLog.info("执行KQFormatThread this.resourceid=="+this.resourceid+"this.kqdate=="+this.kqdate);
|
||||
KQFormatData kqFormatData = new KQFormatData();
|
||||
//-1: 其他; 11:右键重新计算考勤数据; 12: 考勤自动和手动同步;13:钉钉同步或者导入; 14:云桥考勤同步 15: 考勤导入;16:排班更新
|
||||
//打卡数据这些要更新,11和16不能更新,
|
||||
kqFormatData.formatKqDateByLock(this.resourceid, this.kqdate,this.formatType);
|
||||
|
||||
boolean isremove = KQFormatJob.kqformatIds.remove(key);
|
||||
if(isremove){
|
||||
rs.executeUpdate("update kq_format_pool set status=1 where id=?",this.id);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
KQFormatJob.kqformatIds.remove(key);
|
||||
kqLog.info(e);
|
||||
writeLog(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getResourceid() {
|
||||
return resourceid;
|
||||
}
|
||||
|
||||
public void setResourceid(String resourceid) {
|
||||
this.resourceid = resourceid;
|
||||
}
|
||||
public int getFormatType() {
|
||||
return formatType;
|
||||
}
|
||||
|
||||
public void setFormatType(int formatType) {
|
||||
this.formatType = formatType;
|
||||
}
|
||||
|
||||
public String getKqdate() {
|
||||
return kqdate;
|
||||
}
|
||||
|
||||
public void setKqdate(String kqdate) {
|
||||
this.kqdate = kqdate;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (c) 2001-2016 泛微软件.
|
||||
* 泛微协同商务系统,版权所有.
|
||||
*
|
||||
*/
|
||||
package com.engine.kq.biz;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import weaver.system.ThreadWork;
|
||||
import weaver.system.ThreadWorkTimer;
|
||||
|
||||
import java.lang.Thread.UncaughtExceptionHandler;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @author
|
||||
* [优化]考勤格式化线程偶发失效的问题(自动扫描失效后会自动启一个新的线程)
|
||||
*/
|
||||
public class KQFormatThreadManagerExceptionHandler implements UncaughtExceptionHandler {
|
||||
|
||||
protected KQLog kqLog = new KQLog();
|
||||
|
||||
/**
|
||||
* 线程异常后,重启线程
|
||||
* @param t 异常线程对象
|
||||
* @param e 异常对象
|
||||
* @return
|
||||
*/
|
||||
public void uncaughtException(Thread t, Throwable e)
|
||||
{
|
||||
|
||||
// kqLog.writeLog("考勤格式化线程异常,重新启动...");
|
||||
// kqLog.writeLog("An exception has been capturedn");
|
||||
// kqLog.writeLog("Thread: " +t.getId());
|
||||
// kqLog.writeLog("Exception: "+ e.getClass().getName());
|
||||
// kqLog.writeLog(" "+ e.getMessage());
|
||||
// kqLog.writeLog("Stack Trace: n");
|
||||
// kqLog.writeLog("Thread status:"+t.getState());
|
||||
//
|
||||
// int hrmInterval = 30; //30秒检查一次
|
||||
// //ThreadWork KQFormatJob = new KQFormatJob();
|
||||
//
|
||||
// ThreadWorkTimer hrmThreadWorkTimer = new ThreadWorkTimer(hrmInterval, KQFormatJob,"KQFormatJob");
|
||||
//
|
||||
// hrmThreadWorkTimer.start();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import weaver.general.StaticObj;
|
||||
|
||||
import java.util.Timer;
|
||||
|
||||
public class KQFormatTimer {
|
||||
private static KQFormatTimer instance = new KQFormatTimer();
|
||||
|
||||
private KQFormatTimer(){
|
||||
init();
|
||||
}
|
||||
public static KQFormatTimer getInstance(){
|
||||
return instance;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(KQFormatJob.getInstance(), 2000, 5*1000);//频率5秒钟
|
||||
|
||||
Timer cardFlowFlushTimer = new Timer();
|
||||
cardFlowFlushTimer.schedule(KQCardFlowFlushJob.getInstance(), 2000, 5*1000);//频率5秒钟
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,714 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.engine.kq.entity.KQGroupEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.google.common.collect.Lists;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.IpUtils;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.common.database.dialect.DbDialectFactory;
|
||||
import weaver.hrm.common.database.dialect.IDbDialectSql;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class KQGroupBiz extends BaseBean {
|
||||
|
||||
private static final double EARTH_RADIUS = 6378137;// 地球半径
|
||||
public static final String GROUPMEMBER_VALIDATE_FROMDATE="2000-01-01";
|
||||
public static final String GROUPMEMBER_VALIDATE_TODATE="2999-12-31";
|
||||
|
||||
public String getGroupMemberSql() {
|
||||
return getGroupMemberSql("");
|
||||
}
|
||||
|
||||
public String getGroupMemberSql(String groupId) {
|
||||
Map<String,Object> params = new HashMap<>();
|
||||
params.put("groupId",groupId);
|
||||
return this.getGroupMemberSql(params);
|
||||
}
|
||||
|
||||
public String getGroupMemberSql(Map<String,Object> params) {
|
||||
String sql = "";
|
||||
try {
|
||||
String groupId = Util.null2String(params.get("groupId"));
|
||||
String isNoAccount = Util.null2String(params.get("isNoAccount"));
|
||||
if(Util.null2String(groupId).length()>0){
|
||||
sql = " SELECT distinct resourceid, groupid FROM ( " +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status FROM HrmResource a, kq_groupmember b " +
|
||||
" WHERE a.id=b.typevalue and b.type =1 and (b.isdelete is null or b.isdelete <> '1') " +
|
||||
" UNION ALL " +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status FROM HrmResource a, kq_groupmember b " +
|
||||
" WHERE a.subcompanyid1 = b.typevalue AND b.type=2 AND a.seclevel>=b.seclevel AND a.seclevel<=b.seclevelto and (b.isdelete is null or b.isdelete <> '1') " +
|
||||
" UNION ALL " +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status FROM HrmResource a, kq_groupmember b " +
|
||||
" WHERE a.departmentid = b.typevalue AND b.type=3 AND a.seclevel>=b.seclevel AND a.seclevel<=b.seclevelto and (b.isdelete is null or b.isdelete <> '1') " +
|
||||
" UNION ALL " +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status FROM HrmResource a, kq_groupmember b " +
|
||||
" WHERE a.jobtitle = b.typevalue AND a.seclevel>=b.seclevel AND a.seclevel<=b.seclevelto AND b.type=5 " +
|
||||
" AND (b.jobtitlelevel=1 OR (b.jobtitlelevel=2 AND a.subcompanyid1 IN(b.jobtitlelevelvalue)) OR (b.jobtitlelevel=3 AND a.departmentid IN(b.jobtitlelevelvalue))) " +
|
||||
" and (b.isdelete is null or b.isdelete <> '1') " +
|
||||
" UNION ALL " +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status FROM HrmResource a, kq_groupmember b " +
|
||||
" WHERE b.type=6 AND a.seclevel>=b.seclevel AND a.seclevel<=b.seclevelto and (b.isdelete is null or b.isdelete <> '1') ) t" +
|
||||
" where 1=1 ";
|
||||
if(!Util.null2String(isNoAccount).equals("1")){
|
||||
sql += " and t.status in (0,1,2,3) ";
|
||||
}
|
||||
sql += " and t.groupid = "+groupId;
|
||||
}else{
|
||||
sql = " SELECT distinct resourceid, groupid FROM ( " +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status FROM HrmResource a, kq_groupmember b,kq_group c " +
|
||||
" WHERE a.id=b.typevalue and b.type =1 and (b.isdelete is null or b.isdelete <> '1') and (c.isdelete is null or c.isdelete <> '1') and c.id=b.groupid " +
|
||||
" UNION ALL " +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status FROM HrmResource a, kq_groupmember b,kq_group c " +
|
||||
" WHERE a.subcompanyid1 = b.typevalue AND b.type=2 AND a.seclevel>=b.seclevel AND a.seclevel<=b.seclevelto and (b.isdelete is null or b.isdelete <> '1') and (c.isdelete is null or c.isdelete <> '1') and c.id=b.groupid " +
|
||||
" UNION ALL " +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status FROM HrmResource a, kq_groupmember b,kq_group c " +
|
||||
" WHERE a.departmentid = b.typevalue AND b.type=3 AND a.seclevel>=b.seclevel AND a.seclevel<=b.seclevelto and (b.isdelete is null or b.isdelete <> '1') and (c.isdelete is null or c.isdelete <> '1') and c.id=b.groupid " +
|
||||
" UNION ALL " +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status FROM HrmResource a, kq_groupmember b,kq_group c " +
|
||||
" WHERE a.jobtitle = b.typevalue AND a.seclevel>=b.seclevel AND a.seclevel<=b.seclevelto AND b.type=5 " +
|
||||
" AND (b.jobtitlelevel=1 OR (b.jobtitlelevel=2 AND a.subcompanyid1 IN(b.jobtitlelevelvalue)) OR (b.jobtitlelevel=3 AND a.departmentid IN(b.jobtitlelevelvalue))) " +
|
||||
" and (b.isdelete is null or b.isdelete <> '1') and (c.isdelete is null or c.isdelete <> '1') and c.id=b.groupid " +
|
||||
" UNION ALL " +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status FROM HrmResource a, kq_groupmember b,kq_group c " +
|
||||
" WHERE b.type=6 AND a.seclevel>=b.seclevel AND a.seclevel<=b.seclevelto and (b.isdelete is null or b.isdelete <> '1') and (c.isdelete is null or c.isdelete <> '1') and c.id=b.groupid ) t" +
|
||||
" where 1=1 ";
|
||||
if(!Util.null2String(isNoAccount).equals("1")){
|
||||
sql += " and t.status in (0,1,2,3) ";
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
|
||||
return sql;
|
||||
}
|
||||
|
||||
public List<String> getGroupMembers(String groupId) {
|
||||
Map<String,Object> params = new HashMap<>();
|
||||
params.put("groupId",groupId);
|
||||
return this.getGroupMembers(params);
|
||||
}
|
||||
|
||||
public List<String> getGroupMembers(Map<String,Object> params) {
|
||||
RecordSet rs = new RecordSet();
|
||||
List<String> members = new ArrayList<>();
|
||||
try {
|
||||
String sql = this.getGroupMemberSql(params);
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
members.add(rs.getString("resourceid"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
|
||||
return members;
|
||||
}
|
||||
|
||||
//根据传入的班次id,然后判断是否有考勤组引用这个班次
|
||||
public boolean serialIdIsUesed(String serialid) {
|
||||
boolean serialIdUesed = false;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
IDbDialectSql dialectSql = DbDialectFactory.get(rs.getDBType()) ;
|
||||
String isDeleteField = dialectSql.isNull("isdelete",0) ;
|
||||
try {
|
||||
sql = " select count(1) " +
|
||||
" from (select distinct serialid from kq_fixedschedulce where serialid in ( ? ) and ("+isDeleteField+" !=1 ) "+
|
||||
" union " +
|
||||
" select distinct serialid from kq_shiftschedule where serialid in ( ? ) and ("+isDeleteField+" !=1 ) ) t";
|
||||
rs.executeQuery(sql,serialid,serialid);
|
||||
if (rs.next()){
|
||||
if(rs.getInt(1)>0){
|
||||
serialIdUesed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!serialIdUesed){
|
||||
|
||||
|
||||
if(rs.getDBType().equals("oracle")||rs.getDBType().equals("postgresql")) {
|
||||
sql = " select count(1) from kq_group where ((','||serialids||',') like '%," + serialid + ",%' or (','||shiftcycleserialids||',') like '%," + serialid + ",%') and (isdelete is null or isdelete <> '1')";
|
||||
}else if(rs.getDBType().equals("mysql")){
|
||||
String serialidsConcatContion = dialectSql.concatStr("','","serialids","','") ;
|
||||
String shiftcycleSerialidsConcatConditon = dialectSql.concatStr("','","shiftcycleserialids","','") ;
|
||||
String groupIsDeleteCondition = dialectSql.isNull("isdelete",0) ;
|
||||
String likeValue = "%,"+serialid+",%" ;
|
||||
|
||||
sql = String.format(" select count(1) from kq_group where ((%s) like '%s' or (%s) like '%s') and (%s!=1)",
|
||||
serialidsConcatContion,likeValue,
|
||||
shiftcycleSerialidsConcatConditon,likeValue,
|
||||
groupIsDeleteCondition) ;
|
||||
}else{
|
||||
sql = " select count(1) from kq_group where (','+serialids+',' like '%," + serialid + ",%' or ','+shiftcycleserialids+',' like '%," + serialid + ",%') and (isdelete is null or isdelete <> '1')";
|
||||
}
|
||||
|
||||
|
||||
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()){
|
||||
if(rs.getInt(1)>0){
|
||||
serialIdUesed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
return serialIdUesed;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的班次id,引用此班次的考勤组
|
||||
* @param serialid
|
||||
* @return
|
||||
*/
|
||||
public List<String> getGroupIdByUesedSerialId(String serialid) {
|
||||
RecordSet rs = new RecordSet();
|
||||
List<String> groupList = Lists.newArrayList();
|
||||
String sql = "";
|
||||
IDbDialectSql dialectSql = DbDialectFactory.get(rs.getDBType()) ;
|
||||
String isDeleteField = dialectSql.isNull("isdelete",0) ;
|
||||
try {
|
||||
sql = " select serialid,groupid " +
|
||||
" from (select distinct serialid,groupid from kq_fixedschedulce where serialid in ( ? ) and ("+isDeleteField+" !=1 ) "+
|
||||
" union " +
|
||||
" select distinct serialid,groupid from kq_shiftschedule where serialid in ( ? ) and ("+isDeleteField+" !=1 ) ) t";
|
||||
rs.executeQuery(sql,serialid,serialid);
|
||||
while (rs.next()){
|
||||
String tmp_groupId = rs.getString("groupid");
|
||||
if(!groupList.contains(tmp_groupId)){
|
||||
groupList.add(tmp_groupId);
|
||||
}
|
||||
}
|
||||
|
||||
if(rs.getDBType().equals("oracle")||rs.getDBType().equals("postgresql")) {
|
||||
sql = " select id from kq_group where ((','||serialids||',') like '%," + serialid + ",%' or (','||shiftcycleserialids||',') like '%," + serialid + ",%') and (isdelete is null or isdelete <> '1')";
|
||||
}else if(rs.getDBType().equals("mysql")){
|
||||
String serialidsConcatContion = dialectSql.concatStr("','","serialids","','") ;
|
||||
String shiftcycleSerialidsConcatConditon = dialectSql.concatStr("','","shiftcycleserialids","','") ;
|
||||
String groupIsDeleteCondition = dialectSql.isNull("isdelete",0) ;
|
||||
String likeValue = "%,"+serialid+",%" ;
|
||||
|
||||
sql = String.format(" select id from kq_group where ((%s) like '%s' or (%s) like '%s') and (%s!=1)",
|
||||
serialidsConcatContion,likeValue,
|
||||
shiftcycleSerialidsConcatConditon,likeValue,
|
||||
groupIsDeleteCondition) ;
|
||||
}else{
|
||||
sql = " select id from kq_group where (','+serialids+',' like '%," + serialid + ",%' or ','+shiftcycleserialids+',' like '%," + serialid + ",%') and (isdelete is null or isdelete <> '1')";
|
||||
}
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String tmp_groupId = rs.getString("id");
|
||||
if(!groupList.contains(tmp_groupId)){
|
||||
groupList.add(tmp_groupId);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
return groupList;
|
||||
}
|
||||
|
||||
public Map<String,Object> getLocationWifiInfo(String userid,String showWifiList) {
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
Map<String,Object> locationInfo = new HashMap<>();
|
||||
Map<String,Object> wifiInfo = new HashMap<>();
|
||||
KQGroupComInfo kqGroupComInfo = new KQGroupComInfo();
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
KQLoactionComInfo kqLoactionComInfo = new KQLoactionComInfo();
|
||||
String groupid = Util.null2String(kqGroupMemberComInfo.getKQGroupId(userid));
|
||||
List<Object> datas = null;
|
||||
Map<String, Object> data = null;
|
||||
|
||||
if(groupid.length()>0){
|
||||
datas = new ArrayList();
|
||||
while(kqLoactionComInfo.next()){
|
||||
if(!kqLoactionComInfo.getGroupid().equals(groupid))continue;
|
||||
data = new HashMap<>();
|
||||
data.put("id",kqLoactionComInfo.getId());
|
||||
data.put("locationname",Util.null2String(kqLoactionComInfo.getLocationname()));
|
||||
data.put("longitude",Util.null2String(kqLoactionComInfo.getLongitude()));
|
||||
data.put("latitude",Util.null2String(kqLoactionComInfo.getLatitude()));
|
||||
data.put("address",Util.null2String(kqLoactionComInfo.getAddress()));
|
||||
data.put("checkscope",Util.null2String(kqLoactionComInfo.getCheckscope()));
|
||||
data.put("groupid",Util.null2String(kqLoactionComInfo.getGroupid()));
|
||||
datas.add(data);
|
||||
}
|
||||
locationInfo.put("locationcheck",Util.null2String(kqGroupComInfo.getLocationcheck(groupid)).equals("1"));
|
||||
locationInfo.put("locationcheckscope",Util.null2String(kqGroupComInfo.getLocationcheckscope(groupid)));
|
||||
locationInfo.put("locations",datas);
|
||||
|
||||
datas = new ArrayList();
|
||||
if("1".equalsIgnoreCase(showWifiList)){
|
||||
KQWifiComInfo kqWifiComInfo = new KQWifiComInfo();
|
||||
while(kqWifiComInfo.next()){
|
||||
if(!kqWifiComInfo.getGroupid().equals(groupid))continue;
|
||||
data = new HashMap<>();
|
||||
data.put("id",kqWifiComInfo.getId());
|
||||
data.put("wifiname",Util.null2String(kqWifiComInfo.getWifiname()));
|
||||
data.put("mac",Util.null2String(kqWifiComInfo.getMac()));
|
||||
data.put("groupid",Util.null2String(kqWifiComInfo.getGroupid()));
|
||||
datas.add(data);
|
||||
}
|
||||
}
|
||||
wifiInfo.put("wificheck",Util.null2String(kqGroupComInfo.getWificheck(groupid)).equals("1"));
|
||||
wifiInfo.put("wifis",datas);
|
||||
|
||||
result.put("locationInfo",locationInfo);
|
||||
result.put("wifiInfo",wifiInfo);
|
||||
result.put("status","1");
|
||||
|
||||
String show_position = "show_position";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String positioncheck = Util.null2String(kqSettingsComInfo.getMain_val(show_position),"0");
|
||||
result.put("positioncheck",positioncheck);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 用户考勤地点 WIFI限制信息
|
||||
* @param userid
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> getLocationWifiInfo(String userid) {
|
||||
return getLocationWifiInfo(userid,"1");
|
||||
}
|
||||
|
||||
/**
|
||||
*判断办公地点范围
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> checkLocationScope(String userId, String longitude, String latitude){
|
||||
Map<String, Object> retmap = new HashMap<>();
|
||||
Map<String, Object> loactionInfo = null;
|
||||
try {
|
||||
boolean inScope = false;
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
KQGroupEntity kqGroupEntity = kqGroupMemberComInfo.getUserKQGroupInfo(userId);
|
||||
KQLoactionComInfo kqLoactionComInfo = new KQLoactionComInfo();
|
||||
Map<String, Object> locationTrueInfo = new HashMap<>();
|
||||
double distance = EARTH_RADIUS;
|
||||
if (kqGroupEntity != null && kqGroupEntity.getLocationcheck().equals("1")) {
|
||||
while (kqLoactionComInfo.next()) {
|
||||
if (Util.null2String(kqLoactionComInfo.getGroupid()).equals(kqGroupEntity.getId())) {
|
||||
double lng1 = Util.getDoubleValue(longitude);//经度
|
||||
double lat1 = Util.getDoubleValue(latitude);//纬度
|
||||
double lng2 = Util.getDoubleValue(kqLoactionComInfo.getLongitude());//经度
|
||||
double lat2 = Util.getDoubleValue(kqLoactionComInfo.getLatitude());//纬度
|
||||
int checkscope = Util.getIntValue(kqLoactionComInfo.getCheckscope());//有效范围
|
||||
double geo_distance = geo_distance(lng1, lat1, lng2, lat2);
|
||||
if (distance > geo_distance) {
|
||||
distance = geo_distance;
|
||||
locationTrueInfo.put("lng2", lng2);
|
||||
locationTrueInfo.put("lat2", lat2);
|
||||
locationTrueInfo.put("checkscope", checkscope);
|
||||
locationTrueInfo.put("geo_distance", geo_distance);
|
||||
// locationTrueInfo = lng2 + "#" + lat2 + "#" + checkscope + "#" + geo_distance;
|
||||
}
|
||||
if (geo_distance < checkscope) {
|
||||
inScope = true;
|
||||
loactionInfo = new HashMap<>();
|
||||
loactionInfo.put("locationname", kqLoactionComInfo.getLocationname());
|
||||
loactionInfo.put("longitude", kqLoactionComInfo.getLongitude());
|
||||
loactionInfo.put("latitude", kqLoactionComInfo.getLatitude());
|
||||
loactionInfo.put("address", kqLoactionComInfo.getAddress());
|
||||
loactionInfo.put("id", kqLoactionComInfo.getId());
|
||||
loactionInfo.put("longitudefromoa", lng2);
|
||||
loactionInfo.put("latitudefromoa", lat2);
|
||||
loactionInfo.put("lengthfromoa", checkscope);
|
||||
loactionInfo.put("lengthfromem", geo_distance);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {//未开启开关
|
||||
inScope = true;
|
||||
}
|
||||
retmap.put("needCheck", kqGroupEntity != null ? Util.null2String(kqGroupEntity.getLocationcheck()) : "0");//是否开启办公地点验证
|
||||
retmap.put("inScope", inScope);//是否在考勤范围内
|
||||
retmap.put("locationshowaddress", kqGroupEntity != null ? Util.null2String(kqGroupEntity.getLocationshowaddress()) : "0");//有效识别半径内显示同一地址
|
||||
if (!inScope && locationTrueInfo != null && !locationTrueInfo.isEmpty()) {
|
||||
if(loactionInfo == null) {
|
||||
loactionInfo = new HashMap<>();
|
||||
}
|
||||
loactionInfo.put("longitudefromoa", Util.null2String(locationTrueInfo.get("lng2")));
|
||||
loactionInfo.put("latitudefromoa", Util.null2String(locationTrueInfo.get("lat2")));
|
||||
loactionInfo.put("lengthfromoa", Util.null2String(locationTrueInfo.get("checkscope")));
|
||||
loactionInfo.put("lengthfromem", Util.null2String(locationTrueInfo.get("geo_distance")));
|
||||
}
|
||||
}catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
retmap.put("loactionInfo", loactionInfo);//考勤范围相关信息
|
||||
return retmap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个经度纬度(WGS-84)之间的距离
|
||||
* @param lng1 坐标1经度
|
||||
* @param lat1 坐标1纬度EARTH_RADIUS
|
||||
* @param lng2 坐标2经度
|
||||
* @param lat2 坐标2纬度
|
||||
* @return 2个坐标之间距离,单位:米
|
||||
*/
|
||||
private double geo_distance(double lng1, double lat1, double lng2, double lat2) {
|
||||
double radLat1 = Math.toRadians(lat1);
|
||||
double radLat2 = Math.toRadians(lat2);
|
||||
double a = Math.abs(radLat1 - radLat2);
|
||||
double b = Math.abs(Math.toRadians(lng1) - Math.toRadians(lng2));
|
||||
double distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
|
||||
distance = distance * EARTH_RADIUS;
|
||||
distance = Math.round(distance * 10000) / 10000;
|
||||
return distance;
|
||||
}
|
||||
|
||||
/**
|
||||
*判断Wifi范围
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> checkWifiScope(String userId, String wifiName, String mac){
|
||||
Map<String,Object> retmap = new HashMap<>();
|
||||
Map<String,Object> wifiInfo = null;
|
||||
boolean inScope = false;
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
KQGroupEntity kqGroupEntity = kqGroupMemberComInfo.getUserKQGroupInfo(userId);
|
||||
KQWifiComInfo kqWifiComInfo = new KQWifiComInfo();
|
||||
|
||||
if(kqGroupEntity.getWificheck().equals("1")){
|
||||
try{
|
||||
List<String> lst = new ArrayList<>(Arrays.asList(mac.split(":")));
|
||||
for(int i = 0; i < lst.size(); i++){
|
||||
String s = lst.get(i);
|
||||
if(s.length() == 1)
|
||||
lst.set(i, "0" + s);
|
||||
}
|
||||
mac = String.join(":", lst);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
while(kqWifiComInfo.next()){
|
||||
if(Util.null2String(kqWifiComInfo.getGroupid()).equals(kqGroupEntity.getId())){
|
||||
if(Util.null2String(kqWifiComInfo.getWifiname().toLowerCase()).equals(wifiName.toLowerCase())){
|
||||
String wifi_cominfo_mac = Util.null2String(kqWifiComInfo.getMac().toLowerCase());
|
||||
String param_mac = mac.toLowerCase();
|
||||
int last_wifi_mac_index = wifi_cominfo_mac.lastIndexOf(":");
|
||||
int param_mac_index = param_mac.lastIndexOf(":");
|
||||
if(last_wifi_mac_index > 0 && param_mac_index > 0){
|
||||
wifi_cominfo_mac = wifi_cominfo_mac.substring(0,last_wifi_mac_index);
|
||||
param_mac = param_mac.substring(0,param_mac_index);
|
||||
}
|
||||
if(wifi_cominfo_mac.equals(param_mac)){
|
||||
inScope = true;
|
||||
wifiInfo = new HashMap<>();
|
||||
wifiInfo.put("wifiname",kqWifiComInfo.getWifiname());
|
||||
wifiInfo.put("mac",kqWifiComInfo.getMac());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{//未开启开关
|
||||
inScope = true;
|
||||
}
|
||||
retmap.put("needCheck",Util.null2String(kqGroupEntity.getWificheck()));//是否开启wifi验证
|
||||
retmap.put("inScope",inScope);//是否在考勤范围内
|
||||
retmap.put("wifiInfo",wifiInfo);//考勤范围相关信息
|
||||
return retmap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验ipv4和v6范围
|
||||
* @param userId
|
||||
* @param clientAddress
|
||||
* @param ismobile
|
||||
* @return
|
||||
*/
|
||||
public boolean getIsInScopeV4V6(String userId, String clientAddress,String ismobile) {
|
||||
boolean isInScope = false;
|
||||
clientAddress = Util.null2String(clientAddress).trim();
|
||||
if (clientAddress.length() == 0) {
|
||||
return isInScope;
|
||||
}
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
KQGroupComInfo kqGroupComInfo = new KQGroupComInfo();
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
String groupid = Util.null2String(kqGroupMemberComInfo.getKQGroupId(userId));
|
||||
String signIpScope = Util.null2String(kqGroupComInfo.getIpscope(groupid)).trim();//格式:10.*.*.*;10.16.0.12;10.16.0.13-10.16.0.18
|
||||
String signIpscope_v4_em = Util.null2String(kqGroupComInfo.getIpscope_v4_em(groupid)).trim();
|
||||
String signIpscope_v4_pc = Util.null2String(kqGroupComInfo.getIpscope_v4_pc(groupid)).trim();
|
||||
String signIpscope_v6_em = Util.null2String(kqGroupComInfo.getIpscope_v6_em(groupid)).trim();
|
||||
String signIpscope_v6_pc = Util.null2String(kqGroupComInfo.getIpscope_v6_pc(groupid)).trim();
|
||||
if (signIpscope_v4_em.length() == 0 && signIpscope_v4_pc.length() == 0
|
||||
&& signIpscope_v6_em.length() == 0 && signIpscope_v6_pc.length() == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
new KQLog().info("getIsInScopeV4V6:ismobile:"+ismobile+":signIpscope_v4_em:"+signIpscope_v4_em+":signIpscope_v6_em:"+signIpscope_v6_em
|
||||
+":signIpscope_v4_pc:"+signIpscope_v4_pc+":signIpscope_v6_pc:"+signIpscope_v6_pc);
|
||||
if("1".equalsIgnoreCase(ismobile)){
|
||||
if(signIpscope_v4_em.length() > 0){
|
||||
return checkIps(signIpscope_v4_em,clientAddress,"IPv4");
|
||||
}else if(signIpscope_v6_em.length() > 0){
|
||||
return checkIps(signIpscope_v6_em,clientAddress,"IPv6");
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
if(signIpscope_v4_pc.length() > 0){
|
||||
return checkIps(signIpscope_v4_pc,clientAddress,"IPv4");
|
||||
}else if(signIpscope_v6_pc.length() > 0){
|
||||
return checkIps(signIpscope_v6_pc,clientAddress,"IPv6");
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean checkIps(String signIpScope, String clientAddress,String ipType) {
|
||||
boolean isInScope = false;
|
||||
List signIpScopeList = Util.TokenizerString(signIpScope, ";");
|
||||
String signIpScopeSingle = "";
|
||||
for (int i = 0; i < signIpScopeList.size(); i++) {
|
||||
signIpScopeSingle = Util.null2String((String) signIpScopeList.get(i));
|
||||
signIpScopeSingle = signIpScopeSingle.trim();
|
||||
if("IPv4".equalsIgnoreCase(ipType)){
|
||||
isInScope = checkIpV4(signIpScopeSingle,clientAddress);
|
||||
if(isInScope){
|
||||
break;
|
||||
}
|
||||
}else if("IPv6".equalsIgnoreCase(ipType)){
|
||||
isInScope = checkIpV6(signIpScopeSingle,clientAddress);
|
||||
if(isInScope){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isInScope;
|
||||
}
|
||||
|
||||
private boolean checkIpV6(String signIpScopeSingle, String clientAddress) {
|
||||
|
||||
boolean isInScope = false;
|
||||
if (signIpScopeSingle.indexOf("-") > -1) {
|
||||
String signIpFrom = signIpScopeSingle.substring(0, signIpScopeSingle.indexOf("-"));
|
||||
signIpFrom = Util.null2String(signIpFrom).trim();
|
||||
String signIpTo = "";
|
||||
if (!signIpScopeSingle.endsWith("-")) {
|
||||
signIpTo = signIpScopeSingle.substring(signIpScopeSingle.indexOf("-") + 1);
|
||||
}
|
||||
signIpTo = Util.null2String(signIpTo).trim();
|
||||
String tempClientAddress = IpUtils.parseAbbreviationToFullIPv6(clientAddress);
|
||||
signIpFrom = addToThreeFigure(signIpFrom, "signIpFrom");
|
||||
signIpTo = addToThreeFigure(signIpTo, "signIpTo");
|
||||
|
||||
signIpFrom = IpUtils.parseAbbreviationToFullIPv6(signIpFrom);
|
||||
signIpTo = IpUtils.parseAbbreviationToFullIPv6(signIpTo);
|
||||
|
||||
if (signIpFrom.equals("") && signIpTo.equals("")) {
|
||||
isInScope = true;
|
||||
}
|
||||
if (signIpFrom.equals("") && !signIpTo.equals("")) {
|
||||
if (tempClientAddress.compareTo(signIpTo) <= 0) {
|
||||
isInScope = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!signIpFrom.equals("") && signIpTo.equals("")) {
|
||||
if (tempClientAddress.compareTo(signIpFrom) >= 0) {
|
||||
isInScope = true;
|
||||
}
|
||||
}
|
||||
if (!signIpFrom.equals("") && !signIpTo.equals("")) {
|
||||
if (tempClientAddress.compareTo(signIpFrom) >= 0 && tempClientAddress.compareTo(signIpTo) <= 0) {
|
||||
isInScope = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String tempClientAddress = IpUtils.parseAbbreviationToFullIPv6(clientAddress);
|
||||
if (tempClientAddress.equals(signIpScopeSingle)) {
|
||||
isInScope = true;
|
||||
}
|
||||
}
|
||||
return isInScope;
|
||||
}
|
||||
|
||||
public boolean checkIpV4(String signIpScopeSingle,String clientAddress) {
|
||||
|
||||
boolean isInScope = false;
|
||||
if (signIpScopeSingle.indexOf("*") > -1) {//如果单个ip范围的格式为10.*.*.*
|
||||
List signIpScopeSingleList = Util.TokenizerString(signIpScopeSingle, ".");
|
||||
List clientAddressList = Util.TokenizerString(clientAddress, ".");
|
||||
if (signIpScopeSingleList.size() == 4
|
||||
&& clientAddressList.size() == 4
|
||||
&& ("*".equals((String) signIpScopeSingleList.get(0))
|
||||
|| Util.null2String((String) clientAddressList.get(0)).equals((String) signIpScopeSingleList.get(0)))
|
||||
&& ("*".equals((String) signIpScopeSingleList.get(1))
|
||||
|| Util.null2String((String) clientAddressList.get(1)).equals((String) signIpScopeSingleList.get(1)))
|
||||
&& ("*".equals((String) signIpScopeSingleList.get(2))
|
||||
|| Util.null2String((String) clientAddressList.get(2)).equals((String) signIpScopeSingleList.get(2)))
|
||||
&& ("*".equals((String) signIpScopeSingleList.get(3))
|
||||
|| Util.null2String((String) clientAddressList.get(3)).equals((String) signIpScopeSingleList.get(2)))
|
||||
) {
|
||||
isInScope = true;
|
||||
}
|
||||
} else if (signIpScopeSingle.indexOf("-") > -1) {//如果单个ip范围的格式为10.16.0.13-10.16.0.18
|
||||
String signIpFrom = signIpScopeSingle.substring(0, signIpScopeSingle.indexOf("-"));
|
||||
signIpFrom = Util.null2String(signIpFrom).trim();
|
||||
String signIpTo = "";
|
||||
if (!signIpScopeSingle.endsWith("-")) {
|
||||
signIpTo = signIpScopeSingle.substring(signIpScopeSingle.indexOf("-") + 1);
|
||||
}
|
||||
signIpTo = Util.null2String(signIpTo).trim();
|
||||
String tempClientAddress = addToThreeFigure(clientAddress, "clientAddress");
|
||||
signIpFrom = addToThreeFigure(signIpFrom, "signIpFrom");
|
||||
signIpTo = addToThreeFigure(signIpTo, "signIpTo");
|
||||
|
||||
if (signIpFrom.equals("") && signIpTo.equals("")) {
|
||||
isInScope = true;
|
||||
}
|
||||
if (signIpFrom.equals("") && !signIpTo.equals("")) {
|
||||
if (tempClientAddress.compareTo(signIpTo) <= 0) {
|
||||
isInScope = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!signIpFrom.equals("") && signIpTo.equals("")) {
|
||||
if (tempClientAddress.compareTo(signIpFrom) >= 0) {
|
||||
isInScope = true;
|
||||
}
|
||||
}
|
||||
if (!signIpFrom.equals("") && !signIpTo.equals("")) {
|
||||
if (tempClientAddress.compareTo(signIpFrom) >= 0 && tempClientAddress.compareTo(signIpTo) <= 0) {
|
||||
isInScope = true;
|
||||
}
|
||||
}
|
||||
} else {//否则单个ip范围的格式为10.16.0.12
|
||||
if (clientAddress.equals(signIpScopeSingle)) {
|
||||
isInScope = true;
|
||||
}
|
||||
}
|
||||
return isInScope;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验ip范围
|
||||
* @param clientAddress
|
||||
* @return
|
||||
*/
|
||||
public boolean getIsInScope(String userId, String clientAddress) {
|
||||
boolean isInScope = false;
|
||||
clientAddress = Util.null2String(clientAddress).trim();
|
||||
if (clientAddress.length() == 0) {
|
||||
return isInScope;
|
||||
}
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
KQGroupComInfo kqGroupComInfo = new KQGroupComInfo();
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
String groupid = Util.null2String(kqGroupMemberComInfo.getKQGroupId(userId));
|
||||
String signIpScope = Util.null2String(kqGroupComInfo.getIpscope(groupid)).trim();//格式:10.*.*.*;10.16.0.12;10.16.0.13-10.16.0.18
|
||||
if (signIpScope.length() == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
List signIpScopeList = Util.TokenizerString(signIpScope, ";");
|
||||
String signIpScopeSingle = "";
|
||||
for (int i = 0; i < signIpScopeList.size(); i++) {
|
||||
signIpScopeSingle = Util.null2String((String) signIpScopeList.get(i));
|
||||
signIpScopeSingle = signIpScopeSingle.trim();
|
||||
if (signIpScopeSingle.indexOf("*") > -1) {//如果单个ip范围的格式为10.*.*.*
|
||||
List signIpScopeSingleList = Util.TokenizerString(signIpScopeSingle, ".");
|
||||
List clientAddressList = Util.TokenizerString(clientAddress, ".");
|
||||
if (signIpScopeSingleList.size() == 4
|
||||
&& clientAddressList.size() == 4
|
||||
&& ("*".equals((String) signIpScopeSingleList.get(0))
|
||||
|| Util.null2String((String) clientAddressList.get(0)).equals((String) signIpScopeSingleList.get(0)))
|
||||
&& ("*".equals((String) signIpScopeSingleList.get(1))
|
||||
|| Util.null2String((String) clientAddressList.get(1)).equals((String) signIpScopeSingleList.get(1)))
|
||||
&& ("*".equals((String) signIpScopeSingleList.get(2))
|
||||
|| Util.null2String((String) clientAddressList.get(2)).equals((String) signIpScopeSingleList.get(2)))
|
||||
&& ("*".equals((String) signIpScopeSingleList.get(3))
|
||||
|| Util.null2String((String) clientAddressList.get(3)).equals((String) signIpScopeSingleList.get(2)))
|
||||
) {
|
||||
isInScope = true;
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (signIpScopeSingle.indexOf("-") > -1) {//如果单个ip范围的格式为10.16.0.13-10.16.0.18
|
||||
String signIpFrom = signIpScopeSingle.substring(0, signIpScopeSingle.indexOf("-"));
|
||||
signIpFrom = Util.null2String(signIpFrom).trim();
|
||||
String signIpTo = "";
|
||||
if (!signIpScopeSingle.endsWith("-")) {
|
||||
signIpTo = signIpScopeSingle.substring(signIpScopeSingle.indexOf("-") + 1);
|
||||
}
|
||||
signIpTo = Util.null2String(signIpTo).trim();
|
||||
String tempClientAddress = addToThreeFigure(clientAddress, "clientAddress");
|
||||
signIpFrom = addToThreeFigure(signIpFrom, "signIpFrom");
|
||||
signIpTo = addToThreeFigure(signIpTo, "signIpTo");
|
||||
|
||||
if (signIpFrom.equals("") && signIpTo.equals("")) {
|
||||
isInScope = true;
|
||||
break;
|
||||
}
|
||||
if (signIpFrom.equals("") && !signIpTo.equals("")) {
|
||||
if (tempClientAddress.compareTo(signIpTo) <= 0) {
|
||||
isInScope = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!signIpFrom.equals("") && signIpTo.equals("")) {
|
||||
if (tempClientAddress.compareTo(signIpFrom) >= 0) {
|
||||
isInScope = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!signIpFrom.equals("") && !signIpTo.equals("")) {
|
||||
if (tempClientAddress.compareTo(signIpFrom) >= 0 && tempClientAddress.compareTo(signIpTo) <= 0) {
|
||||
isInScope = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {//否则单个ip范围的格式为10.16.0.12
|
||||
if (clientAddress.equals(signIpScopeSingle)) {
|
||||
isInScope = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isInScope;
|
||||
}
|
||||
/**
|
||||
* 将IP地址填充为3位数
|
||||
* 如 "192.168.0.25"填充为3位数后为"192.168.000.025"
|
||||
* @return String 填充为3位数后的IP地址
|
||||
*/
|
||||
private String addToThreeFigure(String IPAddress, String IPType) {
|
||||
if (IPAddress == null || IPAddress.trim().equals("") || IPType == null || IPType.trim().equals("")) {
|
||||
return "";
|
||||
}
|
||||
String returnString = "";
|
||||
List IPAddressList = Util.TokenizerString(IPAddress, ".");
|
||||
String IPAddressPart = "";
|
||||
for (int i = 0; i < IPAddressList.size(); i++) {
|
||||
IPAddressPart = Util.null2String(IPAddressList.get(i));
|
||||
if (IPType.equals("signIpTo")) {
|
||||
returnString += "." + Util.add0(Util.getIntValue(IPAddressPart, 255), 3);
|
||||
} else {
|
||||
returnString += "." + Util.add0(Util.getIntValue(IPAddressPart, 0), 3);
|
||||
}
|
||||
}
|
||||
if (!returnString.equals("")) {
|
||||
returnString = returnString.substring(1);
|
||||
}
|
||||
return returnString;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue