考勤,出勤津贴数据生成逻辑优化

zm_dev
sy 1 year ago
parent 5b933ca3bf
commit 892d22415e

@ -24,6 +24,8 @@ public class AllowanceServiceImpl extends Service implements AllowanceService {
BaseBean bs = new BaseBean();
@Override
public Map<String, Object> addAllowanceRecords(Map<String, Object> params) {
Map<String, Object> result = new HashMap<>();
try {
//获取modeId考勤方案的modeId
Map<String,String> formmodeIdMap = Utils.getFormmodeIdMap();
@ -64,9 +66,10 @@ public class AllowanceServiceImpl extends Service implements AllowanceService {
}
//构建班次和津贴映射关系
Map<String, Map<String, Object>> allowanceIdWithKqxmInfo = new HashMap<>();
Map<String, List<String>> bcWithAllowanceInfo = new HashMap<>();
if (targetAllowanceIdList.size() > 0) {
String bcSql = "select * from uf_jcl_kq_kqxm where id in ("+String.join(",",targetAllowanceIdList) + ") and sydbc is not null ";
List<Map<String, Object>> bcData = DbTools.getSqlToList(bcSql);
Map<String, List<String>> bcWithAllowanceInfo = new HashMap<>();
for (Map<String, Object> map : bcData) {
String bcArr = map.get("sydbc").toString();
String allowanceId = map.get("id").toString();
@ -83,12 +86,17 @@ public class AllowanceServiceImpl extends Service implements AllowanceService {
}
});
}
}
//获取出勤结果,遍历处理津贴信息
String startDate = Util.null2String(params.get("startDate"));
String endDate = Util.null2String(params.get("endDate"));
List<Map<String, Object>> cqData = new ArrayList<>();
if (targetEmpIdList.size() > 0 && targetBcIdList.size() > 0) {
String cqSql = "select * from uf_jcl_kq_cqjg where ygid in ("+String.join(",",targetEmpIdList) + ") and rq >= '" + startDate +"'" + " and rq <= '" + endDate +"'"
+ " and bc in ("+String.join(",",targetBcIdList) + ")";
List<Map<String, Object>> cqData = DbTools.getSqlToList(cqSql);
cqData = DbTools.getSqlToList(cqSql);
}
bs.writeLog("cqData_size : " + cqData.size());
bs.writeLog("empIdWithAllowanceInfo : " + empIdWithAllowanceInfo);
bs.writeLog("bcWithAllowanceInfo : " + bcWithAllowanceInfo);
@ -96,6 +104,7 @@ public class AllowanceServiceImpl extends Service implements AllowanceService {
//获取待新增的津贴数据
List<Map<String, String>> allowanceInfoList = createAllowanceInfo(cqData, empIdWithAllowanceInfo, bcWithAllowanceInfo, allowanceIdWithKqxmInfo);
bs.writeLog("allowanceInfoList_size : " + allowanceInfoList.size());
if (allowanceInfoList.size() > 0) {
//新增津贴数据,先删后加
String delSql = "delete from uf_jcl_kq_cqjt where rq >= '" + startDate +"'" + " and rq <= '" + endDate +"'"
+ " and yg in (" + String.join(",",targetEmpIdList) + ") and bc in (" + String.join(",",targetBcIdList) + ")";
@ -121,11 +130,14 @@ public class AllowanceServiceImpl extends Service implements AllowanceService {
bs.writeLog("津贴数据记录入库开始---");
boolean insertSign =rs.executeBatchSql(insertSql,dataList);
bs.writeLog("insertSign : " + insertSign);
result.put("result", insertSign);
}
}
} catch (Exception e) {
bs.errorLog("catch error :{}",e);
}
return null;
return result;
}
private List<Map<String, String>> createAllowanceInfo(List<Map<String, Object>> cqData, Map<String, List<String>> empIdWithAllowanceInfo, Map<String

@ -282,7 +282,7 @@ public class CommonUtil {
String minSecurityLevel = map.get("minSecurityLevel");
String maxSecurityLevel = map.get("maxSecurityLevel");
//查询目标人员信息
String querySql = "select * from hrmresouorce where id = " + id;
String querySql = "select * from hrmresource where id = " + id;
if (!minSecurityLevel.equals("")) {
querySql = querySql + " and seclevel >= " +minSecurityLevel;
}
@ -301,8 +301,10 @@ public class CommonUtil {
String maxSecurityLevel = map.get("maxSecurityLevel");
//获取分组包含人员id
List<String> empIdsByGroup = getEmpGroupUserIds(id);
log.info("empGroupId : " + id + ", empIdsByGroup : " + empIdsByGroup);
//查询目标人员信息
String querySql = "select * from hrmresouorce where id = in ("+String.join(",",empIdsByGroup)+")";
if (empIdsByGroup.size() > 0) {
String querySql = "select * from hrmresource where id = in ("+String.join(",",empIdsByGroup)+")";
if (!minSecurityLevel.equals("")) {
querySql = querySql + " and seclevel >= " +minSecurityLevel;
}
@ -314,13 +316,14 @@ public class CommonUtil {
datas.forEach(f -> empIdList.add(f.get("id").toString()));
}
}
}
//部门类型
for (Map<String, String> map : depIdInfos) {
String id = map.get("id");
String minSecurityLevel = map.get("minSecurityLevel");
String maxSecurityLevel = map.get("maxSecurityLevel");
//查询目标人员信息
String querySql = "select * from hrmresouorce where departmentid = " + id;
String querySql = "select * from hrmresource where departmentid = " + id;
if (!minSecurityLevel.equals("")) {
querySql = querySql + " and seclevel >= " +minSecurityLevel;
}
@ -338,7 +341,7 @@ public class CommonUtil {
String minSecurityLevel = map.get("minSecurityLevel");
String maxSecurityLevel = map.get("maxSecurityLevel");
//查询目标人员信息
String querySql = "select * from hrmresouorce where subcompanyid1 = " + id;
String querySql = "select * from hrmresource where subcompanyid1 = " + id;
if (!minSecurityLevel.equals("")) {
querySql = querySql + " and seclevel >= " +minSecurityLevel;
}

Loading…
Cancel
Save