转事假关联考勤部分

dev-chenwnj
chenwei 1 year ago
parent f52e8484df
commit caa60529d6

@ -378,6 +378,10 @@ public class KQReportBiz extends BaseBean {
basebean.writeLog("getDailyFlowData appFprOvertime");
datas.putAll(getDailyAppForOvertimeData(params,user));
//考勤二开--转事假
basebean.writeLog("getDailyFlowData toComLeave");
datas.putAll(getDailyToComLeaveData(params,user));
}catch (Exception e){
writeLog(e);
@ -406,9 +410,167 @@ public class KQReportBiz extends BaseBean {
basebean.writeLog("getFlowData appFprOvertime");
datas.putAll(getAppForOvertimeData(params,user));
//考勤二开--转事假
basebean.writeLog("getFlowData getToComLeaveData");
datas.putAll(getToComLeaveData(params,user));
}catch (Exception e){
writeLog(e);
}
return datas;
}
public Map<String,Object> getToComLeaveData(Map<String,Object> params, User user){
Map<String,Object> datas = new HashMap<>();
RecordSet rs = new RecordSet();
String sql = "";
String sqlWhere = " ";
try {
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
String fromDate = Util.null2String(jsonObj.get("fromDate"));
String toDate = Util.null2String(jsonObj.get("toDate"));
String typeselect = Util.null2String(jsonObj.get("typeselect"));
if (typeselect.length() == 0) typeselect = "3";
if (!typeselect.equals("") && !typeselect.equals("0") && !typeselect.equals("6")) {
if (typeselect.equals("1")) {
fromDate = TimeUtil.getCurrentDateString();
toDate = TimeUtil.getCurrentDateString();
} else {
fromDate = TimeUtil.getDateByOption(typeselect, "0");
toDate = TimeUtil.getDateByOption(typeselect, "1");
}
}
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
String departmentId = Util.null2String(jsonObj.get("departmentId"));
String resourceId = Util.null2String(jsonObj.get("resourceId"));
String allLevel = Util.null2String(jsonObj.get("allLevel"));
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
String viewScope = Util.null2String(jsonObj.get("viewScope"));
if (subCompanyId.length() > 0) {
sqlWhere += " and c.subcompanyid1 in(" + subCompanyId + ") ";
}
if (departmentId.length() > 0) {
sqlWhere += " and c.departmentid in(" + departmentId + ") ";
}
if (resourceId.length() > 0) {
sqlWhere += " and c.resourceid in(" + resourceId + ") ";
}
if (viewScope.equals("4")) {//我的下属
if (allLevel.equals("1")) {//所有下属
sqlWhere += " and c.managerstr like '%," + user.getUID() + ",%'";
} else {
sqlWhere += " and c.managerid=" + user.getUID();//直接下属
}
}
if (!"1".equals(isNoAccount)) {
sqlWhere += " and c.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and c.loginid<>'' ");
}
sql = " select * from (select * from uf_casleave a left join hrmresource on a.resourceid = b.id " +
" where a.startdate >='" + fromDate + "' and a.enddate <='" + toDate +"' and (isdecu = 0 or isdecu is null ) ) c where 1=1 " + sqlWhere;
basebean.writeLog("getToComLeaveData sql: " + sql);
rs.executeQuery(sql);
while (rs.next()) {
double duration = Util.getDoubleValue(Util.null2String(rs.getString("duration")));
if ( duration > 0.00){
double temp = Util.getDoubleValue(Util.null2String(datas.get("ToComLeaveData|" + resourceId)));
if (temp <= 0.00) {
datas.put("ToComLeaveData|" + resourceId, duration);
} else {
datas.put("ToComLeaveData|" + resourceId, temp + duration);
}
}
}
}catch (Exception e){
writeLog(e);
}
basebean.writeLog("getDailyToComLeaveData datas:" + datas);
return datas;
}
public Map<String,Object> getDailyToComLeaveData(Map<String,Object> params, User user){
Map<String,Object> datas = new HashMap<>();
RecordSet rs = new RecordSet();
String sql = "";
String sqlWhere = " ";
try {
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
String fromDate = Util.null2String(jsonObj.get("fromDate"));
String toDate = Util.null2String(jsonObj.get("toDate"));
String typeselect = Util.null2String(jsonObj.get("typeselect"));
if (typeselect.length() == 0) typeselect = "3";
if (!typeselect.equals("") && !typeselect.equals("0") && !typeselect.equals("6")) {
if (typeselect.equals("1")) {
fromDate = TimeUtil.getCurrentDateString();
toDate = TimeUtil.getCurrentDateString();
} else {
fromDate = TimeUtil.getDateByOption(typeselect, "0");
toDate = TimeUtil.getDateByOption(typeselect, "1");
}
}
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
String departmentId = Util.null2String(jsonObj.get("departmentId"));
String resourceId = Util.null2String(jsonObj.get("resourceId"));
String allLevel = Util.null2String(jsonObj.get("allLevel"));
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
String viewScope = Util.null2String(jsonObj.get("viewScope"));
if (subCompanyId.length() > 0) {
sqlWhere += " and c.subcompanyid1 in(" + subCompanyId + ") ";
}
if (departmentId.length() > 0) {
sqlWhere += " and c.departmentid in(" + departmentId + ") ";
}
if (resourceId.length() > 0) {
sqlWhere += " and c.resourceid in(" + resourceId + ") ";
}
if (viewScope.equals("4")) {//我的下属
if (allLevel.equals("1")) {//所有下属
sqlWhere += " and c.managerstr like '%," + user.getUID() + ",%'";
} else {
sqlWhere += " and c.managerid=" + user.getUID();//直接下属
}
}
if (!"1".equals(isNoAccount)) {
sqlWhere += " and c.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and c.loginid<>'' ");
}
sql = " select * from (select * from uf_casleave a left join hrmresource on a.resourceid = b.id " +
" where a.startdate >='" + fromDate + "' and a.enddate <='" + toDate +"' and (isdecu = 0 or isdecu is null ) ) c where 1=1 " + sqlWhere;
basebean.writeLog("getDailyToComLeaveData sql: " + sql);
rs.executeQuery(sql);
while (rs.next()) {
double duration = Util.getDoubleValue(Util.null2String(rs.getString("duration")));
String kqdate = Util.null2String(rs.getString("startdate"));
if ( duration > 0.00){
double temp = Util.getDoubleValue(Util.null2String(datas.get("DailyToComLeaveData|" + resourceId + "|" + kqdate)));
if (temp <= 0.00) {
datas.put("DailyToComLeaveData|" + resourceId + "|" + kqdate, duration);
} else {
datas.put("DailyToComLeaveData|" + resourceId + "|" + kqdate, temp + duration);
}
}
}
}catch (Exception e){
writeLog(e);
}
basebean.writeLog("getDailyToComLeaveData datas:" + datas);
return datas;
}
@ -2567,18 +2729,14 @@ public class KQReportBiz extends BaseBean {
}
public static String getSignStatus(Map<String,Object> signInfo, User user,String onOrOff){
BaseBean bb = new BaseBean();
bb.writeLog("getSignStatus start");
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
String text = "";
String isneedcal = Util.null2String(signInfo.get("isneedcal"));
bb.writeLog("isneedcal: " + isneedcal);
String workdate = Util.null2String(signInfo.get("workdate"));
bb.writeLog("workdate: " + workdate);
String worktime = Util.null2String(signInfo.get("worktime"));
bb.writeLog("worktime: " + worktime);
if(!new KQFormatBiz().needCal(workdate,worktime,isneedcal)) {//还未到时间无需计算
return text;

@ -248,6 +248,10 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
params.put("isneedcal",isneedcal?"1":"0");
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
/*考勤二开--转事假start*/
String calLeaveId = bb.getPropValue("project_sskj", "calLeaveId");
/*考勤二开--转事假end*/
rs.execute(sql);
while (rs.next()) {
data = new ArrayList<>();
@ -401,6 +405,18 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
} else {
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(fieldValue, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
}
/*考勤二开--转事假start*/
if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) {
bb.writeLog("flowLeaveData: " + flowLeaveData);
double temp = Util.getDoubleValue(Util.null2String(flowData.get("DailyToComLeaveData|" + resourceId + "|" + kqdate)));
bb.writeLog("temp: " + temp);
if (temp >= 0.00) {
flowLeaveData = flowLeaveData + temp;
}
bb.writeLog("flowLeaveData: " + flowLeaveData);
}
/*考勤二开--转事假end*/
fieldValue = flowLeaveData;
data.add(fieldValue);

@ -11,6 +11,7 @@ import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.UtilKQ;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
@ -31,6 +32,8 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
private HttpServletResponse response;
private List<String> lsFieldDataKey;
BaseBean bb = new BaseBean();
public ExportExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
this.user = user;
this.params = params;
@ -273,7 +276,9 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
String fullPathMainKey = "show_full_path";
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
/*考勤二开--转事假start*/
String calLeaveId = bb.getPropValue("project_sskj", "calLeaveId");
/*考勤二开--转事假end*/
rs.execute(sql);
while (rs.next()) {
@ -357,6 +362,20 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
} else {
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
}
/*考勤二开--转事假start*/
if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) {
bb.writeLog("ExportExcelCmd flowLeaveData start ");
bb.writeLog("flowLeaveData: " + flowLeaveData);
double temp = Util.getDoubleValue(Util.null2String(flowData.get("ToComLeaveData|" + resourceId)));
bb.writeLog("temp: " + temp);
if (temp >= 0.00) {
flowLeaveData = flowLeaveData + temp;
}
bb.writeLog("flowLeaveData: " + flowLeaveData);
}
/*考勤二开--转事假end*/
data.add(flowLeaveData);
}
continue;

@ -229,6 +229,9 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
}
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
Map<String,String> serialdata = new HashMap<>();
/*考勤二开--转事假start*/
String calLeaveId = bb.getPropValue("project_sskj", "calLeaveId");
/*考勤二开--转事假end*/
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
String fullPathMainKey = "show_full_path";
@ -393,7 +396,15 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
}
/*考勤二开--转事假start*/
if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) {
bb.writeLog("flowLeaveData: " + flowLeaveData);
double temp = Util.getDoubleValue(Util.null2String(flowData.get("DailyToComLeaveData|" + resourceId + "|" + kqdate)));
bb.writeLog("temp: " + temp);
if (temp >= 0.00) {
flowLeaveData = flowLeaveData + temp;
}
bb.writeLog("flowLeaveData: " + flowLeaveData);
}
/*考勤二开--转事假end*/
data.put(flowType, flowLeaveData);
}

@ -332,7 +332,9 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
params.put("uintType",uintType);
params.put("hoursToDay",hoursToDay);
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
/*考勤二开--转事假start*/
String calLeaveId = bb.getPropValue("project_sskj", "calLeaveId");
/*考勤二开--转事假end*/
rs.execute(sql);
while (rs.next()) {
@ -456,31 +458,45 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
String flowLeaveBackType = Util.null2String("leavebackType_"+leaveRule.get("id"));
String leavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+flowLeaveBackType)),"0.0");
String b_flowLeaveData = "";
String flowLeaveData = "";
String flowLeaveData = "";
try{
//以防止出现精度问题
if(leaveData.length() == 0){
leaveData = "0.0";
}
if(leavebackData.length() == 0){
leavebackData = "0.0";
}
BigDecimal b_leaveData = new BigDecimal(leaveData);
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
b_flowLeaveData = "0.0";
}
}catch (Exception e){
writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e);
}
//以防止出现精度问题
if(leaveData.length() == 0){
leaveData = "0.0";
}
if(leavebackData.length() == 0){
leavebackData = "0.0";
}
BigDecimal b_leaveData = new BigDecimal(leaveData);
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
b_flowLeaveData = "0.0";
}
}catch (Exception e){
writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e);
}
//考虑下冻结的数据
if(b_flowLeaveData.length() > 0){
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
}else{
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0)));
}
/*考勤二开--转事假start*/
if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) {
bb.writeLog("GetKQReportCmd flowLeaveData start ");
bb.writeLog("flowLeaveData: " + flowLeaveData);
double temp = Util.getDoubleValue(Util.null2String(flowData.get("ToComLeaveData|" + resourceId)));
bb.writeLog("temp: " + temp);
if (temp >= 0.00) {
flowLeaveData = flowLeaveData + temp;
}
bb.writeLog("flowLeaveData: " + flowLeaveData);
}
/*考勤二开--转事假end*/
//考虑下冻结的数据
if(b_flowLeaveData.length() > 0){
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
}else{
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0)));
}
data.put(flowType,flowLeaveData);
}

@ -127,31 +127,31 @@ public class SskjUtil {
double tempDecu = 0.00;
if (changeType == 1) {
String acqToCasSql = "select jrjbdkzsj from " + split[0] + " where xm = ? and ny = ?";
String acqToCasSql = "select jrjbsy from " + split[0] + " where xm = ? and ny = ?";
basebean.writeLog("acqToCasSql: " + acqToCasSql);
rs.executeQuery(acqToCasSql, resourceId, kqDate.substring(0,7));
while ( rs.next()) {
tempDecu = Util.getDoubleValue(Util.null2String(rs.getString("psjbdkzsj")));
tempDecu = Util.getDoubleValue(Util.null2String(rs.getString("jrjbsy")));
}
basebean.writeLog("tempDecu: " + tempDecu);
} else if (changeType == 2) {
String acqToCasSql = "select psjbdkzsj from " + split[0] + " where xm = ? and ny = ?";
String acqToCasSql = "select psjbsy from " + split[0] + " where xm = ? and ny = ?";
basebean.writeLog("acqToCasSql: " + acqToCasSql);
rs.executeQuery(acqToCasSql, resourceId, kqDate.substring(0,7));
while ( rs.next()) {
tempDecu = Util.getDoubleValue(Util.null2String(rs.getString("psjbdkzsj")));
tempDecu = Util.getDoubleValue(Util.null2String(rs.getString("psjbsy")));
}
basebean.writeLog("tempDecu: " + tempDecu);
} else if (changeType == 3) {
String acqToCasSql = "select zmjbdkzsj from " + split[0] + " where xm = ? and ny = ?";
String acqToCasSql = "select zmjbsy from " + split[0] + " where xm = ? and ny = ?";
basebean.writeLog("acqToCasSql: " + acqToCasSql);
rs.executeQuery(acqToCasSql, resourceId, kqDate.substring(0,7));
while ( rs.next()) {
tempDecu = Util.getDoubleValue(Util.null2String(rs.getString("psjbdkzsj")));
tempDecu = Util.getDoubleValue(Util.null2String(rs.getString("zmjbsy")));
}
basebean.writeLog("tempDecu: " + tempDecu);
}
@ -174,11 +174,11 @@ public class SskjUtil {
String backField = "";
if (changeType == 1) {
backField = "jrjbdkzsj";
backField = "jrjbsy";
} else if (changeType == 2) {
backField = "psjbdkzsj";
backField = "psjbsy";
} else if (changeType == 3) {
backField = "zmjbdkzsj";
backField = "zmjbsy";
}
basebean.writeLog("backField: " + backField);

@ -73,7 +73,7 @@ public class SyncZkKqDataJob extends BaseCronJob {
String back = doPostJsonRequest(url,heads, JSON.toJSONString(dataMap));
bb.writeLog("urlBack:"+back);
bb.writeLog("获取中控的考勤数据--response:"+back);
List<List<Object>> lsParams = new ArrayList<>();
List<List> lsParams = new ArrayList<>();
List<String> lsFormatData = new ArrayList<>();
Object tempBack = Configuration.defaultConfiguration().jsonProvider().parse(back);
Integer ret = JsonPath.read(tempBack, "$.ret");
@ -84,19 +84,26 @@ public class SyncZkKqDataJob extends BaseCronJob {
for (Map<String, Object> item : items) {
String pin = Util.null2String(item.get("pin"));
String checktime = Util.null2String(item.get("checktime"));
String alias = Util.null2String(item.get("alias"));
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = df.parse(checktime);
DateFormat df2 = new SimpleDateFormat("yyyy-MM-dd");
DateFormat df3 = new SimpleDateFormat("HH:mm:ss");
Integer isimport = 1;
String userid = idWorkcodeMap.get(pin);
String userid = Util.null2String(idWorkcodeMap.get(pin));
Integer usertype = 1;
String signDate = df2.format(date);
String signTime = df3.format(date);
Integer isincom = 1;
String signfrom = "OutDataSourceSyn";
String addr = "";
List<Object> params = new ArrayList<>();
if (StringUtils.isBlank(alias)) {
bb.writeLog("--item:"+item);
}
String addr = alias;
List params = new ArrayList<>();
if (StringUtils.isBlank(userid)) {
continue;
}
params.add(userid);
params.add(usertype);
params.add(signDate);
@ -124,8 +131,8 @@ public class SyncZkKqDataJob extends BaseCronJob {
List<String> overtimeList = Lists.newArrayList();
List<Object> formatParams = null;
List<List<Object>> lsFormatParams = new ArrayList<>();
List<Object> delParams = null;
List<List<Object>> lsDelParams = new ArrayList<>();
List delParams = null;
List<List> lsDelParams = new ArrayList<>();
bb.writeLog("准备刷新报表数据");
//刷新报表数据
@ -165,15 +172,19 @@ public class SyncZkKqDataJob extends BaseCronJob {
String sql = "";
BatchRecordSet bRs = new BatchRecordSet();
RecordSet rsB = new RecordSet();
bb.writeLog("开始同步数据");
//删除本次同步数据
bb.writeLog("lsDelParams: " + lsDelParams);
sql = " delete from hrmschedulesign where signfrom='OutDataSourceSyn' and userid =? and signdate = ? and signtime = ? ";
bRs.executeBatchSql(sql, lsDelParams);
boolean b1 = rsB.executeBatchSql(sql, lsDelParams);
bb.writeLog("b1: " + b1);
sql = " insert into HrmScheduleSign (userid, usertype, signdate, signtime, clientaddress, isincom, isimport, signfrom, longitude, latitude, addr,memo) "
+ " values(?,?,?,?,?,?,?,?,?,?,?,?)";
bRs.executeBatchSql(sql,lsParams);
boolean b2 = rsB.executeBatchSql(sql, lsParams);
bb.writeLog("b2: " + b2);
new KQFormatBiz().format(lsFormatParams);

Loading…
Cancel
Save