艾志修改社保福利方案信息
This commit is contained in:
parent
bc3cddfe38
commit
9a25668829
|
|
@ -0,0 +1,155 @@
|
|||
package com.engine.salary.timer;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.sischeme.param.InsuranceSchemeDetailUpdateParam;
|
||||
import com.engine.salary.service.SISchemeService;
|
||||
import com.engine.salary.service.impl.SISchemeServiceImpl;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.time.YearMonth;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName AutoUpdateSchemeJob
|
||||
* @date 2023/08/24 16:52
|
||||
* @description
|
||||
*/
|
||||
public class AutoUpdateSchemeJob extends BaseCronJob {
|
||||
|
||||
private SISchemeService getSISchemeService(User user) {
|
||||
return ServiceUtil.getService(SISchemeServiceImpl.class,user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
User user = new User();
|
||||
user.setUid(1);
|
||||
user.setLoginid("sysadmin");
|
||||
// 社保执行的建模id
|
||||
Set<String> sbzxIds = new HashSet<>();
|
||||
// 公积金执行的建模id
|
||||
Set<String> gjjzxIds = new HashSet<>();
|
||||
// 获取所有需要更新社保公积金数据的信息
|
||||
List<InsuranceSchemeDetailUpdateParam> needUpdateInfos = getNeedUpdateInfos(sbzxIds, gjjzxIds);
|
||||
// 修改社保福利方案
|
||||
List<String> errMsg = getSISchemeService(user).updateSchemeDetail(needUpdateInfos);
|
||||
if (CollectionUtils.isNotEmpty(errMsg)) {
|
||||
BaseBean baseBean = new BaseBean();
|
||||
baseBean.writeLog("修改社保福利档案错误信息:"+ errMsg);
|
||||
}
|
||||
// 更新建模执行状态
|
||||
RecordSet updateRs = new RecordSet();
|
||||
if (CollectionUtils.isNotEmpty(sbzxIds)) {
|
||||
String idStr = StringUtils.join(sbzxIds, ",");
|
||||
updateRs.execute("update uf_flsbfa set gjjsfzx=0 where id in (" + idStr + ")");
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(gjjzxIds)) {
|
||||
String idStr = StringUtils.join(gjjzxIds, ",");
|
||||
updateRs.execute("update uf_flsbfa set sbsfzx=0 where id in (" + idStr + ")");
|
||||
}
|
||||
|
||||
}
|
||||
private List<InsuranceSchemeDetailUpdateParam> getNeedUpdateInfos(Set<String> sbzxIds, Set<String> gjjzxIds) {
|
||||
List<InsuranceSchemeDetailUpdateParam> paramList = new ArrayList<>();
|
||||
// 获取今天需要生效的数据
|
||||
YearMonth todayYearMonth = SalaryDateUtil.localDate2YearMonth(new Date());
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
BaseBean baseBean = new BaseBean();
|
||||
String sql = "select * from uf_flsbfa where sbsfzx=1 or gjjsfzx=1";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String sbsxy = rs.getString("sbsxy");
|
||||
String gjjsxy = rs.getString("gjjsxy");
|
||||
YearMonth sbYearMonth = SalaryDateUtil.String2YearMonth(sbsxy);
|
||||
YearMonth gjjYearMonth = SalaryDateUtil.String2YearMonth(gjjsxy);
|
||||
if(sbYearMonth != null && !sbYearMonth.isAfter(todayYearMonth)) {
|
||||
// 需要执行修改社保
|
||||
int id = rs.getInt("id");
|
||||
String sbdqfa = rs.getString("sbdqfa");
|
||||
rs2.execute("select * from uf_flsbfa_dt1 where mainid ="+id);
|
||||
// 获取残保金id
|
||||
String cbjId = baseBean.getPropValue("azgySalary","cbjCategoryId");
|
||||
// 获取大病医疗id
|
||||
String dbylId = baseBean.getPropValue("azgySalary","dbylCategoryId");
|
||||
while (rs2.next()) {
|
||||
// 0-个人 1-公司
|
||||
Integer jndx = rs2.getInt("jndx");
|
||||
if (jndx != null && jndx != -1) {
|
||||
if (jndx.equals(0)) {
|
||||
jndx = 2;
|
||||
}
|
||||
double sybxjnbl = rs2.getDouble("sybxjnbl");
|
||||
if (sybxjnbl != -1) {
|
||||
paramList.add(InsuranceSchemeDetailUpdateParam.builder().primaryId(Long.valueOf(sbdqfa)).insuranceId(9005L).isPayment(1)
|
||||
.paymentScope(jndx).paymentProportion(String.valueOf(sybxjnbl)).build());
|
||||
}
|
||||
double shiybxjnbl = rs2.getDouble("shiybxjnbl");
|
||||
if (shiybxjnbl != -1) {
|
||||
paramList.add(InsuranceSchemeDetailUpdateParam.builder().primaryId(Long.valueOf(sbdqfa)).insuranceId(9004L).isPayment(1)
|
||||
.paymentScope(jndx).paymentProportion(String.valueOf(shiybxjnbl)).build());
|
||||
|
||||
}
|
||||
double gsbxjnbl = rs2.getDouble("gsbxjnbl");
|
||||
if (gsbxjnbl != -1) {
|
||||
paramList.add(InsuranceSchemeDetailUpdateParam.builder().primaryId(Long.valueOf(sbdqfa)).insuranceId(9003L).isPayment(1)
|
||||
.paymentScope(jndx).paymentProportion(String.valueOf(gsbxjnbl)).build());
|
||||
}
|
||||
double ylbxjnbl = rs2.getDouble("ylbxjnbl");
|
||||
if (ylbxjnbl != -1) {
|
||||
paramList.add(InsuranceSchemeDetailUpdateParam.builder().primaryId(Long.valueOf(sbdqfa)).insuranceId(9002L).isPayment(1)
|
||||
.paymentScope(jndx).paymentProportion(String.valueOf(ylbxjnbl)).build());
|
||||
}
|
||||
double yanglbxjnbl = rs2.getDouble("yanglbxjnbl");
|
||||
if (yanglbxjnbl != -1) {
|
||||
paramList.add(InsuranceSchemeDetailUpdateParam.builder().primaryId(Long.valueOf(sbdqfa)).insuranceId(9001L).isPayment(1)
|
||||
.paymentScope(jndx).paymentProportion(String.valueOf(yanglbxjnbl)).build());
|
||||
}
|
||||
double cbjjnbl = rs2.getDouble("cbjjnbl");
|
||||
if (cbjjnbl != -1) {
|
||||
paramList.add(InsuranceSchemeDetailUpdateParam.builder().primaryId(Long.valueOf(sbdqfa)).insuranceId(Long.valueOf(cbjId)).isPayment(1)
|
||||
.paymentScope(jndx).paymentProportion(String.valueOf(cbjjnbl)).build());
|
||||
}
|
||||
double dbyly = rs2.getDouble("dbyly");
|
||||
if (dbyly != -1) {
|
||||
paramList.add(InsuranceSchemeDetailUpdateParam.builder().primaryId(Long.valueOf(sbdqfa)).insuranceId(Long.valueOf(dbylId)).isPayment(1)
|
||||
.paymentScope(jndx).fixedCost(String.valueOf(dbyly)).build());
|
||||
}
|
||||
sbzxIds.add(String.valueOf(sbdqfa));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(gjjYearMonth != null && !gjjYearMonth.isAfter(todayYearMonth)) {
|
||||
// 需要执行修改公积金
|
||||
String gjjdqfa = rs.getString("gjjdqfa");
|
||||
int id = rs.getInt("id");
|
||||
rs2.execute("select * from uf_flsbfa_dt2 where mainid ="+id);
|
||||
while (rs2.next()) {
|
||||
// 0-个人 1-公司
|
||||
Integer jndx = rs2.getInt("jndx");
|
||||
if (jndx != null && jndx != -1) {
|
||||
if (jndx.equals(0)) {
|
||||
jndx = 2;
|
||||
}
|
||||
double zfgjjjnbl = rs2.getDouble("zfgjjjnbl");
|
||||
if (zfgjjjnbl != -1) {
|
||||
paramList.add(InsuranceSchemeDetailUpdateParam.builder().primaryId(Long.valueOf(gjjdqfa)).insuranceId(9006L).isPayment(1)
|
||||
.paymentScope(jndx).paymentProportion(String.valueOf(zfgjjjnbl)).build());
|
||||
}
|
||||
gjjzxIds.add(String.valueOf(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return paramList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue