人员标识
This commit is contained in:
parent
f74b992523
commit
3cefcb0305
|
|
@ -1,15 +1,11 @@
|
|||
package com.api.bjcj220907.web;
|
||||
|
||||
import com.engine.bjcj220907.web.EmployeeIdentifiedController;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @description 人员标识
|
||||
* @return null
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/1 10:12
|
||||
*/
|
||||
@Path("/bs/EmployeeIdentifiedWeb")
|
||||
public class EmployeeIdentifiedWeb extends EmployeeIdentifiedController {
|
||||
}
|
||||
//@Path("/bs/EmployeeIdentifiedWeb")
|
||||
//public class EmployeeIdentifiedWeb extends EmployeeIdentifiedController {
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.engine.bjcj220907.constant;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/01 17:08
|
||||
* @description 人员标识常量
|
||||
*/
|
||||
public class EmployeeIdentifiedConstant {
|
||||
|
||||
/**
|
||||
* 员工入职状态
|
||||
*/
|
||||
public static final int EMPLOYEE_STATE_RZ = 1 ;
|
||||
/**
|
||||
* 员工转正状态
|
||||
*/
|
||||
public static final int EMPLOYEE_STATE_ZZ = 2 ;
|
||||
/**
|
||||
* 员工调动状态
|
||||
*/
|
||||
public static final int EMPLOYEE_STATE_DD = 3 ;
|
||||
|
||||
/**
|
||||
* 境内员工
|
||||
*/
|
||||
public static final int JN_EMPLOYEE = 0 ;
|
||||
|
||||
/**
|
||||
* 境外员工
|
||||
*/
|
||||
public static final int JW_EMPLOYEE = 1 ;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,15 @@
|
|||
package com.engine.bjcj220907.dao;
|
||||
|
||||
import com.engine.bjcj220907.entity.Rybs;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/01 13:37
|
||||
|
|
@ -7,12 +17,64 @@ package com.engine.bjcj220907.dao;
|
|||
*/
|
||||
public class EmployeeIdentifiedDAO {
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
|
||||
/**
|
||||
* @description 获取所有人员标识信息
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/1 13:39
|
||||
*/
|
||||
public void getList() {
|
||||
public List<Rybs> getAllList() {
|
||||
RecordSet rs = new RecordSet();
|
||||
ArrayList<Rybs> rybs = new ArrayList<>();
|
||||
String sql="select * from uf_rybs WHERE rz=0 or zz=0 or dd=0 or lz=0";
|
||||
rs.execute(sql);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
while (rs.next()){
|
||||
try {
|
||||
Date lzrq = (rs.getString("lzrq") == "" ? null : sdf.parse(rs.getString("lzrq")));
|
||||
Date ksczrq = (rs.getString("ksczrq") == "" ? null : sdf.parse(rs.getString("ksczrq")));
|
||||
Date jsczrq = (rs.getString("jsczrq") == "" ? null : sdf.parse(rs.getString("jsczrq")));
|
||||
Date rzrq = (rs.getString("rzrq") == "" ? null : sdf.parse(rs.getString("rzrq")));
|
||||
Date zzrq = (rs.getString("zzrq") == "" ? null : sdf.parse(rs.getString("zzrq")));
|
||||
Date ddrq = (rs.getString("ddrq") == "" ? null : sdf.parse(rs.getString("ddrq")));
|
||||
Rybs build = Rybs.builder().id(rs.getInt("id")).xm(rs.getInt("xm")).lzrq(lzrq).ryzt(rs.getInt("ryzt")).ksczrq(ksczrq)
|
||||
.jsczrq(jsczrq).rzrq(rzrq).zzrq(zzrq).ddrq(ddrq).dd(rs.getInt("dd")).lz(rs.getInt("lz"))
|
||||
.sxfx(rs.getInt("sxfx")).jnjw(rs.getInt("jnjw")).zz(rs.getInt("zz")).rz(rs.getInt("rz")).build();
|
||||
rybs.add(build);
|
||||
} catch (ParseException e) {
|
||||
bb.writeLog("日期转换错误"+e);
|
||||
}
|
||||
}
|
||||
return rybs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 更新入转调离信息
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/1 18:03
|
||||
*/
|
||||
public void updateRybsInfo(List<Rybs> updateRybsInfo) {
|
||||
RecordSet rs = new RecordSet();
|
||||
for(Rybs rybs : updateRybsInfo){
|
||||
String sql = "update uf_RYBS set RZ="+rybs.getRz() + ",zz=" + rybs.getZz() +",dd=" +rybs.getDd() + ",lz=" +rybs.getLz() +"where id =" + rybs.getId();
|
||||
rs.execute(sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 更新境内外信息
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/1 18:03
|
||||
*/
|
||||
public void UpdateJnjwInfo(List<Rybs> updateJnjwInfo) {
|
||||
RecordSet rs = new RecordSet();
|
||||
for(Rybs rybs : updateJnjwInfo){
|
||||
String sql = "update uf_RYBS set JNJW ="+rybs.getJnjw() + "where id =" + rybs.getId();
|
||||
rs.execute(sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import java.util.Date;
|
|||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/15 11:19
|
||||
* @description
|
||||
* @description 离职信息
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
|
|
|
|||
|
|
@ -1,11 +1,17 @@
|
|||
package com.engine.bjcj220907.service.impl;
|
||||
|
||||
import com.engine.bjcj220907.constant.EmployeeIdentifiedConstant;
|
||||
import com.engine.bjcj220907.dao.EmployeeIdentifiedDAO;
|
||||
import com.engine.bjcj220907.entity.Rybs;
|
||||
import com.engine.bjcj220907.service.EmployeeIdentifiedService;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.weaver.general.BaseBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
|
|
@ -28,7 +34,178 @@ public class EmployeeIdentifiedServiceImpl extends Service implements EmployeeId
|
|||
*/
|
||||
@Override
|
||||
public void updateIdentified(Calendar cal) {
|
||||
// 获取所有人员标识信息
|
||||
getEmployeeIdentifiedDAO().getList();
|
||||
// 获取所有含有入职、转正、调岗、离职信息的人员标识信息
|
||||
List<Rybs> list = getEmployeeIdentifiedDAO().getAllList();
|
||||
baseBean.writeLog("获取所有含有入职、转正、调岗、离职信息的人员标识信息,共:"+list.size());
|
||||
// 获取更新入转调离信息
|
||||
List<Rybs> updateRybsInfo = getUpdateRybsInfo(list, cal);
|
||||
baseBean.writeLog("获取更新入转调离信息,共"+updateRybsInfo.size()+"条,:",updateRybsInfo);
|
||||
// 获取更新境内外信息
|
||||
List<Rybs> UpdateJnjwInfo = getUpdateJnjwInfo(list,cal);
|
||||
baseBean.writeLog("获取更新境内外信息,共"+UpdateJnjwInfo.size()+"条,:",UpdateJnjwInfo);
|
||||
// 更新入转调离信息
|
||||
getEmployeeIdentifiedDAO().updateRybsInfo(updateRybsInfo);
|
||||
baseBean.writeLog("更新入转调离信息");
|
||||
// 更新境内外信息
|
||||
getEmployeeIdentifiedDAO().UpdateJnjwInfo(UpdateJnjwInfo);
|
||||
baseBean.writeLog("更新境内外信息");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 获取更新人员入转调离标识信息
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/1 14:53
|
||||
*/
|
||||
private List<Rybs> getUpdateRybsInfo(List<Rybs> list,Calendar cal) {
|
||||
if(cal.get(Calendar.DATE) == 1) {
|
||||
// 每月1号
|
||||
return list.stream().filter(info -> {
|
||||
boolean flag = false;
|
||||
// 是1号,需要判断更新入转调
|
||||
// 是否入职
|
||||
if (info.getRz() == 0) {
|
||||
Date rzrq = info.getRzrq();
|
||||
Calendar nextNextMonthCal = getNextNextMonthCal(rzrq);
|
||||
if (nextNextMonthCal == null) {
|
||||
baseBean.writeLog(info.getXm() + "的入职日期获取失败");
|
||||
return false;
|
||||
}
|
||||
// 判断cal的月份是否和nextNextMonthCal在同一个月
|
||||
if (checkMonth(cal, nextNextMonthCal)) {
|
||||
info.setRz(1);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
// 是否转正
|
||||
if (info.getZz() == 0) {
|
||||
Date zzrq = info.getZzrq();
|
||||
Calendar nextNextMonthCal = getNextNextMonthCal(zzrq);
|
||||
if (nextNextMonthCal == null) {
|
||||
baseBean.writeLog(info.getXm() + "的转正日期获取失败");
|
||||
return false;
|
||||
}
|
||||
// 判断cal的月份是否和nextNextMonthCal在同一个月
|
||||
if (checkMonth(cal, nextNextMonthCal)) {
|
||||
info.setZz(1);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
// 是否调动
|
||||
if (info.getDd() == 0) {
|
||||
Date ddrq = info.getDdrq();
|
||||
Calendar nextNextMonthCal = getNextNextMonthCal(ddrq);
|
||||
if (nextNextMonthCal == null) {
|
||||
baseBean.writeLog(info.getXm() + "的调动日期获取失败");
|
||||
return false;
|
||||
}
|
||||
// 判断cal的月份是否和nextNextMonthCal在同一个月
|
||||
if (checkMonth(cal, nextNextMonthCal)) {
|
||||
info.setDd(1);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
}else{
|
||||
baseBean.writeLog("不是1号,无需更新人员标识");
|
||||
return new ArrayList<Rybs>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取更新境内外信息
|
||||
* @return List<Rybs>
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/1 16:25
|
||||
*/
|
||||
private List<Rybs> getUpdateJnjwInfo(List<Rybs> list, Calendar cal) {
|
||||
return list.stream().filter(info -> {
|
||||
boolean flag = false;
|
||||
Date ksczrq = info.getKsczrq();
|
||||
if(ksczrq != null){
|
||||
Integer jnjw = info.getJnjw();
|
||||
Date jsczrq = info.getJsczrq();
|
||||
if(jsczrq == null){
|
||||
// 没有结束常驻日期,判断常驻开始日期是cal前还是后
|
||||
if(ksczrq.before(cal.getTime()) || ksczrq.equals(cal.getTime())){
|
||||
// 是境外员工
|
||||
if(jnjw != EmployeeIdentifiedConstant.JW_EMPLOYEE){
|
||||
info.setJnjw(EmployeeIdentifiedConstant.JW_EMPLOYEE);
|
||||
flag = true;
|
||||
}
|
||||
}else{
|
||||
// 是境内员工
|
||||
if(jnjw != EmployeeIdentifiedConstant.JN_EMPLOYEE){
|
||||
info.setJnjw(EmployeeIdentifiedConstant.JN_EMPLOYEE);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
// 有开始常驻日期,判断是否在常驻期内
|
||||
boolean inRange = isInRange(cal.getTime(), ksczrq, jsczrq);
|
||||
if(inRange){
|
||||
// 在常驻期内
|
||||
if(jnjw != EmployeeIdentifiedConstant.JW_EMPLOYEE){
|
||||
info.setJnjw(EmployeeIdentifiedConstant.JW_EMPLOYEE);
|
||||
flag = true;
|
||||
}
|
||||
}else {
|
||||
// 不在常驻期内
|
||||
if(jnjw != EmployeeIdentifiedConstant.JN_EMPLOYEE){
|
||||
info.setJnjw(EmployeeIdentifiedConstant.JN_EMPLOYEE);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取下下个月的Calendar
|
||||
* @return Calendar
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/1 15:12
|
||||
*/
|
||||
private Calendar getNextNextMonthCal(Date date){
|
||||
if(date==null){
|
||||
return null;
|
||||
}
|
||||
Calendar nextNextMonthCal = Calendar.getInstance();
|
||||
nextNextMonthCal.setTime(date);
|
||||
nextNextMonthCal.add(Calendar.MONTH,2);
|
||||
return nextNextMonthCal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 判断cal的月份是否和nextNextMonthCal在同一个月
|
||||
* @return null
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/1 15:10
|
||||
*/
|
||||
private boolean checkMonth(Calendar cal,Calendar nextNextMonthCal){
|
||||
return cal.get(Calendar.MONTH) == nextNextMonthCal.get(Calendar.MONTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 判断某一天是否在日期区间内
|
||||
* @return boolean
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/1 16:49
|
||||
*/
|
||||
private boolean isInRange(Date day,Date benginDate,Date endDate){
|
||||
if( (day.after(benginDate) || day.equals(benginDate)) && (day.before(endDate) || day.equals(endDate)) ){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class GetKQ4OverseasAllowanceCountServiceImpl extends Service implements
|
|||
countEndCal.add(Calendar.DATE,-1);
|
||||
}
|
||||
baseBean.writeLog("获取缺勤日期为:"+attDateList);
|
||||
baseBean.writeLog("dataList:"+dataList);
|
||||
// baseBean.writeLog("dataList:"+dataList);
|
||||
dataList.stream().forEach(i->{
|
||||
if(users.contains(i.get("resourceId"))){
|
||||
List<Date> qqDate = new ArrayList<>();
|
||||
|
|
@ -87,14 +87,13 @@ public class GetKQ4OverseasAllowanceCountServiceImpl extends Service implements
|
|||
Map attCalMap =(Map) o;
|
||||
attCal = (String)attCalMap.get("text");
|
||||
}catch (Exception e){
|
||||
baseBean.writeLog("考勤数据:"+o+"转换为Map失败");
|
||||
attCal="休息";
|
||||
}
|
||||
if( (attCal.contains("旷工")) || ( (!attCal.equals("√")) && (!attCal.contains("休息")) && (!attCal.equals("")) && (!attCal.contains("境内年假")) && (!attCal.contains("境外年假")) && (!attCal.contains("工伤")) && (!attCal.contains("奖励假")) ) ){
|
||||
// 存在缺勤
|
||||
qqDate.add(a);
|
||||
baseBean.writeLog(attCal+"缺勤");
|
||||
}else{
|
||||
baseBean.writeLog(attCal+"不缺勤");
|
||||
}
|
||||
});
|
||||
String qqStr = i.get("resourceId") +"-qq";
|
||||
|
|
|
|||
|
|
@ -6,14 +6,10 @@ import com.engine.bjcj220907.utils.BjcjCommonUtils;
|
|||
import com.engine.common.util.ServiceUtil;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
|
|
@ -21,26 +17,54 @@ import java.util.Calendar;
|
|||
* @date 2022/11/01 10:15
|
||||
* @description 员工标识
|
||||
*/
|
||||
public class EmployeeIdentifiedController {
|
||||
public class EmployeeIdentifiedController extends BaseCronJob {
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
|
||||
private EmployeeIdentifiedService getEmployeeIdentifiedService(User user) {
|
||||
return ServiceUtil.getService(EmployeeIdentifiedServiceImpl.class,user);
|
||||
}
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
private String testData;
|
||||
|
||||
@GET
|
||||
@Path("/updateEmployeeIdentified")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public void updateEmployeeIdentified(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
@Override
|
||||
public void execute() {
|
||||
User user1 = new User();
|
||||
user1.setUid(1);
|
||||
user1.setLoginid("sysadmin");
|
||||
user1.setSeclevel("30");
|
||||
user1.setLanguage(7);
|
||||
Calendar cal = BjcjCommonUtils.getNowCalendar();
|
||||
if(testData != null && testData != ""){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
try {
|
||||
cal.setTime(sdf.parse(testData));
|
||||
} catch (ParseException e) {}
|
||||
}
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
baseBean.writeLog("开始更新:"+cal.getTime()+"的人员标识");
|
||||
getEmployeeIdentifiedService(user1).updateIdentified(cal);
|
||||
}
|
||||
|
||||
// @POST
|
||||
// @Path("/updateEmployeeIdentified")
|
||||
// @Produces(MediaType.APPLICATION_JSON)
|
||||
// public void updateEmployeeIdentified(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
// User user1 = new User();
|
||||
// user1.setUid(1);
|
||||
// user1.setLoginid("sysadmin");
|
||||
// user1.setSeclevel("30");
|
||||
// user1.setLanguage(7);
|
||||
// Calendar cal = BjcjCommonUtils.getNowCalendar();
|
||||
// cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
// cal.set(Calendar.MINUTE, 0);
|
||||
// cal.set(Calendar.SECOND, 0);
|
||||
// cal.set(Calendar.MILLISECOND, 0);
|
||||
// baseBean.writeLog("开始更新:"+cal.getTime()+"的人员标识");
|
||||
// getEmployeeIdentifiedService(user1).updateIdentified(cal);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue