北京城建 1-月度绩效计算 2-境外出差补贴计算
This commit is contained in:
commit
65c07e5960
|
|
@ -0,0 +1,15 @@
|
|||
/weaver-hrm-salary.iml
|
||||
/out/
|
||||
/.idea/
|
||||
|
||||
HELP.md
|
||||
target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
|
||||
/src/test
|
||||
/src/META-INF
|
||||
|
||||
/log
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.api.bjcj220907.web;
|
||||
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/06 17:40
|
||||
* @description 境外出差计算
|
||||
*/
|
||||
//@Path("/bs/bjcj")
|
||||
//public class bjweb extends AbroadBusinessCountController {
|
||||
//}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.api.bjcj220907.web;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/08 13:51
|
||||
* @description 月度绩效奖金计算
|
||||
*/
|
||||
//@Path("/bs/MonthBonus")
|
||||
//public class MonthBonusCountWeb extends MonthBonusCountController {
|
||||
//}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.engine.bjcj220907.constant;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/05 13:07
|
||||
* @description 境外出差天数常量
|
||||
*/
|
||||
public class AbroadBusinessCountConstant {
|
||||
|
||||
/**
|
||||
* 工作类型为境外出差
|
||||
*/
|
||||
public static final String ABROADBUSINESS_LX= "5";
|
||||
}
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
package com.engine.bjcj220907.dao;
|
||||
|
||||
|
||||
import com.engine.bjcj220907.constant.AbroadBusinessCountConstant;
|
||||
import com.engine.bjcj220907.entity.AbroadBusiness;
|
||||
import com.engine.bjcj220907.entity.AbroadBusinessResult;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/05 14:58
|
||||
* @description 境外出差计算
|
||||
*/
|
||||
public class AbroadBusinessDAO {
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
|
||||
/**
|
||||
* @description 从境外工作记录表中查询该员工所有国外出差数据
|
||||
* @return List<AbroadBusiness>
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/5 15:08
|
||||
*/
|
||||
public List<AbroadBusiness> getList(){
|
||||
RecordSet rs = new RecordSet();
|
||||
ArrayList<AbroadBusiness> abroadBusinesses = new ArrayList<AbroadBusiness>();
|
||||
String sql ="select DISTINCT XM,JWGZKSRQ,JWGZJSRQ,JWGZDW1 from uf_njjmb_dt1 t LEFT JOIN uf_njjmb m on t.MAINID=m.id WHERE lx='"+ AbroadBusinessCountConstant.ABROADBUSINESS_LX +"'order by JWGZKSRQ ASC";
|
||||
rs.execute(sql);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
while (rs.next()){
|
||||
try {
|
||||
// 境外工作开始、结束时间
|
||||
Date startDate = sdf.parse(rs.getString("JWGZKSRQ"));
|
||||
Date endDate = sdf.parse(rs.getString("JWGZJSRQ"));
|
||||
AbroadBusiness build = AbroadBusiness.builder().user(rs.getInt("XM"))
|
||||
.jwgzdw(rs.getInt("JWGZDW1"))
|
||||
.jwgzkssj(startDate)
|
||||
.jwgzjssj(endDate)
|
||||
.build();
|
||||
abroadBusinesses.add(build);
|
||||
} catch (ParseException e) {
|
||||
// throw new ECException("时间不正确");
|
||||
}
|
||||
}
|
||||
|
||||
return abroadBusinesses;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* @description 获取岗级、薪点、薪酬等级、补贴标准信息
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/7 9:05
|
||||
*/
|
||||
public void getJobInfo(AbroadBusinessResult result) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql="select xm,gj,xd,sxrq from uf_xczjbd WHERE lx=1 and xm="+result.getUser()+" order by sxrq desc";
|
||||
rs.execute(sql);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String gj=null;
|
||||
String xd=null;
|
||||
while (rs.next()){
|
||||
try {
|
||||
// 境外工作开始、结束时间
|
||||
Date sxrq = sdf.parse(rs.getString("SXRQ"));
|
||||
// 搜索周期的最后一天
|
||||
Calendar lastDayCal = Calendar.getInstance();
|
||||
lastDayCal.setTime(result.getMonth());
|
||||
lastDayCal.set(Calendar.DAY_OF_MONTH,28);
|
||||
if(sxrq.before(lastDayCal.getTime())){
|
||||
gj=rs.getString("GJ");
|
||||
xd=String.valueOf(rs.getInt("XD"));
|
||||
break;
|
||||
}
|
||||
}catch (Exception e){}
|
||||
}
|
||||
sql="SELECT XCDJ,gj ,xd,JWJTBZ,CCBTBZ from uf_xcdj WHERE gj="+gj+" and xd="+xd;
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
result.setJwjtbz(rs.getInt("JWJTBZ"));
|
||||
result.setCcbtbz(rs.getInt("CCBTBZ"));
|
||||
}
|
||||
result.setGj(gj);
|
||||
result.setXd(xd);
|
||||
result.setXcdj(rs.getString("XCDJ"));
|
||||
|
||||
Integer jwgzdw = result.getJwgzdw();
|
||||
if(jwgzdw != null){
|
||||
sql="select btbz from uf_dqbtbz where id ="+jwgzdw;
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
double btbz = rs.getDouble("btbz");
|
||||
result.setDqbtbz(btbz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* @description 将薪资计算的结果插入建模表中
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/6 14:37
|
||||
*/
|
||||
public void insertResult(List<AbroadBusinessResult> results,Date searchMonth){
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
|
||||
// 境外出差天数模块的id
|
||||
Integer fieldValue = Integer.valueOf( baseBean.getPropValue("bjcjczjs", "uf_jwccts_ModuleID"));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM");
|
||||
// 先进行删除
|
||||
String sql1="delete from uf_jwccts where CCYF ='"+ sdf2.format(searchMonth) +"'";
|
||||
rs.execute(sql1);
|
||||
for(int i=0;i<results.size();i++){
|
||||
AbroadBusinessResult result = results.get(i);
|
||||
String currTime = sdf.format(new Date());
|
||||
String currDate = TimeUtil.getCurrentDateString();
|
||||
String sendMonth = sdf2.format(result.getSendMonth());
|
||||
String ccMonth = sdf2.format(result.getMonth());
|
||||
double JWJTJE = result.getJwjtbz() * result.getAbroadAllowanceDays();
|
||||
double DQCCBTJE = result.getCcbtbz() * result.getBasicAllowanceDays();
|
||||
double jkdqbtje = result.getDqbtbz() * result.getBasicAllowanceDays();
|
||||
String sql ="insert into uf_jwccts(formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,XM,GJ,XD,XCDJ,CCYF,CCBTBZ,JWJTBZ,DQBTBZ,CCBTTS,JWJTTS,JWCCTS,FFYF,JWJTJE,DQCCBTJE,jkdqbtje,CCBTHJ)" +
|
||||
"values('"+fieldValue+"','1','0','"+currDate+"','"+currTime+"',"+result.getUser()+",'"+result.getGj()+"','"+result.getXd()+"','"+result.getXcdj()+"','" +ccMonth+"',"+result.getCcbtbz()+","
|
||||
+result.getJwjtbz()+","+result.getDqbtbz()+","+result.getBasicAllowanceDays()+","+result.getAbroadAllowanceDays()+","+result.getTotalDays()+",'"+sendMonth+"',"+
|
||||
JWJTJE+","+DQCCBTJE+","+jkdqbtje+","+(JWJTJE+DQCCBTJE+jkdqbtje)+")";
|
||||
rs.execute(sql);
|
||||
String sql2 ="select max(id) as id from uf_jwccts";
|
||||
rs.execute(sql2);
|
||||
while (rs.next()) {
|
||||
ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
||||
ModeRightInfo.setNewRight(true);
|
||||
ModeRightInfo.editModeDataShare(1, fieldValue, rs.getInt("id"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,379 @@
|
|||
package com.engine.bjcj220907.dao;
|
||||
|
||||
import com.engine.bjcj220907.entity.CountMonthBonus;
|
||||
import com.engine.bjcj220907.entity.DepartureInfo;
|
||||
import com.engine.bjcj220907.entity.JwCZInfoDetail;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/08 17:02
|
||||
* @description 月度绩效计算DAO
|
||||
*/
|
||||
public class MonthBonusDAO {
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
|
||||
|
||||
/**
|
||||
* @description 判断月度绩效核算表中是否有该月数据
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/8 17:25
|
||||
*/
|
||||
public boolean haveRecord(Date bonusMonth) {
|
||||
RecordSet rs = new RecordSet();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
String sql ="select count(*) from uf_ydjxzj where JXSSYF ='"+sdf.format(bonusMonth)+"'";
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
int anInt = rs.getInt("count(*)");
|
||||
if(anInt>1){
|
||||
baseBean.writeLog("该绩效所属月已有核算记录");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 获取所有人的绩效等级 --> 绩效系数
|
||||
* @return List<CountMonthBonus>
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/8 23:10
|
||||
*/
|
||||
public List<CountMonthBonus> getJXInfo(Date bonusSendMonth,Date bonusMonthDate,int bonusyear,int bonusSeason,List<Integer> haveSendDepartureInfo) {
|
||||
// 需要再对象中插入考勤月份,考勤季度,考核季度
|
||||
RecordSet rs = new RecordSet();
|
||||
StringBuilder sql=new StringBuilder("select distinct h.id,lastname,g.cnyxq,g.jd,g.zzkhdj,jxxs,certificatenum from HRMRESOURCE h left join uf_grjxzdb g on (h.id=g.sqr and cnyxq='"+bonusyear+"' and jd ='"+(bonusSeason-1)+"')left JOIN uf_jxbz b on g.zzkhdj=b.jxdj ");
|
||||
if(haveSendDepartureInfo != null && haveSendDepartureInfo.size()>0){
|
||||
sql.append("where h.id not in (");
|
||||
for(int i=0;i<haveSendDepartureInfo.size();i++){
|
||||
sql.append(haveSendDepartureInfo.get(i));
|
||||
if(i+1!=haveSendDepartureInfo.size()){
|
||||
sql.append(" , ");
|
||||
}
|
||||
}
|
||||
sql.append(") ");
|
||||
}
|
||||
sql.append("ORDER BY id");
|
||||
rs.execute(sql.toString());
|
||||
ArrayList<CountMonthBonus> result = new ArrayList<>();
|
||||
while (rs.next()){
|
||||
double jxxs = rs.getDouble("jxxs");
|
||||
if(jxxs == -1.0){
|
||||
jxxs=0.0;
|
||||
}
|
||||
CountMonthBonus countMonthBonus = CountMonthBonus.builder().xm(rs.getString("ID")).kqyf(bonusMonthDate).kqjd(bonusSeason-1).grjxdj(rs.getInt("zzkhdj")).grjxxs(jxxs).sfzh(rs.getString("certificatenum")).khjd(bonusSeason-1).ffyf(bonusSendMonth).build();
|
||||
result.add(countMonthBonus);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 获取离职员工的绩效等级 --> 绩效系数
|
||||
* @return List<CountMonthBonus>
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/8 23:10
|
||||
*/
|
||||
public CountMonthBonus getJXInfoByUser(Integer uid,Date bonusSendMonth,Date bonusMonthDate,int bonusyear,int bonusSeason) {
|
||||
// 需要在对象中插入考勤月份,考勤季度,考核季度
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql="select distinct h.id,lastname,g.cnyxq,g.jd,g.zzkhdj,jxxs,certificatenum from HRMRESOURCE h left join uf_grjxzdb g on (h.id=g.sqr and cnyxq='"+bonusyear+"' and jd ='"+(bonusSeason-1)+"')left JOIN uf_jxbz b on g.zzkhdj=b.jxdj where h.id="+uid+" ORDER BY id";
|
||||
rs.execute(sql);
|
||||
ArrayList<CountMonthBonus> result = new ArrayList<>();
|
||||
while (rs.next()){
|
||||
double jxxs = rs.getDouble("jxxs");
|
||||
if(jxxs == -1.0){
|
||||
jxxs=0.0;
|
||||
}
|
||||
CountMonthBonus countMonthBonus = CountMonthBonus.builder().xm(rs.getString("ID")).kqyf(bonusMonthDate).kqjd(bonusSeason-1).grjxdj(rs.getInt("zzkhdj")).grjxxs(jxxs).sfzh(rs.getString("certificatenum")).khjd(bonusSeason-1).ffyf(bonusSendMonth).build();
|
||||
return countMonthBonus;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @description 获取所有人薪酬等级及绩效工资
|
||||
* @return List<CountMonthBonus>
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/8 23:13
|
||||
*/
|
||||
public void getXCDJ(CountMonthBonus result) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql="select z.xm,z.gj,z.xd,z.sxrq,d.xcdj,jxgz from uf_xczjbd z LEFT JOIN uf_xcdj d on d.gj=z.gj and d.xd=z.xd WHERE xm="+result.getXm()+" order by sxrq desc";
|
||||
rs.execute(sql);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
while (rs.next()){
|
||||
try {
|
||||
Date sxrq = sdf.parse(rs.getString("SXRQ"));
|
||||
// 考勤的最后一天
|
||||
Calendar lastDayCal = Calendar.getInstance();
|
||||
lastDayCal.setTime(result.getKqyf());
|
||||
lastDayCal.set(Calendar.DAY_OF_MONTH,28);
|
||||
if(sxrq.before(lastDayCal.getTime())){
|
||||
double jxgz = rs.getDouble("jxgz");
|
||||
if(Math.abs(jxgz + 1.0) < 0.000000002){
|
||||
jxgz=0.0;
|
||||
}
|
||||
result.setYdjjjxjs(jxgz);
|
||||
result.setXcdj(rs.getString("xcdj"));
|
||||
break;
|
||||
}
|
||||
}catch (Exception e){}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* @description 获取所有人的境外常驻信息
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/11 16:06
|
||||
*/
|
||||
public List<JwCZInfoDetail> getCZInfo() {
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql="select xm,jwgzksrq,jwgzjsrq,lx from UF_NJJMB_DT1 d LEFT JOIN UF_NJJMB m on d.MAINID=m.id WHERE lx in(0,1) ORDER by JWGZKSRQ desc";
|
||||
rs.execute(sql);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
ArrayList<JwCZInfoDetail> results = new ArrayList<>();
|
||||
while (rs.next()){
|
||||
try {
|
||||
String jwgzksrqStr = rs.getString("jwgzksrq");
|
||||
Date jwgzksrq=null;
|
||||
String jwgzjsrqStr = rs.getString("jwgzjsrq");
|
||||
Date jwgzjsrq=null;
|
||||
if(jwgzksrqStr!=null && jwgzksrqStr.length()!=0){
|
||||
jwgzksrq = sdf.parse(jwgzksrqStr);
|
||||
}
|
||||
if(jwgzjsrqStr!=null && jwgzjsrqStr.length()!=0){
|
||||
jwgzjsrq = sdf.parse(jwgzjsrqStr);
|
||||
}
|
||||
JwCZInfoDetail build = JwCZInfoDetail.builder().xm(rs.getString("xm")).lx(rs.getInt("lx")).jwczksrq(jwgzksrq).jwczjsrq(jwgzjsrq).build();
|
||||
results.add(build);
|
||||
}catch (Exception e){
|
||||
baseBean.writeLog(e);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* @description 将计算好的月度绩效信息插入建模中
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/13 11:01
|
||||
*/
|
||||
public void insertList(List<CountMonthBonus> result,List<Integer> departureUsers,Date bonusSendMonth) {
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
//事务处理,默认不自动提交
|
||||
rst.setAutoCommit(false);
|
||||
baseBean.writeLog("开启事务,更新人员标识,插入绩效信息");
|
||||
CountMonthBonus first = new CountMonthBonus();
|
||||
if(result != null && result.size()>0){
|
||||
first = result.get(0);
|
||||
}
|
||||
Integer fieldValue = Integer.valueOf( baseBean.getPropValue("bjcjydjx", "ydjj_module_id"));
|
||||
baseBean.writeLog("获取月度绩效建模中模块id:"+fieldValue);
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
SimpleDateFormat sdf3 = new SimpleDateFormat("HH:mm:ss");
|
||||
String currTime = sdf3.format(new Date());
|
||||
String currDate = TimeUtil.getCurrentDateString();
|
||||
String firstSql="insert into uf_jxdj(formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,XM,YFJE,SFZH,KQYF,KQJD,SCQ,YCQ,QQ,JJJSKQ,KHJD,FFYF,XCDJ,JJJS,grjxdj,grjxxs) " +
|
||||
"select '"+fieldValue+"','1','0','"+currDate+"','"+currTime+"'," + first.getXm() +","+first.getYfje()+",'"+first.getSfzh()+"','"+sdf.format(first.getKqyf())+"',"+first.getKqjd()+","+first.getScq()+","+
|
||||
first.getYcq()+","+first.getQq()+","+first.getJjjskq()+","+first.getKhjd()+",'"+ sdf.format(first.getFfyf())+"','"+first.getXcdj()+"',"+
|
||||
first.getYdjjjxjs()+","+first.getGrjxdj()+","+first.getGrjxxs()+" from dual ";
|
||||
StringBuilder sql=new StringBuilder(firstSql);
|
||||
|
||||
for(int i=1;i<result.size();i++){
|
||||
CountMonthBonus r = result.get(i);
|
||||
sql.append(" union select '"+fieldValue+"','1','0','"+currDate+"','"+currTime+"'," +r.getXm() +","+r.getYfje()+",'"+r.getSfzh()+"','"+sdf.format(r.getKqyf())+"',"+r.getKqjd()+","+r.getScq()+","+r.getYcq()+","+r.getQq()+","+r.getJjjskq()+","+r.getKhjd()+",'"+sdf.format(r.getFfyf())+"','"+r.getXcdj()+"',"+r.getYdjjjxjs()+","+r.getGrjxdj()+","+r.getGrjxxs()+" from dual ");
|
||||
}
|
||||
// 更新人员标识
|
||||
StringBuilder sql3 = null;
|
||||
if(departureUsers.size()!=0){
|
||||
sql3 = new StringBuilder("UPDATE UF_RYBS set SFYJHSJX = 1, jxhsny ='"+sdf.format(bonusSendMonth)+"' ");
|
||||
sql3.append("where xm in (");
|
||||
for(int i=0;i<departureUsers.size();i++){
|
||||
|
||||
if(i+1==departureUsers.size()){
|
||||
sql3.append(departureUsers.get(i));
|
||||
}else {
|
||||
sql3.append(departureUsers.get(i) + ",");
|
||||
}
|
||||
}
|
||||
sql3.append(")");
|
||||
}
|
||||
|
||||
try {
|
||||
// 插入建模表
|
||||
rst.execute(sql.toString());
|
||||
// 更新人员标识表
|
||||
if(sql3!=null){
|
||||
rst.execute(sql3.toString());
|
||||
}
|
||||
rst.commit();
|
||||
} catch (Exception e) {
|
||||
rst.rollback();
|
||||
e.printStackTrace();
|
||||
baseBean.writeLog("事务执行失败,回滚");
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql2 ="select max(id) as id from uf_jxdj";
|
||||
rs.execute(sql2);
|
||||
while (rs.next()) {
|
||||
ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
||||
ModeRightInfo.setNewRight(true);
|
||||
ModeRightInfo.editModeDataShare(1, fieldValue, rs.getInt("id"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 插入核算月度绩效建模
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/13 21:12
|
||||
*/
|
||||
// public void insert(Date bonusMonth, Date bonusSendMonth) {
|
||||
// RecordSet rs = new RecordSet();
|
||||
// // 获取月度绩效建模模块id
|
||||
// baseBean.writeLog("插入核算月度绩效建模");
|
||||
// Integer fieldValue = Integer.valueOf( baseBean.getPropValue("bjcjydjx", "ydjxzj_module_id"));
|
||||
// baseBean.writeLog("获取月度绩效建模模块id"+fieldValue);
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM");
|
||||
// SimpleDateFormat sdf3 = new SimpleDateFormat("HH:mm:ss");
|
||||
// String currTime = sdf3.format(new Date());
|
||||
// String currDate = TimeUtil.getCurrentDateString();
|
||||
// String sql="insert into uf_ydjxzj(formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,JXSSYF,JXFFYF)" +
|
||||
// "values('"+fieldValue+"','1','0','"+currDate+"','"+currTime+"','"+sdf2.format(bonusMonth)+"','"+sdf2.format(bonusSendMonth)+"')";
|
||||
// rs.execute(sql);
|
||||
// String sql2 ="select max(id) as id from uf_ydjxzj";
|
||||
// rs.execute(sql2);
|
||||
// while (rs.next()) {
|
||||
// ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
||||
// ModeRightInfo.setNewRight(true);
|
||||
// ModeRightInfo.editModeDataShare(1, fieldValue, rs.getInt("id"));
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* @description 插入核算月度绩效建模前先删除脏数据
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/14 15:49
|
||||
*/
|
||||
public void clear(Date bonusMonth,Date bonusSendMonth,List<Integer> haveSendDepartureInfo) {
|
||||
RecordSet rs = new RecordSet();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
StringBuilder sql1=new StringBuilder("delete from uf_jxdj where KQYF='"+sdf.format(bonusMonth)+"'");
|
||||
if(haveSendDepartureInfo != null && haveSendDepartureInfo.size()>0){
|
||||
sql1.append(" and xm not in (");
|
||||
for(int i=0;i< haveSendDepartureInfo.size();i++){
|
||||
sql1.append(haveSendDepartureInfo.get(i));
|
||||
if(i+1!=haveSendDepartureInfo.size()){
|
||||
sql1.append(" , ");
|
||||
}
|
||||
}
|
||||
sql1.append(")");
|
||||
}
|
||||
|
||||
rs.execute(sql1.toString());
|
||||
// 获取离职人员
|
||||
String sql="SELECT XM from UF_RYBS WHERE jxhsny='"+sdf.format(bonusSendMonth)+"'";
|
||||
rs.execute(sql);
|
||||
ArrayList<Integer> users = new ArrayList<>();
|
||||
while (rs.next()){
|
||||
if(rs.getInt("xm") != -1){
|
||||
users.add(rs.getInt("xm"));
|
||||
}
|
||||
}
|
||||
Calendar countCal = Calendar.getInstance();
|
||||
countCal.setTime(bonusMonth);
|
||||
countCal.add(Calendar.MONTH,1);
|
||||
|
||||
StringBuilder sql2 = new StringBuilder();
|
||||
while (countCal.getTime().before(bonusSendMonth) || countCal.getTime().equals(bonusSendMonth)){
|
||||
sql2 = new StringBuilder("delete from uf_jxdj WHERE ffyf= '"+sdf.format(bonusSendMonth)+"' ");
|
||||
sql2.append("and kqyf='" +sdf.format(countCal.getTime())+"' ");
|
||||
if(users.size()>0){
|
||||
sql2.append("and xm in ( ");
|
||||
for(int i=0;i<users.size();i++){
|
||||
if( i==(users.size()-1) ){
|
||||
sql2.append(users.get(i));
|
||||
}else{
|
||||
sql2.append(users.get(i)+",");
|
||||
}
|
||||
}
|
||||
sql2.append(" )");
|
||||
}
|
||||
countCal.add(Calendar.MONTH,1);
|
||||
rs.execute(sql2.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
* @description 获取所有本月(薪资发放月)离职人员信息
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/15 10:48
|
||||
*/
|
||||
public List<DepartureInfo> getDepartureInfo(Date bonusSendMonth) {
|
||||
RecordSet rs = new RecordSet();
|
||||
ArrayList<DepartureInfo> departure = new ArrayList<>();
|
||||
String sql="select xm,lzrq from uf_rybs where ryzt=4 and (sfyjhsjx=0 or sfyjhsjx is null)";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
try {
|
||||
Date lzrq = sdf.parse(rs.getString("lzrq"));
|
||||
DepartureInfo build = DepartureInfo.builder().xm(rs.getInt("xm")).lzrq(sdf.parse(rs.getString("LZRQ"))).build();
|
||||
departure.add(build);
|
||||
} catch (ParseException e) {
|
||||
baseBean.writeLog("离职人员信息 日期格式化错误");
|
||||
}
|
||||
}
|
||||
return departure;
|
||||
}
|
||||
|
||||
/***
|
||||
* @description 获取已经离职并且已经发放过绩效的人员信息
|
||||
* @return List<DepartureInfo>
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/19 10:47
|
||||
*/
|
||||
public List<DepartureInfo> getHaveSendDepartureInfo() {
|
||||
RecordSet rs = new RecordSet();
|
||||
ArrayList<DepartureInfo> departure = new ArrayList<>();
|
||||
String sql="select xm,lzrq from uf_rybs where ryzt=4 and sfyjhsjx=1";
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
DepartureInfo build = DepartureInfo.builder().xm(rs.getInt("xm")).build();
|
||||
departure.add(build);
|
||||
}
|
||||
return departure;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.engine.bjcj220907.entity;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/05 14:00
|
||||
* @description 员工境外出差
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AbroadBusiness {
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private Integer user;
|
||||
|
||||
/**
|
||||
* 计算月份
|
||||
*/
|
||||
private Date month;
|
||||
|
||||
|
||||
/**
|
||||
* 境外工作开始时间
|
||||
*/
|
||||
private Date jwgzkssj;
|
||||
|
||||
/**
|
||||
* 境外工作结束时间
|
||||
*/
|
||||
private Date jwgzjssj;
|
||||
|
||||
/**
|
||||
* 境外工作单位
|
||||
*/
|
||||
private Integer jwgzdw;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.engine.bjcj220907.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/05 12:42
|
||||
* @description 计算员工国外出差天数参数
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class AbroadBusinessCountParam {
|
||||
|
||||
/**
|
||||
* 计算月份
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date month;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.engine.bjcj220907.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/05 18:41
|
||||
* @description 员工境外出差明细
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AbroadBusinessDetail {
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private Integer xm;
|
||||
|
||||
/**
|
||||
* 境外工作单位
|
||||
*/
|
||||
private Integer jwgzdw;
|
||||
|
||||
/**
|
||||
* 出差日期
|
||||
*/
|
||||
private Date date;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package com.engine.bjcj220907.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/06 9:11
|
||||
* @description 员工境外出差计算结果
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AbroadBusinessResult {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Integer user;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String sfzh;
|
||||
|
||||
/**
|
||||
* 岗级
|
||||
*/
|
||||
private String gj;
|
||||
/**
|
||||
* 薪点
|
||||
*/
|
||||
private String xd;
|
||||
/**
|
||||
* 薪酬等级
|
||||
*/
|
||||
private String xcdj;
|
||||
|
||||
/**
|
||||
* 出差月份
|
||||
*/
|
||||
private Date month;
|
||||
|
||||
/**
|
||||
* 出差补贴标准
|
||||
*/
|
||||
private Integer ccbtbz;
|
||||
|
||||
/**
|
||||
* 境外津贴标准
|
||||
*/
|
||||
private Integer jwjtbz;
|
||||
|
||||
/**
|
||||
* 地区补贴标准
|
||||
*/
|
||||
private double dqbtbz;
|
||||
|
||||
/**
|
||||
* 出差补贴标准天数
|
||||
*/
|
||||
private Integer basicAllowanceDays;
|
||||
|
||||
/**
|
||||
* 境外津贴标准天数
|
||||
*/
|
||||
private Integer abroadAllowanceDays;
|
||||
|
||||
/**
|
||||
* 出差补贴天数
|
||||
*/
|
||||
private Integer totalDays;
|
||||
|
||||
/**
|
||||
* 发放月份
|
||||
*/
|
||||
private Date sendMonth;
|
||||
|
||||
/**
|
||||
* 境外工作单位
|
||||
*/
|
||||
private Integer jwgzdw;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.engine.bjcj220907.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/09 16:34
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Attend4MonthBonus {
|
||||
|
||||
private Integer user;
|
||||
|
||||
/**
|
||||
* 考勤开始时间
|
||||
*/
|
||||
private Date beginDate;
|
||||
|
||||
/**
|
||||
* 考勤结束时间
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
package com.engine.bjcj220907.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/08 22:57
|
||||
* @description 月度绩效薪资项目实体
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class CountMonthBonus {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String xm;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String sfzh;
|
||||
|
||||
/**
|
||||
* 薪酬等级
|
||||
*/
|
||||
private String xcdj;
|
||||
|
||||
/**
|
||||
* 月度奖金绩效基数
|
||||
*/
|
||||
private double ydjjjxjs;
|
||||
|
||||
/**
|
||||
* 考勤年月
|
||||
*/
|
||||
private Date kqyf;
|
||||
|
||||
/**
|
||||
* 考勤所属季度
|
||||
*/
|
||||
private Integer kqjd;
|
||||
|
||||
/**
|
||||
* 应出勤
|
||||
*/
|
||||
private double ycq;
|
||||
/**
|
||||
* 实出勤
|
||||
*/
|
||||
private double scq;
|
||||
/**
|
||||
* 缺勤
|
||||
*/
|
||||
private double qq;
|
||||
/**
|
||||
* 奖金基数(考勤)
|
||||
*/
|
||||
private double jjjskq;
|
||||
/**
|
||||
* 考核季度
|
||||
*/
|
||||
private Integer khjd;
|
||||
/**
|
||||
* 绩效考核等级
|
||||
*/
|
||||
private Integer grjxdj;
|
||||
|
||||
/**
|
||||
* 绩效考核系数
|
||||
*/
|
||||
private double grjxxs;
|
||||
|
||||
/**
|
||||
* 奖金实发放额
|
||||
*/
|
||||
private double yfje;
|
||||
|
||||
/**
|
||||
* 发放月份
|
||||
*/
|
||||
private Date ffyf;
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.engine.bjcj220907.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/08 16:40
|
||||
* @description 计算月度绩效奖金参数
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class CountMonthBonusParam {
|
||||
|
||||
/**
|
||||
* 绩效发放月份
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM")
|
||||
private Date bonusSendMonth;
|
||||
|
||||
/**
|
||||
* 绩效所属月份
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM")
|
||||
private Date bonusMonth;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.engine.bjcj220907.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/15 11:19
|
||||
* @description
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DepartureInfo {
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private Integer xm;
|
||||
|
||||
/**
|
||||
* 离职日期
|
||||
*/
|
||||
private Date lzrq;
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.engine.bjcj220907.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/11 16:16
|
||||
* @description 境外常驻信息
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class JwCZInfo {
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String xm;
|
||||
|
||||
/**
|
||||
* 境外常驻详细信息
|
||||
*/
|
||||
private List<JwCZInfoDetail> infos;
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.engine.bjcj220907.entity;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/11 16:17
|
||||
* @description 境外常驻信息详细表
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class JwCZInfoDetail {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String xm;
|
||||
|
||||
/**
|
||||
* 类型(0:开始常驻,1:结束常驻)
|
||||
*/
|
||||
private Integer lx;
|
||||
|
||||
/**
|
||||
* 境外工作开始日期
|
||||
*/
|
||||
private Date jwczksrq;
|
||||
|
||||
/**
|
||||
* 境外工作结束日期
|
||||
*/
|
||||
private Date jwczjsrq;
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.engine.bjcj220907.service;
|
||||
|
||||
|
||||
import com.engine.bjcj220907.entity.AbroadBusinessCountParam;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/05 11:51
|
||||
* @description 计算员工国外出差天数
|
||||
*/
|
||||
public interface AbroadBusinessCountService {
|
||||
|
||||
String countDays(AbroadBusinessCountParam param);
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.engine.bjcj220907.service;
|
||||
|
||||
import com.engine.bjcj220907.entity.Attend4MonthBonus;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/09 16:14
|
||||
* @description 拉取考勤中考勤信息进行解析
|
||||
*/
|
||||
public interface GetKQ4MonthBonusService {
|
||||
|
||||
Map<String,Double> getKQDatas(Attend4MonthBonus attend4MonthBonus);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.engine.bjcj220907.service;
|
||||
|
||||
import com.engine.bjcj220907.entity.CountMonthBonusParam;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/08 16:35
|
||||
* @description 月度绩效奖金计算
|
||||
*/
|
||||
public interface MonthBonusCountService {
|
||||
|
||||
public String countMonthBonus(CountMonthBonusParam param);
|
||||
}
|
||||
|
|
@ -0,0 +1,245 @@
|
|||
package com.engine.bjcj220907.service.impl;
|
||||
|
||||
|
||||
import com.engine.bjcj220907.dao.AbroadBusinessDAO;
|
||||
import com.engine.bjcj220907.entity.AbroadBusiness;
|
||||
import com.engine.bjcj220907.entity.AbroadBusinessCountParam;
|
||||
import com.engine.bjcj220907.entity.AbroadBusinessDetail;
|
||||
import com.engine.bjcj220907.entity.AbroadBusinessResult;
|
||||
import com.engine.bjcj220907.service.AbroadBusinessCountService;
|
||||
import com.engine.core.impl.Service;
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/05 11:52
|
||||
* @description 计算员工国外出差天数
|
||||
*/
|
||||
public class AbroadBusinessCountServiceImpl extends Service implements AbroadBusinessCountService {
|
||||
|
||||
|
||||
public AbroadBusinessDAO getAbroadBusinessDAO(){
|
||||
return new AbroadBusinessDAO();
|
||||
}
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
|
||||
/**
|
||||
* @description 计算员工国外"出差补贴标准"天数,"境外津贴标准"天数,
|
||||
* @return String
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/5 12:37
|
||||
*/
|
||||
@Override
|
||||
public String countDays(AbroadBusinessCountParam param) {
|
||||
// 从境外工作记录表中查询所有国外出差数据
|
||||
List<AbroadBusiness> abroadBusinesses = new ArrayList<>();
|
||||
abroadBusinesses = getAbroadBusinessDAO().getList();
|
||||
// 获取出差明细
|
||||
baseBean.writeLog("开始将所有出差记录:"+abroadBusinesses.size()+"条转换为明细");
|
||||
List<AbroadBusinessDetail> abroadBusinessDetails = new ArrayList<>();
|
||||
for(int i=0; i < abroadBusinesses.size();i++){
|
||||
AbroadBusiness business = abroadBusinesses.get(i);
|
||||
Date c_start = business.getJwgzkssj();
|
||||
Date c_end = business.getJwgzjssj();
|
||||
// 境外工作开始时间
|
||||
Calendar tempStart = Calendar.getInstance();
|
||||
tempStart.setTime(c_start);
|
||||
tempStart.set(Calendar.HOUR_OF_DAY,0);
|
||||
tempStart.set(Calendar.MINUTE,0);
|
||||
tempStart.set(Calendar.SECOND,0);
|
||||
tempStart.set(Calendar.MILLISECOND,0);
|
||||
// 境外工作结束时间
|
||||
Calendar tempEnd = Calendar.getInstance();
|
||||
tempEnd.setTime(c_end);
|
||||
tempEnd.set(Calendar.HOUR_OF_DAY,0);
|
||||
tempEnd.set(Calendar.MINUTE, 0);
|
||||
tempEnd.set(Calendar.SECOND, 0);
|
||||
tempEnd.set(Calendar.MILLISECOND, 0);
|
||||
tempEnd.add(Calendar.DATE, 1);
|
||||
while (tempStart.before(tempEnd)) {
|
||||
abroadBusinessDetails.add(AbroadBusinessDetail.builder().xm(business.getUser()).date(tempStart.getTime()).jwgzdw(business.getJwgzdw()).build());
|
||||
tempStart.add(Calendar.DAY_OF_YEAR, 1);
|
||||
}
|
||||
}
|
||||
baseBean.writeLog("将所有出差记录转换为明细完成共"+abroadBusinesses.size()+"条明细");
|
||||
// 查询月份的年月(当月的28号11:59:59)
|
||||
Calendar searchCal = Calendar.getInstance();
|
||||
searchCal.setTime(param.getMonth());
|
||||
int year = searchCal.get(Calendar.YEAR);
|
||||
int month = searchCal.get(Calendar.MONTH)+1;
|
||||
int totalDays = searchCal.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
searchCal.set(Calendar.DAY_OF_MONTH,28);
|
||||
searchCal.set(Calendar.HOUR_OF_DAY, 23);
|
||||
searchCal.set(Calendar.MINUTE, 59);
|
||||
searchCal.set(Calendar.SECOND, 59);
|
||||
searchCal.set(Calendar.MILLISECOND, 999);
|
||||
baseBean.writeLog("查询月:"+searchCal.getTime());
|
||||
// 出差补贴发放月
|
||||
Calendar sendMonth = Calendar.getInstance();
|
||||
sendMonth.setTime(param.getMonth());
|
||||
sendMonth.add(Calendar.MONTH, 1);
|
||||
baseBean.writeLog("出差补贴发放月:"+sendMonth.getTime());
|
||||
|
||||
// 查询上月29号30天前的年月日(24:00:00)(不是3月的情况)
|
||||
Calendar lastThirtyDays = Calendar.getInstance();
|
||||
lastThirtyDays.set(Calendar.YEAR, year);
|
||||
lastThirtyDays.set(Calendar.MONTH, month-2);
|
||||
if(lastThirtyDays.getActualMaximum(Calendar.DAY_OF_MONTH)==28){
|
||||
// 2月只有28天的情况
|
||||
lastThirtyDays.add(Calendar.MONTH, 1);
|
||||
lastThirtyDays.set(Calendar.DAY_OF_MONTH, 1);
|
||||
lastThirtyDays.add(Calendar.DATE, -30);
|
||||
lastThirtyDays.set(Calendar.HOUR_OF_DAY, 0);
|
||||
lastThirtyDays.set(Calendar.MINUTE, 0);
|
||||
lastThirtyDays.set(Calendar.SECOND, 0);
|
||||
lastThirtyDays.set(Calendar.MILLISECOND, 0);
|
||||
}else{
|
||||
lastThirtyDays.set(Calendar.DAY_OF_MONTH, 29);
|
||||
lastThirtyDays.add(Calendar.DATE, -30);
|
||||
lastThirtyDays.set(Calendar.HOUR_OF_DAY, 0);
|
||||
lastThirtyDays.set(Calendar.MINUTE, 0);
|
||||
lastThirtyDays.set(Calendar.SECOND, 0);
|
||||
lastThirtyDays.set(Calendar.MILLISECOND, 0);
|
||||
}
|
||||
baseBean.writeLog("上月29号30天前日期:"+lastThirtyDays.getTime());
|
||||
|
||||
// 获取所有人(搜索月28)到(上月29号30天前)的出差明细
|
||||
List<AbroadBusinessDetail> thisAndLastMonthBusinessDetail = getThisAndLastMonthBusinessDetail(abroadBusinessDetails, searchCal.getTime(),lastThirtyDays.getTime());
|
||||
// 根据姓名进行分组
|
||||
Map<Integer, List<AbroadBusinessDetail>> collect = thisAndLastMonthBusinessDetail.stream().collect(Collectors.groupingBy(item -> item.getXm()));
|
||||
// 获取搜索月周期的第一天(正常是上月29号,2月例外)
|
||||
Calendar searchBeginCal = Calendar.getInstance();
|
||||
searchBeginCal.setTime(lastThirtyDays.getTime());
|
||||
searchBeginCal.add(Calendar.DATE,30);
|
||||
Date firstDay = searchBeginCal.getTime();
|
||||
baseBean.writeLog("获取搜索月周期的第一天:"+firstDay);
|
||||
List<AbroadBusinessResult> results =new ArrayList<>();
|
||||
for (Map.Entry<Integer, List<AbroadBusinessDetail>> entry : collect.entrySet()) {
|
||||
// 每个人(搜索月28)到(上月29号30天前)的出差明细
|
||||
List<AbroadBusinessDetail> detail = entry.getValue();
|
||||
List<Date> detailDate = detail.stream().map(AbroadBusinessDetail::getDate).collect(Collectors.toList());
|
||||
// 前30天连续天数
|
||||
int lastMonthCount=0;
|
||||
// 本月出差补贴标准天数
|
||||
int thisMonthCount=0;
|
||||
// 本月境外津贴标准天数
|
||||
int thisMonthAbroadCount=0;
|
||||
if(detailDate.contains(firstDay)){
|
||||
// 出差明细中包含计算周期的第一天,需要判断前30天
|
||||
Calendar lastMonthLastDayCal = Calendar.getInstance();
|
||||
lastMonthLastDayCal.setTime(firstDay);
|
||||
lastMonthLastDayCal.add(Calendar.DATE,-1);
|
||||
if(detailDate.contains(lastMonthLastDayCal.getTime())){
|
||||
// 出差明细中包含计算周期的前一天,存在跨月情况,计算周期第一天的前30天最后连续签到天数
|
||||
lastMonthCount=1;
|
||||
for(int i=detailDate.indexOf((lastMonthLastDayCal.getTime())); i>0;i--){
|
||||
lastMonthLastDayCal.add(Calendar.DATE,-1);
|
||||
if( detailDate.get(i-1).equals(lastMonthLastDayCal.getTime())){
|
||||
lastMonthCount++;
|
||||
}
|
||||
else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(lastMonthCount == 30){
|
||||
thisMonthAbroadCount++;
|
||||
}else{
|
||||
thisMonthCount++;
|
||||
}
|
||||
}
|
||||
// 过滤搜索周期(上月29-搜索月28)出差明细
|
||||
List<AbroadBusinessDetail> searchMonthDetails = detail.stream().filter(item -> {
|
||||
if( (searchCal.getTime().after(item.getDate()) || searchCal.getTime().equals(item.getDate())) && ( firstDay.before(item.getDate())|| firstDay.equals(item.getDate())) ){
|
||||
return true;
|
||||
}else{return false;}
|
||||
}).collect(Collectors.toList());
|
||||
if(searchMonthDetails.size()==0){
|
||||
// 搜索周期内无数据
|
||||
continue;
|
||||
}
|
||||
List<Date> searchMonthDetailDate = searchMonthDetails.stream().map(AbroadBusinessDetail::getDate).collect(Collectors.toList());
|
||||
if((searchMonthDetailDate.size() + lastMonthCount) <=30){
|
||||
// 前30天连续出差天数+本计算周期天数 没有超过30天
|
||||
thisMonthCount = searchMonthDetailDate.size();
|
||||
}else{
|
||||
// 超过30天
|
||||
if(lastMonthCount == 0){
|
||||
// 满30天,但计算周期前一天无签到(不跨月)
|
||||
if(thisMonthCount == 0){
|
||||
// 计算周期第一天没有签到则本月出差全为”出差补贴标准天数“(最多连续30天)
|
||||
thisMonthCount = searchMonthDetailDate.size();
|
||||
}else{
|
||||
// 计算周期第一天有签到
|
||||
if(searchMonthDetailDate.size()<=30){
|
||||
thisMonthCount=searchMonthDetailDate.size();
|
||||
}else{
|
||||
thisMonthCount=30;
|
||||
thisMonthAbroadCount=1;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// 满30天,且计算周期前一天存在签到
|
||||
if(thisMonthCount == 0 && thisMonthAbroadCount == 0){
|
||||
// 计算周期第一天没有签到
|
||||
thisMonthCount = searchMonthDetailDate.size();
|
||||
}else{
|
||||
// 计算周期第一天有签到
|
||||
Calendar firstCal = Calendar.getInstance();
|
||||
firstCal.setTime(firstDay);
|
||||
firstCal.add(Calendar.DATE, 1);
|
||||
int totalContinueDays=lastMonthCount+1;
|
||||
for(int i=1;i<searchMonthDetailDate.size();i++){
|
||||
if(searchMonthDetailDate.get(i).equals(firstCal.getTime())){
|
||||
// 连续
|
||||
firstCal.add(Calendar.DATE,1);
|
||||
if(totalContinueDays >= 30){
|
||||
thisMonthAbroadCount++;
|
||||
}else{
|
||||
thisMonthCount++;
|
||||
}
|
||||
totalContinueDays++;
|
||||
}else{
|
||||
// 不连续,计算余下出差天数,加入出差补贴标准天数
|
||||
int remaining = searchMonthDetailDate.size() - i ;
|
||||
thisMonthCount+=remaining;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
AbroadBusinessResult build = AbroadBusinessResult.builder().user(detail.get(0).getXm()).basicAllowanceDays(thisMonthCount).abroadAllowanceDays(thisMonthAbroadCount).totalDays(thisMonthCount + thisMonthAbroadCount)
|
||||
.month(param.getMonth()).sendMonth(sendMonth.getTime()).jwgzdw(detail.get(0).getJwgzdw()).build();
|
||||
results.add(build);
|
||||
baseBean.writeLog("用户:"+detail.get(0).getXm()+"前30天连续出差天数:"+lastMonthCount+"本周期短期出差天数:"+thisMonthCount+"长期出差天数:"+thisMonthAbroadCount);
|
||||
}
|
||||
baseBean.writeLog("开始获取岗级、薪点、补贴标准信息等数据");
|
||||
results = results.stream().map(result -> {
|
||||
getAbroadBusinessDAO().getJobInfo(result);
|
||||
return result;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 计算结果插入建模表中
|
||||
baseBean.writeLog("计算结果插入建模表中");
|
||||
getAbroadBusinessDAO().insertResult(results,param.getMonth());
|
||||
return "success";
|
||||
}
|
||||
|
||||
// 获取搜索月28号到上月29号30天前的出差明细
|
||||
public List<AbroadBusinessDetail> getThisAndLastMonthBusinessDetail(List<AbroadBusinessDetail> abroadBusinessDetails,Date endDate,Date startDate){
|
||||
List<AbroadBusinessDetail> thisAndLastMonthBusinessDay = abroadBusinessDetails.stream().filter(date ->{
|
||||
if( ((startDate.before(date.getDate())) || (startDate.equals(date.getDate()))) && ((endDate.after(date.getDate())) || (endDate.equals(date.getDate()))) ){
|
||||
return true;
|
||||
}else{return false;}
|
||||
}).collect(Collectors.toList());
|
||||
return thisAndLastMonthBusinessDay;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
package com.engine.bjcj220907.service.impl;
|
||||
|
||||
import com.alibaba.druid.support.json.JSONUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.bjcj220907.entity.Attend4MonthBonus;
|
||||
import com.engine.bjcj220907.service.GetKQ4MonthBonusService;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.kq.cmd.report.GetKQReportCmd;
|
||||
import com.weaver.general.BaseBean;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/09 16:17
|
||||
* @description 拉取考勤中考勤信息进行解析
|
||||
*/
|
||||
public class GetKQ4MonthBonusServiceImpl extends Service implements GetKQ4MonthBonusService {
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
|
||||
/**
|
||||
* @description 获取所有员工的缺勤天数,(境外、境内年假、奖励假、工伤、隔离假除外)
|
||||
* @return Map<String,Object>
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/13 10:22
|
||||
*/
|
||||
@Override
|
||||
public Map<String,Double> getKQDatas(Attend4MonthBonus attend4MonthBonus) {
|
||||
baseBean.writeLog("开始获取考勤数据,参数{}", attend4MonthBonus);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM");
|
||||
List<Map> columnsList = new ArrayList<>();
|
||||
List<Map<String, String>> dataList = new ArrayList<>();
|
||||
try {
|
||||
Map<String, Object> paramsMap = new HashMap<String, Object>();
|
||||
paramsMap.put("typeselect", "6");
|
||||
paramsMap.put("pageIndex", 1);
|
||||
paramsMap.put("pageSize", 10000);
|
||||
paramsMap.put("fromDate", sdf.format(attend4MonthBonus.getBeginDate()));
|
||||
paramsMap.put("toDate", sdf.format(attend4MonthBonus.getEndDate()));
|
||||
paramsMap.put("viewScope", "0");
|
||||
paramsMap.put("isNoAccount", "0");
|
||||
paramsMap.put("attendanceSerial", "0");
|
||||
paramsMap.put("status", "9");
|
||||
Map<String, Object> temp = new HashMap<String, Object>();
|
||||
temp.put("data", JSONObject.toJSONString(paramsMap));
|
||||
temp.put("reportType", "month");
|
||||
Map execute = commandExecutor.execute(new GetKQReportCmd(temp,user));
|
||||
// 获取列数据
|
||||
columnsList = (List<Map>) execute.get("columns");
|
||||
List c = new ArrayList();
|
||||
columnsList.stream().forEach(column->{
|
||||
if(column.get("title").equals("旷工")){
|
||||
c.add(column.get("dataIndex"));
|
||||
}
|
||||
if(column.get("title").equals("出差及请假")){
|
||||
List<Map> children =(List<Map>) column.get("children");
|
||||
children.stream().forEach(i->{
|
||||
if((!i.get("title").equals("境内年假")) && (!i.get("title").equals("境外年假")) && (!i.get("title").equals("奖励假")) && (!i.get("title").equals("工伤")) && (!i.get("title").equals("隔离假")) ){
|
||||
c.add(column.get("dataIndex"));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
dataList = (List<Map<String, String>>) execute.get("datas");
|
||||
// 获取每个人的缺勤天数
|
||||
Map<String, Double> qqDays = new HashMap<>();
|
||||
dataList.stream().forEach(i->{
|
||||
if(attend4MonthBonus.getUser()!=null){
|
||||
if(i.get("resourceId").equals(attend4MonthBonus.getUser())){
|
||||
double[] qq={0.0};
|
||||
c.stream().forEach(j->{
|
||||
// 累加各种请假天数
|
||||
qq[0]+=Double.parseDouble(i.get(j));
|
||||
});
|
||||
String s = i.get("resourceId") +"-"+ sdf2.format(attend4MonthBonus.getEndDate());
|
||||
qqDays.put(s,qq[0]);
|
||||
}
|
||||
}else{
|
||||
double[] qq={0.0};
|
||||
c.stream().forEach(j->{
|
||||
// 累加各种请假天数
|
||||
qq[0]+=Double.parseDouble(i.get(j));
|
||||
});
|
||||
String s = i.get("resourceId") +"-"+ sdf2.format(attend4MonthBonus.getEndDate());
|
||||
qqDays.put(s,qq[0]);
|
||||
}
|
||||
|
||||
});
|
||||
baseBean.writeLog("获取的考勤缺勤天数,{}", JSONUtils.toJSONString(qqDays));
|
||||
return qqDays;
|
||||
} catch (Exception e) {
|
||||
baseBean.writeLog("获取考勤数据失败{}", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,363 @@
|
|||
package com.engine.bjcj220907.service.impl;
|
||||
|
||||
import com.engine.bjcj220907.dao.MonthBonusDAO;
|
||||
import com.engine.bjcj220907.entity.*;
|
||||
import com.engine.bjcj220907.service.GetKQ4MonthBonusService;
|
||||
import com.engine.bjcj220907.service.MonthBonusCountService;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/08 16:35
|
||||
* @description
|
||||
*/
|
||||
public class MonthBonusCountServiceImpl extends Service implements MonthBonusCountService {
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
public MonthBonusDAO getMonthBonusDAO(){
|
||||
return new MonthBonusDAO();
|
||||
}
|
||||
|
||||
private GetKQ4MonthBonusService getKQ4MonthBonusService() {
|
||||
return ServiceUtil.getService(GetKQ4MonthBonusServiceImpl.class,user);
|
||||
}
|
||||
|
||||
/***
|
||||
* @description 计算月度绩效
|
||||
* @return String
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/8 17:04
|
||||
*/
|
||||
@Override
|
||||
public String countMonthBonus(CountMonthBonusParam param) {
|
||||
Date bonusMonth = param.getBonusMonth();
|
||||
Date bonusSendMonth = param.getBonusSendMonth();
|
||||
// 绩效所属季度
|
||||
Calendar bonusCal = Calendar.getInstance();
|
||||
bonusCal.setTime(bonusMonth);
|
||||
int bonusYear = bonusCal.get(Calendar.YEAR);
|
||||
int bonusSeason =bonusCal.get(Calendar.MONTH)/3+1;
|
||||
|
||||
// 获取已经离职并且已经发放过绩效的人员信息
|
||||
baseBean.writeLog("获取已经离职并且已经发放过绩效的人员信息");
|
||||
List<Integer> haveSendDepartureInfo = getMonthBonusDAO().getHaveSendDepartureInfo().stream().map(i->i.getXm()).collect(Collectors.toList());
|
||||
// 获取所有人的绩效等级 --> 绩效系数
|
||||
baseBean.writeLog("获取所有人的绩效等级、绩效系数等信息");
|
||||
List<CountMonthBonus> result = getMonthBonusDAO().getJXInfo(bonusSendMonth,bonusMonth,bonusYear,bonusSeason,haveSendDepartureInfo);
|
||||
// 获取所有本月(薪资发放月)离职人员信息
|
||||
List<DepartureInfo> departureInfo = getMonthBonusDAO().getDepartureInfo(bonusSendMonth);
|
||||
baseBean.writeLog("发放月离职人员信息:"+departureInfo);
|
||||
List<CountMonthBonus> departureTemp = new ArrayList<>();
|
||||
// 循环所属月下一个月到离职月之间的绩效等级-》绩效系数
|
||||
baseBean.writeLog("获取所有离职人员所属月下一个月到离职月之间的绩效等级、绩效系数等信息");
|
||||
for(int i=0;i<departureInfo.size();i++){
|
||||
DepartureInfo info = departureInfo.get(i);
|
||||
Calendar countCal = Calendar.getInstance();
|
||||
countCal.setTime(bonusMonth);
|
||||
countCal.add(Calendar.MONTH,1);
|
||||
while (countCal.getTime().before(info.getLzrq()) || countCal.getTime().equals(info.getLzrq())){
|
||||
int year = countCal.get(Calendar.YEAR);
|
||||
int season =countCal.get(Calendar.MONTH)/3+1;
|
||||
CountMonthBonus j = getMonthBonusDAO().getJXInfoByUser(info.getXm(), bonusSendMonth, countCal.getTime(), year, season);
|
||||
result.add(j);
|
||||
departureTemp.add(j);
|
||||
countCal.add(Calendar.MONTH,1);
|
||||
}
|
||||
}
|
||||
|
||||
//获取所有人的薪酬等级和绩效工资
|
||||
result = result.stream().map(r -> {
|
||||
getMonthBonusDAO().getXCDJ(r);
|
||||
return r;
|
||||
}).collect(Collectors.toList());
|
||||
baseBean.writeLog("获取所有人的薪酬等级和绩效工资");
|
||||
// 获取在职员工的考勤周期(上个月29-这个月28)
|
||||
Calendar startAttendanceCal = getStartAttendanceCal(bonusMonth);
|
||||
Calendar endAttendanceCal = getEndAttendanceCal(bonusMonth);
|
||||
|
||||
// 获取所有人的境外常驻信息
|
||||
List<JwCZInfoDetail> czInfos = getMonthBonusDAO().getCZInfo();
|
||||
baseBean.writeLog("获取所有人的境外常驻信息");
|
||||
// 将境外常驻信息格式化
|
||||
List<JwCZInfo> jwCZInfos = formatJwCZInfo(czInfos);
|
||||
baseBean.writeLog("将境外常驻信息格式化");
|
||||
// 获取所有用户考勤模块中缺勤天数
|
||||
Attend4MonthBonus p = Attend4MonthBonus.builder().beginDate(startAttendanceCal.getTime()).endDate(endAttendanceCal.getTime()).build();
|
||||
Map<String, Double> qqDatas = getKQ4MonthBonusService().getKQDatas(p);
|
||||
baseBean.writeLog("获取所有用户考勤模块中缺勤天数");
|
||||
// 循环将离职人员的各个月的缺勤天数取到
|
||||
Map<String, Double> qqDatasDepar= new HashMap<>();
|
||||
for(int i=0;i<departureTemp.size();i++){
|
||||
Date saDate = getStartAttendanceCal(departureTemp.get(i).getKqyf()).getTime();
|
||||
Date eaDate = getEndAttendanceCal(departureTemp.get(i).getKqyf()).getTime();
|
||||
qqDatasDepar.putAll(getKQ4MonthBonusService().getKQDatas(Attend4MonthBonus.builder().beginDate(saDate).endDate(eaDate).user(Integer.valueOf(departureTemp.get(i).getXm())).build()));
|
||||
}
|
||||
baseBean.writeLog("获取所有离职人员的各个月的缺勤天数");
|
||||
// 将缺勤信息合并
|
||||
qqDatas.putAll(qqDatasDepar);
|
||||
baseBean.writeLog("所有人员的各个月的缺勤天数"+qqDatas);
|
||||
// 所有有境外常驻信息的用户
|
||||
List<String> jwCZUsers = jwCZInfos.stream().map(item -> item.getXm()).collect(Collectors.toList());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
// 计算考勤月内的月度绩效信息
|
||||
baseBean.writeLog("计算考勤月内的月度绩效信息");
|
||||
result = result.stream().map(item -> {
|
||||
if(!jwCZUsers.contains(item.getXm())){
|
||||
// 用户不存在境外常驻信息(全勤21.75)
|
||||
item.setYcq(21.75);
|
||||
double qq=0.0;
|
||||
if(qqDatas.containsKey( (item.getXm()+"-"+sdf.format(item.getKqyf())) )){
|
||||
qq = qqDatas.get((item.getXm()+"-"+sdf.format(item.getKqyf())));
|
||||
}
|
||||
item.setQq(qq);
|
||||
// 实出勤天数 =应出勤天数-缺勤天数
|
||||
double scqTemp = 21.75-qq;
|
||||
if (scqTemp<0){
|
||||
scqTemp=0.0;
|
||||
}
|
||||
item.setScq(scqTemp);
|
||||
// 奖金基数(考勤)= 月度绩效奖金基数-月度绩效基数/满勤*缺勤天数
|
||||
double kqjs= item.getYdjjjxjs() - item.getYdjjjxjs()/21.75*qq;
|
||||
item.setJjjskq(kqjs);
|
||||
// 奖金实发放额= 奖金基数(考勤)*个人绩效系数
|
||||
item.setYfje(item.getGrjxxs() * kqjs);
|
||||
}else{
|
||||
// 用户存在境外常驻信息,获取该用户所有常驻信息
|
||||
List<JwCZInfo> collect = jwCZInfos.stream().filter(i -> i.getXm().equals( item.getXm())).collect(Collectors.toList());
|
||||
List<JwCZInfoDetail> infos = collect.get(0).getInfos();
|
||||
double[] ycq = {0};
|
||||
List<Date> details = new ArrayList<>();
|
||||
|
||||
// 考勤开始日期(在职、离职)
|
||||
Calendar s = getStartAttendanceCal(item.getKqyf());
|
||||
// 考勤结束日期(在职、离职)
|
||||
Calendar e = getEndAttendanceCal(item.getKqyf());
|
||||
// 用于存储计算到哪一天的日期
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(e.getTime());
|
||||
Calendar[] countDay = {c};
|
||||
for(int i=0;i<infos.size();i++){
|
||||
JwCZInfoDetail infoi = infos.get(i);
|
||||
if(infoi.getLx()==0 && (infoi.getJwczksrq().before(e.getTime()) || infoi.getJwczksrq().equals(e.getTime())) ){
|
||||
// 开始常驻
|
||||
if(infoi.getJwczksrq().after(s.getTime())){
|
||||
// 开始常驻日期在 考勤开始日期后,结束日期前
|
||||
int d = getDays(infoi.getJwczksrq(), e.getTime());
|
||||
ycq[0]+=d;
|
||||
countDay[0].setTime(infoi.getJwczksrq());
|
||||
countDay[0].add(Calendar.DATE,-1);
|
||||
}else{
|
||||
// 开始常驻日期在 考勤开始日期前(应出勤日期为自然日)
|
||||
ycq[0]=getDays(s.getTime(), e.getTime());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(infoi.getLx()==1 &&
|
||||
((infoi.getJwczksrq().before(e.getTime()) || infoi.getJwczksrq().equals(e.getTime()))
|
||||
&& (infoi.getJwczjsrq().after(s.getTime()) || infoi.getJwczjsrq().equals(s.getTime())) )){
|
||||
// 将区间转换为记录
|
||||
Calendar starCal = Calendar.getInstance();
|
||||
starCal.setTime(infoi.getJwczksrq());
|
||||
while (starCal.getTime().before(infoi.getJwczjsrq()) || starCal.getTime().equals(infoi.getJwczjsrq())) {
|
||||
details.add(starCal.getTime());
|
||||
starCal.add(Calendar.DAY_OF_YEAR, 1);
|
||||
}
|
||||
}
|
||||
if(i==infos.size()-1){
|
||||
// 已经将所有考勤周期内境外常驻的区间时间转换为记录
|
||||
Calendar aCal = Calendar.getInstance();
|
||||
aCal.setTime(countDay[0].getTime());
|
||||
aCal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
aCal.set(Calendar.MINUTE, 0);
|
||||
aCal.set(Calendar.SECOND, 0);
|
||||
aCal.set(Calendar.MILLISECOND, 0);
|
||||
if(details.size()==0 && countDay[0].getTime().equals(e.getTime())){
|
||||
// 该考勤周期内员工没有境外常驻信息
|
||||
ycq[0]=21.75;
|
||||
break;
|
||||
}
|
||||
while (s.getTime().before(aCal.getTime()) || s.getTime().equals(aCal.getTime())){
|
||||
if(details.contains(aCal.getTime())){
|
||||
// 存在境外记录
|
||||
ycq[0]++;
|
||||
aCal.add(Calendar.DATE,-1);
|
||||
}else{
|
||||
// 没有境外记录,判断是否是工作日
|
||||
if( (aCal.get(Calendar.DAY_OF_WEEK) != 1) && (aCal.get(Calendar.DAY_OF_WEEK)!=7) ){
|
||||
// 是工作日
|
||||
ycq[0]++;
|
||||
}
|
||||
aCal.add(Calendar.DATE,-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
item.setYcq(ycq[0]);
|
||||
double qq=0.0;
|
||||
if(qqDatas.containsKey( (item.getXm()+"-"+sdf.format(item.getKqyf())) )){
|
||||
qq = qqDatas.get((item.getXm()+"-"+sdf.format(item.getKqyf())));
|
||||
}
|
||||
item.setQq(qq);
|
||||
// 实出勤天数 =应出勤天数-缺勤天数
|
||||
double scqTemp =ycq[0]-qq;
|
||||
if (scqTemp<0){
|
||||
scqTemp=0.0;
|
||||
}
|
||||
item.setScq(scqTemp);
|
||||
// 奖金基数(考勤)= 月度绩效奖金基数-月度绩效基数/满勤*缺勤天数
|
||||
double kqjs= item.getYdjjjxjs() - item.getYdjjjxjs()/ycq[0]*qq;
|
||||
item.setJjjskq(kqjs);
|
||||
// 奖金实发放额= 奖金基数(考勤)*个人绩效系数
|
||||
item.setYfje(item.getGrjxxs() * kqjs);
|
||||
}
|
||||
return item;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 处理离职人员离职所在月份的数据
|
||||
// 将离职信息转为map
|
||||
baseBean.writeLog("处理离职人员离职所在月份的数据");
|
||||
Map<Integer, Date> map = departureInfo.stream().collect(Collectors.toMap(DepartureInfo::getXm,d->d.getLzrq()));
|
||||
departureTemp.stream().forEach(i-> {
|
||||
// 离职日期
|
||||
Date date = map.get(Integer.valueOf(i.getXm()));
|
||||
Date kqyf = i.getKqyf();
|
||||
if( date.getMonth() == kqyf.getMonth()){
|
||||
// 是离职所在月份,获取离职日期重新计算该月缺勤日期以及绩效
|
||||
Calendar deparLastDay = Calendar.getInstance();
|
||||
deparLastDay.setTime(date);
|
||||
deparLastDay.add(Calendar.DATE,1);
|
||||
Calendar deaprAttendEndDay = getEndAttendanceCal(kqyf);
|
||||
double[] sqq={0.0};
|
||||
if(Math.abs(i.getYcq()-21.75) < 0.000000002){
|
||||
int[] qq={0};
|
||||
Calendar countCal = Calendar.getInstance();
|
||||
countCal.setTime(deaprAttendEndDay.getTime());
|
||||
// 均为境内,取离职日后一天-考勤最后一天的工作日
|
||||
while (deparLastDay.getTime().before(countCal.getTime()) || deparLastDay.getTime().equals(countCal.getTime())){
|
||||
if( (countCal.get(Calendar.DAY_OF_WEEK) != 1) && (countCal.get(Calendar.DAY_OF_WEEK)!=7) ){
|
||||
qq[0]++;
|
||||
}
|
||||
countCal.add(Calendar.DATE,-1);
|
||||
}
|
||||
sqq[0] = i.getQq()+qq[0];
|
||||
}else{
|
||||
// 存在境外,取离职日后一天-考勤最后一天的自然日
|
||||
sqq[0] = i.getQq()+getDays(deparLastDay.getTime(), deaprAttendEndDay.getTime());
|
||||
}
|
||||
i.setQq(sqq[0]);
|
||||
// 重新计算1、实出勤天数 =应出勤天数-缺勤天数 2、奖金基数(考勤)= 月度绩效奖金基数-月度绩效基数/满勤*缺勤天数 3、奖金实发放额= 奖金基数(考勤)*个人绩效系数
|
||||
double scqTemp =i.getYcq()-sqq[0];
|
||||
if (scqTemp<0){
|
||||
scqTemp=0.0;
|
||||
}
|
||||
i.setScq(scqTemp);
|
||||
double jjjskq = i.getYdjjjxjs() - i.getYdjjjxjs() / i.getYcq() * sqq[0];
|
||||
i.setJjjskq(jjjskq);
|
||||
i.setYfje(i.getGrjxxs()*jjjskq);
|
||||
}
|
||||
});
|
||||
// 先删除建模中脏数据
|
||||
baseBean.writeLog("先删除建模中脏数据");
|
||||
getMonthBonusDAO().clear(bonusMonth,bonusSendMonth,haveSendDepartureInfo);
|
||||
// 将数据插入建模中
|
||||
List<Integer> departureUsers = departureInfo.stream().map(i -> i.getXm()).collect(Collectors.toList());
|
||||
baseBean.writeLog("将数据插入建模中");
|
||||
getMonthBonusDAO().insertList(result,departureUsers,bonusSendMonth);
|
||||
|
||||
return "null";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* @description 境外常驻信息格式化
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/11 17:07
|
||||
*/
|
||||
private List<JwCZInfo> formatJwCZInfo(List<JwCZInfoDetail> czInfos) {
|
||||
Map<String, List<JwCZInfoDetail>> groupByName = czInfos.stream().collect(Collectors.groupingBy(item -> item.getXm()));
|
||||
List<JwCZInfo> formatJwCZInfos = new ArrayList<>();
|
||||
for (Map.Entry<String, List<JwCZInfoDetail>> entry : groupByName.entrySet()) {
|
||||
JwCZInfo build = new JwCZInfo().builder().xm(entry.getValue().get(0).getXm()).infos(entry.getValue()).build();
|
||||
formatJwCZInfos.add(build);
|
||||
}
|
||||
return formatJwCZInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取2个时间段中有多少天
|
||||
* @return Long
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/11 20:12
|
||||
*/
|
||||
private int getDays(Date startDate,Date endDate) {
|
||||
int days = (int)( (endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24) + 1);
|
||||
return days;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 判断某一天是否在某一个时间区间内
|
||||
* @return Long
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/11 20:12
|
||||
*/
|
||||
private boolean isBetween(Date now,Date startDate,Date endDate) {
|
||||
if( (now.after(startDate) || now.equals(startDate)) && ( (now.before(endDate) || now.equals(endDate)) )){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/***
|
||||
* @description 根据考勤所属月获取考勤开始日期
|
||||
* @return Calendar
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/14 21:57
|
||||
*/
|
||||
private Calendar getStartAttendanceCal(Date bonusMonth){
|
||||
Calendar startAttendanceCal = Calendar.getInstance();
|
||||
startAttendanceCal.setTime(bonusMonth);
|
||||
startAttendanceCal.add(Calendar.MONTH,-1);
|
||||
if(startAttendanceCal.getActualMaximum(Calendar.DAY_OF_MONTH) == 28){
|
||||
// 2月只有28天的情况(从3.1开始)
|
||||
startAttendanceCal.add(Calendar.MONTH, 1);
|
||||
startAttendanceCal.set(Calendar.DAY_OF_MONTH, 1);
|
||||
startAttendanceCal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
startAttendanceCal.set(Calendar.MINUTE, 0);
|
||||
startAttendanceCal.set(Calendar.SECOND, 0);
|
||||
startAttendanceCal.set(Calendar.MILLISECOND, 0);
|
||||
}else{
|
||||
startAttendanceCal.set(Calendar.DAY_OF_MONTH, 29);
|
||||
startAttendanceCal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
startAttendanceCal.set(Calendar.MINUTE, 0);
|
||||
startAttendanceCal.set(Calendar.SECOND, 0);
|
||||
startAttendanceCal.set(Calendar.MILLISECOND, 0);
|
||||
}
|
||||
return startAttendanceCal;
|
||||
}
|
||||
|
||||
/***
|
||||
* @description 根据考勤所属月获取考勤结束日期
|
||||
* @return Calendar
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/14 21:57
|
||||
*/
|
||||
private Calendar getEndAttendanceCal(Date bonusMonth){
|
||||
Calendar endAttendanceCal = Calendar.getInstance();
|
||||
endAttendanceCal.setTime(bonusMonth);
|
||||
endAttendanceCal.set(Calendar.DAY_OF_MONTH,28);
|
||||
endAttendanceCal.set(Calendar.HOUR_OF_DAY, 23);
|
||||
endAttendanceCal.set(Calendar.MINUTE, 59);
|
||||
endAttendanceCal.set(Calendar.SECOND, 59);
|
||||
endAttendanceCal.set(Calendar.MILLISECOND, 999);
|
||||
return endAttendanceCal;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.engine.bjcj220907.web;
|
||||
|
||||
|
||||
import com.engine.bjcj220907.entity.AbroadBusinessCountParam;
|
||||
import com.engine.bjcj220907.service.impl.AbroadBusinessCountServiceImpl;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/05 11:45
|
||||
* @description 计算员工国外出差天数
|
||||
*/
|
||||
public class AbroadBusinessCountController extends BaseCronJob {
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date searchMonth;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Date date = new Date();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
cal.add(Calendar.MONTH,-1);
|
||||
baseBean.writeLog("开始计算:"+date+"的境外出差天数");
|
||||
AbroadBusinessCountParam param = new AbroadBusinessCountParam().builder().month(cal.getTime()).build();
|
||||
new AbroadBusinessCountServiceImpl().countDays(param);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.engine.bjcj220907.web;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.engine.bjcj220907.dao.MonthBonusDAO;
|
||||
import com.engine.bjcj220907.entity.CountMonthBonusParam;
|
||||
import com.engine.bjcj220907.service.impl.MonthBonusCountServiceImpl;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/09/08 13:52
|
||||
* @description 月度绩效奖金计算
|
||||
*/
|
||||
public class MonthBonusCountController extends AbstractModeExpandJavaCodeNew {
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
|
||||
private MonthBonusCountServiceImpl getMonthBonusCountService(User user) {
|
||||
return ServiceUtil.getService(MonthBonusCountServiceImpl.class,user);
|
||||
}
|
||||
|
||||
public MonthBonusDAO getMonthBonusDAO(){
|
||||
return new MonthBonusDAO();
|
||||
}
|
||||
|
||||
/***
|
||||
* @description 月度计算奖金计算
|
||||
* @return String
|
||||
* @author Harryxzy
|
||||
* @date 2022/9/8 13:56
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
try {
|
||||
User user = (User)param.get("user");
|
||||
Map<String,String> jsonStr = JSON.parseObject((String) param.get("JSONStr"), Map.class);
|
||||
int i=1;
|
||||
String sendM = "";
|
||||
String bonusM = "";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
for (Map.Entry<String, String> entry : jsonStr.entrySet()) {
|
||||
if(i==1){
|
||||
sendM = entry.getValue();
|
||||
}
|
||||
if(i==2){
|
||||
bonusM = entry.getValue();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
CountMonthBonusParam countParam = CountMonthBonusParam.builder().bonusMonth(sdf.parse(bonusM)).bonusSendMonth(sdf.parse(sendM)).build();
|
||||
baseBean.writeLog("开始核算绩效,绩效所属月:"+bonusM+",绩效发放月:"+sendM);
|
||||
if(!verifyParam(countParam,result)){
|
||||
return result;
|
||||
}
|
||||
getMonthBonusCountService(user).countMonthBonus(countParam);
|
||||
} catch (Exception e) {
|
||||
result.put("errmsg","出错");
|
||||
result.put("flag", "false");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean verifyParam(CountMonthBonusParam param,Map<String, String> result){
|
||||
Date bonusMonth = param.getBonusMonth();
|
||||
Date bonusSendMonth = param.getBonusSendMonth();
|
||||
if(bonusSendMonth.before(bonusMonth)){
|
||||
baseBean.writeLog("薪资发放月份不能早于薪资所属月");
|
||||
result.put("errmsg","薪资发放月份不能早于薪资所属月");
|
||||
result.put("flag", "false");
|
||||
return false;
|
||||
}
|
||||
boolean haveRecordFlag = getMonthBonusDAO().haveRecord(bonusMonth);
|
||||
if(haveRecordFlag){
|
||||
baseBean.writeLog("判断参数薪资所属月:"+param.getBonusMonth()+",薪资发放月:"+param.getBonusSendMonth()+"已经有过记录");
|
||||
result.put("errmsg","该绩效所属月已有核算记录,请先删除原有记录");
|
||||
result.put("flag", "false");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="GENERAL_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="JRebel" name="JRebel">
|
||||
<configuration>
|
||||
<option name="ideModuleStorage">
|
||||
<map>
|
||||
<entry key="com.zeroturnaround.jrebel.FormatVersion" value="7.0.0" />
|
||||
<entry key="jrebelEnabled" value="true" />
|
||||
<entry key="lastExternalPluginCheckTime" value="1663248149371" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="version" value="3" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="classbean" level="project" />
|
||||
<orderEntry type="library" name="lib1" level="project" />
|
||||
<orderEntry type="library" name="lib" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
Loading…
Reference in New Issue