|
|
|
@ -14,7 +14,7 @@ import java.util.*;
|
|
|
|
|
|
|
|
|
|
public class KqWorkflowServiceImpl extends Service implements KqWorkflowService {
|
|
|
|
|
|
|
|
|
|
BaseBean basebean = new BaseBean();
|
|
|
|
|
BaseBean bb = new BaseBean();
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> calWorkTime(Map<String, Object> params) {
|
|
|
|
@ -22,9 +22,9 @@ public class KqWorkflowServiceImpl extends Service implements KqWorkflowService
|
|
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
String startTime = Util.null2String(params.get("starttime"));
|
|
|
|
|
basebean.writeLog("startTime: " + startTime);
|
|
|
|
|
bb.writeLog("startTime: " + startTime);
|
|
|
|
|
String endTime = Util.null2String(params.get("endtime"));
|
|
|
|
|
basebean.writeLog("endTime: " + endTime);
|
|
|
|
|
bb.writeLog("endTime: " + endTime);
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(startTime) || StringUtils.isBlank(endTime)) {
|
|
|
|
|
result.put("code",500);
|
|
|
|
@ -39,10 +39,10 @@ public class KqWorkflowServiceImpl extends Service implements KqWorkflowService
|
|
|
|
|
}
|
|
|
|
|
SskjUtil sskjUtil = new SskjUtil();
|
|
|
|
|
long time = sskjUtil.getTime(startTime, endTime);
|
|
|
|
|
basebean.writeLog("time: " + time);
|
|
|
|
|
bb.writeLog("time: " + time);
|
|
|
|
|
|
|
|
|
|
String betweenHours = KQDurationCalculatorUtil.getDurationRound(String.valueOf(Util.getDoubleValue(time+"")/60.0));
|
|
|
|
|
basebean.writeLog("betweenHours: " + betweenHours);
|
|
|
|
|
bb.writeLog("betweenHours: " + betweenHours);
|
|
|
|
|
|
|
|
|
|
result.put("code",200);
|
|
|
|
|
result.put("data",betweenHours);
|
|
|
|
@ -53,7 +53,7 @@ public class KqWorkflowServiceImpl extends Service implements KqWorkflowService
|
|
|
|
|
public Map<String, Object> checkConOverTime(Map<String, Object> params) {
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|
|
BaseBean bb = new BaseBean();
|
|
|
|
|
|
|
|
|
|
bb.writeLog("checkConOverTime start");
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
@ -113,6 +113,10 @@ public class KqWorkflowServiceImpl extends Service implements KqWorkflowService
|
|
|
|
|
int toTimeIdx = kqTimesArrayComInfo.getArrayindexByTimes(toTime);
|
|
|
|
|
bb.writeLog("toTimeIdx: " + toTimeIdx );
|
|
|
|
|
|
|
|
|
|
if (fromDate.compareTo(toDate) < 0 ) {
|
|
|
|
|
toTimeIdx = toTimeIdx + 1440;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//先判断是否已经存在了
|
|
|
|
|
boolean isExist = false;
|
|
|
|
|
for (int i = fromTimeIdx; i <= toTimeIdx; i++) {
|
|
|
|
@ -140,7 +144,7 @@ public class KqWorkflowServiceImpl extends Service implements KqWorkflowService
|
|
|
|
|
|
|
|
|
|
resToOvInMap.put(resourceId, dayMins);
|
|
|
|
|
} else {
|
|
|
|
|
int[] dayMins = new int[1440];//一天所有分钟数
|
|
|
|
|
int[] dayMins = new int[2880];//一天所有分钟数
|
|
|
|
|
|
|
|
|
|
bb.writeLog("fromTime: " + fromTime );
|
|
|
|
|
int fromTimeIdx = kqTimesArrayComInfo.getArrayindexByTimes(fromTime);
|
|
|
|
@ -150,6 +154,10 @@ public class KqWorkflowServiceImpl extends Service implements KqWorkflowService
|
|
|
|
|
int toTimeIdx = kqTimesArrayComInfo.getArrayindexByTimes(toTime);
|
|
|
|
|
bb.writeLog("toTimeIdx: " + toTimeIdx );
|
|
|
|
|
|
|
|
|
|
if (fromDate.compareTo(toDate) < 0 ) {
|
|
|
|
|
toTimeIdx = toTimeIdx + 1440;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Arrays.fill(dayMins, fromTimeIdx, toTimeIdx, 1);//加班时段标识 1
|
|
|
|
|
resToOvInMap.put(resourceId, dayMins);
|
|
|
|
|
}
|
|
|
|
@ -189,16 +197,21 @@ public class KqWorkflowServiceImpl extends Service implements KqWorkflowService
|
|
|
|
|
|
|
|
|
|
//获取已有的连班加班的数据--(此处连班加班指班次的休息时间)
|
|
|
|
|
//设置一个时间轴数组,长度为一天的分钟数
|
|
|
|
|
int[] dayMins = new int[1440];//一天所有分钟数
|
|
|
|
|
int[] dayMins = new int[2880];//一天所有分钟数
|
|
|
|
|
Arrays.fill(dayMins, 0);
|
|
|
|
|
String acqConOverTimeSql = "select fromTime, toTime from uf_conOvertime where resourceId = ? and fromDate = ? and toDate = ?";
|
|
|
|
|
String acqConOverTimeSql = "select fromDate, fromTime, toDate, toTime from uf_conOvertime where resourceId = ? and fromDate = ? and toDate = ?";
|
|
|
|
|
rs.executeQuery(acqConOverTimeSql, resourceId, fromDate, toDate);
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
String fTime = Util.null2String(rs.getString("fromTime"));
|
|
|
|
|
String fDate = Util.null2String(rs.getString("fromDate"));
|
|
|
|
|
String tTime = Util.null2String(rs.getString("toTime"));
|
|
|
|
|
String tDate = Util.null2String(rs.getString("toDate"));
|
|
|
|
|
//将时间转成时间轴上对应的点
|
|
|
|
|
int fTimeIdx = kqTimesArrayComInfo.getArrayindexByTimes(fTime);
|
|
|
|
|
int tTimeIdx = kqTimesArrayComInfo.getArrayindexByTimes(tTime);
|
|
|
|
|
if (fDate.compareTo(tDate) < 0) {
|
|
|
|
|
tTimeIdx = tTimeIdx +1440;
|
|
|
|
|
}
|
|
|
|
|
Arrays.fill(dayMins, fTimeIdx, tTimeIdx, 1);//加班时段标识 1
|
|
|
|
|
}
|
|
|
|
|
int fromTimeIdx = kqTimesArrayComInfo.getArrayindexByTimes(fromTime);
|
|
|
|
@ -236,4 +249,45 @@ public class KqWorkflowServiceImpl extends Service implements KqWorkflowService
|
|
|
|
|
result.put("msg","加班数据没有重复");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> importOverTime(Map<String, Object> params) {
|
|
|
|
|
|
|
|
|
|
bb.writeLog("importOverTime start");
|
|
|
|
|
|
|
|
|
|
String coiledWf = Util.null2String(bb.getPropValue("project_sskj", "coiledOverTimeWorkflow"));
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(coiledWf)) {
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
//流程明细表中获取没有加班时长的数据
|
|
|
|
|
List< Map< String, Object>> overtimeInfos = new ArrayList<>();
|
|
|
|
|
String acqSql = "select id, ksrq, kssj, jsrq, jssj from " + coiledWf + " where jbsch is null ";
|
|
|
|
|
rs.executeQuery(acqSql);
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
String id = Util.null2String(rs.getString("id"));
|
|
|
|
|
String ksrq = Util.null2String(rs.getString("ksrq"));
|
|
|
|
|
String kssj = Util.null2String(rs.getString("kssj"));
|
|
|
|
|
String jsrq = Util.null2String(rs.getString("jsrq"));
|
|
|
|
|
String jssj = Util.null2String(rs.getString("jssj"));
|
|
|
|
|
Map< String, Object> overtimeInfo = new HashMap<>();
|
|
|
|
|
overtimeInfo.put("id", id);
|
|
|
|
|
overtimeInfo.put("starttime", ksrq + " " + kssj);
|
|
|
|
|
overtimeInfo.put("endtime", jsrq + " " + jssj);
|
|
|
|
|
overtimeInfos.add(overtimeInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String syncSql = "update " + coiledWf + " set jbsch = ? where id = ?";
|
|
|
|
|
for (Map< String, Object> overtimeInfo : overtimeInfos) {
|
|
|
|
|
String id = Util.null2String(overtimeInfo.get("id"));
|
|
|
|
|
Map<String, Object> stringObjectMap = this.calWorkTime(overtimeInfo);
|
|
|
|
|
if (Util.null2String(stringObjectMap.get("code")).equals("200")) {
|
|
|
|
|
rs.executeUpdate(syncSql, Util.null2String(stringObjectMap.get("data")), id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|