weaver-hrm-recruit/src/weaver/interfaces/recruit/action/RecruitEntryAction.java

65 lines
2.4 KiB
Java

package weaver.interfaces.recruit.action;
import cn.hutool.core.convert.Convert;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.MainTableInfo;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.Map;
/**
* 招聘 入职流程Action
*
* @author:dxfeng
* @createTime: 2025/02/07
* @version: 1.0
*/
public class RecruitEntryAction implements Action {
RecordSet rs = new RecordSet();
@Override
public String execute(RequestInfo requestInfo) {
try {
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
Property[] properties = mainTableInfo.getProperty();
Map<String, Object> mainDataMap = new HashMap<>();
for (Property property : properties) {
mainDataMap.put(property.getName(), property.getValue());
}
// 入职关联招聘需求的入职人数+1
String glzpxq = Util.null2String(mainDataMap.get("glzpxq"));
if (StringUtils.isNotBlank(glzpxq)) {
rs.executeQuery("select rzrs,zprs from uf_jcl_zp_zpxq where id = ? ", glzpxq);
if (rs.next()) {
int rzrs = Convert.toInt(rs.getString("rzrs"), 0) + 1;
int zprs = rs.getInt("zprs");
BigDecimal xqzhjd = new BigDecimal("0.00");
if (zprs > 0) {
xqzhjd = new BigDecimal(rzrs).divide(new BigDecimal(zprs), 2, RoundingMode.HALF_DOWN);
}
rs.executeUpdate("update uf_jcl_zp_zpxq set rzrs = ?,xqzhjd = ? where id = ? ", rzrs, xqzhjd, glzpxq);
}
}
// 更新入职状态
String rzjlid = Util.null2String(mainDataMap.get("rzjlid"));
if (StringUtils.isNotBlank(rzjlid)) {
rs.executeUpdate("update uf_jcl_rzgl set rzzt = 1 where id = ?", rzjlid);
}
return SUCCESS;
} catch (Exception e) {
rs.writeLog(e);
requestInfo.getRequestManager().setMessagecontent(e.getMessage());
return FAILURE_AND_CONTINUE;
}
}
}