|
|
|
@ -3,6 +3,7 @@ package com.engine.kqsolution.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.kqsolution.entity.CustomSignDataParam;
|
|
|
|
|
import com.engine.kqsolution.entity.SignDataPO;
|
|
|
|
|
import com.engine.kqsolution.entity.SignDataParams;
|
|
|
|
|
import com.engine.kqsolution.service.SignDataSummaryService;
|
|
|
|
@ -37,14 +38,96 @@ public class SignDataSummaryServiceImpl extends Service implements SignDataSumma
|
|
|
|
|
|
|
|
|
|
public static final DateTimeFormatter MONTH_FORMATTER_PATTERN = DateTimeFormatter.ofPattern("yyyy-MM");
|
|
|
|
|
|
|
|
|
|
@SneakyThrows
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> recordSignData(SignDataParams signDataParams) {
|
|
|
|
|
List<SignDataPO> list = buildSignData(signDataParams);
|
|
|
|
|
return saveSignData(list,signDataParams);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> customSignData(CustomSignDataParam param) {
|
|
|
|
|
|
|
|
|
|
Map<String,Object> data = new HashMap<>(4);
|
|
|
|
|
List<Integer> idList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
//获取部门下人员id
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
rs.executeQuery("select id from hrmresource where departmentid in ("+param.getDepartments()+")");
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
idList.add(Util.getIntValue(rs.getString("id")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(idList)){
|
|
|
|
|
data.put("msg","部门下未存在人员");
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LocalDate localDate = LocalDate.parse(param.getMonth()+"-01");
|
|
|
|
|
String fromDate = localDate.toString();
|
|
|
|
|
String toDate = localDate.withDayOfMonth(localDate.lengthOfMonth()).toString();
|
|
|
|
|
String ids = StringUtils.join(idList,",");
|
|
|
|
|
rs.executeQuery("select kqdate,resourceid,signindate,signintime,signoutdate,signouttime,signMins from kq_format_detail \n" +
|
|
|
|
|
" where kqdate >= ? and kqdate <= ?" +
|
|
|
|
|
" and resourceid in in ("+ids+")",fromDate,toDate);
|
|
|
|
|
List<SignDataPO> pos = new ArrayList<>();
|
|
|
|
|
DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
String signInTime = Util.null2String(rs.getString("signintime"));
|
|
|
|
|
String signOutTime = Util.null2String(rs.getString("signouttime"));
|
|
|
|
|
if (!"".equals(signInTime)){
|
|
|
|
|
signInTime = signInTime.substring(0,5);
|
|
|
|
|
}
|
|
|
|
|
if (!"".equals(signOutTime)){
|
|
|
|
|
signOutTime = signOutTime.substring(0,5);
|
|
|
|
|
}
|
|
|
|
|
Integer signMins = Util.getIntValue(Util.null2String(rs.getString("signMins")),0);
|
|
|
|
|
double hours = (double) signMins / 60;
|
|
|
|
|
double workHours;
|
|
|
|
|
if (hours <= 4.0) {
|
|
|
|
|
workHours = hours;
|
|
|
|
|
} else {
|
|
|
|
|
workHours = Math.floor(hours - 1.0);
|
|
|
|
|
}
|
|
|
|
|
SignDataPO build = SignDataPO.builder()
|
|
|
|
|
.resourceId(Util.getIntValue(rs.getString("resourceid")))
|
|
|
|
|
.attendanceDate(Util.null2String(rs.getString("kqdate")))
|
|
|
|
|
.signInDate(Util.null2String(rs.getString("signindate")))
|
|
|
|
|
.signInTime(signInTime)
|
|
|
|
|
.signOutDate(Util.null2String(rs.getString("signoutdate")))
|
|
|
|
|
.signOutTime(signOutTime)
|
|
|
|
|
.signHours(Double.parseDouble(decimalFormat.format(hours)))
|
|
|
|
|
.workHours(Double.parseDouble(decimalFormat.format(workHours)))
|
|
|
|
|
.build();
|
|
|
|
|
pos.add(build);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RecordSetTrans rst = new RecordSetTrans();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(pos)) {
|
|
|
|
|
try {
|
|
|
|
|
rst.setAutoCommit(false);
|
|
|
|
|
|
|
|
|
|
for (SignDataPO item : pos) {
|
|
|
|
|
rst.executeUpdate("update uf_kqgs set qdrq = ?,qdsj = ?,qtrq = ?,qtsj = ?,dkgssc = ?,sjgssc = ? where kqrq = ? and xm=? and zt = 0",item.getSignInDate(),
|
|
|
|
|
item.getSignInTime(),item.getSignOutDate(),item.getSignOutTime(),item.getSignHours(),item.getWorkHours(),item.getAttendanceDate(),item.getResourceId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rst.commit();
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
rst.rollback();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SneakyThrows
|
|
|
|
|
private Map<String, Object> saveSignData(List<SignDataPO> list,SignDataParams signDataParams){
|
|
|
|
|
Map<String,Object> data = new HashMap<>(4);
|
|
|
|
|
DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
|
|
|
|
RecordSetTrans rst = new RecordSetTrans();
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
List<SignDataPO> list = buildSignData(signDataParams);
|
|
|
|
|
ResourceComInfo rcom = new ResourceComInfo();
|
|
|
|
|
int corePoolSize = 5;
|
|
|
|
|
int maxPoolSize = 10;
|
|
|
|
@ -111,7 +194,6 @@ public class SignDataSummaryServiceImpl extends Service implements SignDataSumma
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
rst.rollback();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -183,6 +265,8 @@ public class SignDataSummaryServiceImpl extends Service implements SignDataSumma
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description: 集合分割
|
|
|
|
|
* @Author: liang.cheng
|
|
|
|
|