内部竞聘 功能开发

This commit is contained in:
dxfeng 2024-12-17 18:51:43 +08:00
parent 94096cc062
commit c5c9a5258a
2 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,87 @@
package weaver.formmode.recruit.modeexpand.internal;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.soa.workflow.request.MainTableInfo;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.util.*;
/**
* @author:dxfeng
* @createTime: 2024/12/17
* @version: 1.0
*/
public class InterviewRatingModeExpand extends AbstractModeExpandJavaCodeNew {
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
RecordSet rs = new RecordSet();
Map<String, String> result = new HashMap<>();
try {
int billId;
int modeId;
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
if (requestInfo != null) {
User user = (User) param.get("user");
billId = Util.getIntValue(requestInfo.getRequestid());
modeId = Util.getIntValue(requestInfo.getWorkflowid());
if (billId > 0 && modeId > 0) {
Map<String, Object> mainDataMap = new HashMap<>();
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
Property[] properties = mainTableInfo.getProperty();
for (Property property : properties) {
mainDataMap.put(property.getName(), property.getValue());
}
String nbjp = Util.null2String(mainDataMap.get("nbjp"));
rs.executeQuery("select * from uf_jcl_nbjpmspf where nbjp = ?", nbjp);
List<Integer> scopeList = new ArrayList<>();
while (rs.next()) {
int zhpf = rs.getInt("zhpf");
if (zhpf > 0) {
scopeList.add(zhpf);
}
}
if (scopeList.size() <= 2) {
return result;
}
// scopeList去掉一个最高分一个最低分 求总分
int sum = calculateSum(scopeList);
if (sum > 0) {
// 更新内部应聘者台账的分数
rs.executeUpdate("update uf_jcl_nbzwsq set mspfhz = ? where id = ? ", sum, nbjp);
}
}
}
} catch (Exception e) {
new BaseBean().writeLog(e);
result.put("errmsg", e.getMessage());
result.put("flag", "false");
}
return result;
}
public static int calculateSum(List<Integer> scores) {
// 找到最高分和最低分
int maxScore = Collections.max(scores);
int minScore = Collections.min(scores);
// 去掉一个最高分和一个最低分
scores.remove(Integer.valueOf(maxScore));
scores.remove(Integer.valueOf(minScore));
// 计算剩余分数的总和
int sum = 0;
for (int score : scores) {
sum += score;
}
return sum;
}
}

View File

@ -0,0 +1,27 @@
package weaver.interfaces.recruit.cronjob;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.interfaces.schedule.BaseCronJob;
/**
* @author:dxfeng
* @createTime: 2024/12/17
* @version: 1.0
*/
public class RefreshInternalStatusJob extends BaseCronJob {
@Override
public void execute() {
String currentDate = DateUtil.getCurrentDate();
RecordSet rs = new RecordSet();
RecordSet recordSet = new RecordSet();
rs.executeQuery("select * from uf_jcl_nbzwsq where jpzt = 1");
while (rs.next()) {
String gsjsrq = rs.getString("gsjsrq");
if(currentDate.equals(gsjsrq)){
String id = rs.getString("id");
recordSet.executeUpdate("update uf_jcl_nbzwsq set jpzt = 2 where id = ?", id);
}
}
}
}