Compare commits
10 Commits
26cc7d7fa4
...
eaa328e1ba
| Author | SHA1 | Date |
|---|---|---|
|
|
eaa328e1ba | |
|
|
9eec49a4ed | |
|
|
6ffa03bb2a | |
|
|
b3db90d3bd | |
|
|
8a7e06aed8 | |
|
|
f83d7d4bb6 | |
|
|
fd691a4eef | |
|
|
85026bce47 | |
|
|
55176384e2 | |
|
|
03742aa9e0 |
|
|
@ -0,0 +1,26 @@
|
|||
const pxxgpgfs_id = WfForm.convertFieldNameToId("pxxgpgfs");
|
||||
const drlzy_id = WfForm.convertFieldNameToId("drlzy");
|
||||
var cjry_id = WfForm.convertFieldNameToId("cjry", "detail_2");
|
||||
|
||||
|
||||
WfForm.bindFieldChangeEvent(pxxgpgfs_id, function (obj, id, value) {
|
||||
console.log('value', value)
|
||||
WfForm.delDetailRow("detail_2", "all");
|
||||
if (value == '' || value == 0) {
|
||||
return;
|
||||
} else {
|
||||
var drlzy_value = WfForm.getFieldValue(drlzy_id);
|
||||
var drlzy_obj = mobx.toJS(wfform.getFieldValueObj(drlzy_id).specialobj);
|
||||
|
||||
const array = drlzy_value.split(",");
|
||||
array.map((item, index) => {
|
||||
var addObj = {};
|
||||
addObj[cjry_id] = {
|
||||
value: item,
|
||||
specialobj: [drlzy_obj[index]]
|
||||
};
|
||||
console.log(addObj)
|
||||
WfForm.addDetailRow("detail_2", addObj);
|
||||
})
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
const bm_id = WfForm.convertFieldNameToId("bm", "detail_1");
|
||||
const nd_id = WfForm.convertFieldNameToId("nd", "detail_1");
|
||||
const jhzprs_id = WfForm.convertFieldNameToId("jhzprs", "detail_1");
|
||||
const nmzgrs_id = WfForm.convertFieldNameToId("nmzgrs", "detail_1");
|
||||
const nmyjddzrs_id = WfForm.convertFieldNameToId("nmyjddzrs", "detail_1");
|
||||
const count = WfForm.getDetailRowCount("detail_1");
|
||||
if (count == 0) {
|
||||
|
||||
$.ajax({
|
||||
url: `/api/jcl/recruit/demand/getRecruitDemandList`,
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
async: false,
|
||||
success: function (res) {
|
||||
if (res.api_status && res.data && res.data.details) {
|
||||
let year = res.data.year;
|
||||
let detailList = res.data.details;
|
||||
for (let i = 0; i < detailList.length; i++) {
|
||||
let detail = detailList[i];
|
||||
var addObj = {};
|
||||
addObj[bm_id] = {
|
||||
value: detail.departmentId,
|
||||
specialobj: [
|
||||
{id: detail.departmentId, name: detail.departmentName}
|
||||
]
|
||||
};
|
||||
addObj[nd_id] = {value: year};
|
||||
addObj[jhzprs_id] = {value: detail.plannedNumber};
|
||||
addObj[nmzgrs_id] = {value: detail.onJobNumber};
|
||||
addObj[nmyjddzrs_id] = {value: detail.totalNumber};
|
||||
WfForm.addDetailRow("detail_1", addObj);
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log("接口请求异常,请联系管理员处理,res", res);
|
||||
msg = res.errormsg;
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.log("接口请求异常,请联系管理员处理,error", error);
|
||||
msg = '接口请求异常,请联系管理员处理';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.api.hzzx.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/25
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Path("/jcl/recruit/demand")
|
||||
public class RecruitDemandController extends com.engine.hzzx.web.RecruitDemandController{
|
||||
}
|
||||
|
|
@ -55,6 +55,22 @@ public class DataUtil {
|
|||
return formModeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据表名,获取表单ID
|
||||
*
|
||||
* @param modeTable
|
||||
* @return
|
||||
*/
|
||||
public static int getFormIdByTableName(String modeTable) {
|
||||
int formId = -1;
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from workflow_bill where tablename = ? ", modeTable);
|
||||
if (rs.next()) {
|
||||
formId = rs.getInt("id");
|
||||
}
|
||||
return formId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入数据
|
||||
*
|
||||
|
|
@ -81,6 +97,31 @@ public class DataUtil {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID更新数据
|
||||
*
|
||||
* @param dataMap
|
||||
* @param tableName
|
||||
*/
|
||||
public static void updateDataById(Map<String, String> dataMap, String tableName) {
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
List<Object> dataList = new ArrayList<>();
|
||||
String id = Util.null2String(dataMap.get("id"));
|
||||
dataMap.remove("id");
|
||||
|
||||
dataMap.forEach((key, value) -> {
|
||||
fieldList.add(key + " = ? ");
|
||||
dataList.add(value);
|
||||
});
|
||||
dataList.add(id);
|
||||
String updateSql = "update " + tableName + " set " + StringUtils.join(fieldList, ",") + " where id = ? ";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeUpdate(updateSql, dataList);
|
||||
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
|
||||
throw new CustomizeRunTimeException(rs.getExceptionMsg());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建建模表基本数据
|
||||
|
|
@ -165,4 +206,22 @@ public class DataUtil {
|
|||
return selectValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取文档ID
|
||||
*
|
||||
* @param imageFileId
|
||||
* @return
|
||||
*/
|
||||
public static String getDocIdByImageId(String imageFileId) {
|
||||
if (StringUtils.isBlank(imageFileId)) {
|
||||
return "";
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select docid from DocImageFile where IMAGEFILEID=?", imageFileId);
|
||||
if (rs.next()) {
|
||||
return rs.getString("docid");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public class Employee {
|
|||
private Integer age;
|
||||
private String departmentCode;
|
||||
private String positionCode;
|
||||
private String positionName;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
|||
|
|
@ -49,13 +49,26 @@ public class EmployeeTrans {
|
|||
}
|
||||
|
||||
|
||||
public static String getJobtitleId(String jobtitleCode) {
|
||||
//public static String getJobtitleId(String jobtitleCode) {
|
||||
// String jobtitleId = "";
|
||||
// RecordSet rs = new RecordSet();
|
||||
// if (StringUtils.isBlank(jobtitleCode)) {
|
||||
// return jobtitleId;
|
||||
// }
|
||||
// rs.executeQuery("select id from hrmjobtitles where jobtitlecode = ?", jobtitleCode);
|
||||
// if (rs.next()) {
|
||||
// jobtitleId = rs.getString("id");
|
||||
// }
|
||||
// return jobtitleId;
|
||||
//}
|
||||
|
||||
public static String getJobIdByName(String name) {
|
||||
String jobtitleId = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
if (StringUtils.isBlank(jobtitleCode)) {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return jobtitleId;
|
||||
}
|
||||
rs.executeQuery("select id from hrmjobtitles where jobtitlecode = ?", jobtitleCode);
|
||||
rs.executeQuery("select id from uf_gwgl where gwmc = ?", name);
|
||||
if (rs.next()) {
|
||||
jobtitleId = rs.getString("id");
|
||||
}
|
||||
|
|
@ -70,49 +83,18 @@ public class EmployeeTrans {
|
|||
switch (educationLevel) {
|
||||
case "1":
|
||||
// 本科
|
||||
educationLevelId = "7";
|
||||
educationLevelId = "1";
|
||||
break;
|
||||
case "2":
|
||||
// 硕士研究生
|
||||
educationLevelId = "8";
|
||||
break;
|
||||
case "3":
|
||||
// 高中
|
||||
educationLevelId = "3";
|
||||
break;
|
||||
case "4":
|
||||
// 中技(中专/技校/职高)
|
||||
educationLevelId = "4";
|
||||
break;
|
||||
case "5":
|
||||
// 大专
|
||||
educationLevelId = "6";
|
||||
break;
|
||||
case "6":
|
||||
// MBA
|
||||
educationLevelId = "10";
|
||||
educationLevelId = "2";
|
||||
break;
|
||||
case "7":
|
||||
// 博士研究生
|
||||
educationLevelId = "9";
|
||||
break;
|
||||
case "8":
|
||||
// 初中
|
||||
educationLevelId = "2";
|
||||
break;
|
||||
case "9":
|
||||
// 小学
|
||||
case "10":
|
||||
// 保密
|
||||
case "130":
|
||||
// MPA
|
||||
educationLevelId = "1";
|
||||
break;
|
||||
case "120":
|
||||
// EMBA
|
||||
educationLevelId = "11";
|
||||
educationLevelId = "3";
|
||||
break;
|
||||
default:
|
||||
educationLevelId = "4";
|
||||
break;
|
||||
}
|
||||
return educationLevelId;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package com.engine.hzzx.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/20
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class RecruitingPlan {
|
||||
|
||||
public RecruitingPlan(Integer departmentId, Integer onJobNumber) {
|
||||
this.departmentId = departmentId;
|
||||
this.onJobNumber = onJobNumber;
|
||||
}
|
||||
|
||||
public RecruitingPlan(String requestId, String departmentName, Integer departmentId, Integer plannedNumber, Integer onJobNumber) {
|
||||
this.requestId = requestId;
|
||||
this.departmentName = departmentName;
|
||||
this.departmentId = departmentId;
|
||||
this.plannedNumber = plannedNumber;
|
||||
this.onJobNumber = onJobNumber;
|
||||
}
|
||||
|
||||
private String departmentName;
|
||||
private Integer departmentId;
|
||||
private Integer plannedNumber;
|
||||
private Integer onJobNumber;
|
||||
private Integer totalNumber;
|
||||
private String requestId;
|
||||
|
||||
public Integer getTotalNumber() {
|
||||
return plannedNumber + onJobNumber;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.engine.hzzx.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/25
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface RecruitDemandService {
|
||||
|
||||
/**
|
||||
* 获取招聘需求列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getRecruitDemandList(Map<String, Object> params);
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.engine.hzzx.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hzzx.entity.RecruitingPlan;
|
||||
import com.engine.hzzx.service.RecruitDemandService;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/25
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class RecruitDemandServiceImpl extends Service implements RecruitDemandService {
|
||||
// update workflow_config set value=value+',field9536_1' where name='support_html_textarea_field'
|
||||
@Override
|
||||
public Map<String, Object> getRecruitDemandList(Map<String, Object> params) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String year = DateUtil.getYear();
|
||||
// 查询当前年度提交的数据
|
||||
//rs.executeQuery("select * from uf_zpxqhztz where sqrq like '%" + year + "%'");
|
||||
rs.executeQuery("SELECT id, lcid FROM uf_zpxqhztz WHERE YEAR(sqrq) = ?", year);
|
||||
Map<String, String> mainIdsMap = new HashMap<>();
|
||||
while (rs.next()) {
|
||||
String lcid = rs.getString("lcid");
|
||||
String mainId = rs.getString("id");
|
||||
mainIdsMap.put(mainId, lcid);
|
||||
}
|
||||
|
||||
// 查询明细表数据
|
||||
List<RecruitingPlan> recruitingPlans = new ArrayList<>();
|
||||
mainIdsMap.forEach((mainId, lcid) -> {
|
||||
rs.executeQuery("select * from uf_zpxqhztz_dt1 where mainid = ?", mainId);
|
||||
while (rs.next()) {
|
||||
recruitingPlans.add(new RecruitingPlan(lcid, "", rs.getInt("zpbm"), rs.getInt("xqrs"), 0));
|
||||
}
|
||||
});
|
||||
|
||||
Map<Integer, Integer> departmentSum = new HashMap<>();
|
||||
Map<Integer, String> departmentApply = new HashMap<>();
|
||||
|
||||
// 遍历recruitingPlans列表
|
||||
for (RecruitingPlan plan : recruitingPlans) {
|
||||
int department = plan.getDepartmentId();
|
||||
int required = plan.getPlannedNumber();
|
||||
if (required < 0) {
|
||||
required = 0;
|
||||
}
|
||||
|
||||
// 将需求人数累加到对应部门的统计中
|
||||
departmentSum.put(
|
||||
department,
|
||||
departmentSum.getOrDefault(department, 0) + required
|
||||
);
|
||||
departmentApply.put(department, plan.getRequestId());
|
||||
}
|
||||
|
||||
// 汇总部门数据
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
List<RecruitingPlan> resultList = new ArrayList<>();
|
||||
departmentSum.forEach((department, requiredTotal) -> {
|
||||
// 查询当年年度统计的年末在岗人数
|
||||
int onJobNumber = 0;
|
||||
rs.executeQuery("select nmzgrs from uf_nmgbmzgrs where nd = '" + year + "' and bm = " + department);
|
||||
if (rs.next()) {
|
||||
onJobNumber = rs.getInt("nmzgrs");
|
||||
}
|
||||
String departmentname = departmentComInfo.getDepartmentname(String.valueOf(department));
|
||||
resultList.add(new RecruitingPlan(departmentApply.get(department), departmentname, department, requiredTotal, onJobNumber));
|
||||
});
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("details", resultList);
|
||||
resultMap.put("year", year);
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.engine.hzzx.web;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.hzzx.service.RecruitDemandService;
|
||||
import com.engine.hzzx.service.impl.RecruitDemandServiceImpl;
|
||||
import com.engine.hzzx.util.ResponseResult;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
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.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/25
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class RecruitDemandController {
|
||||
public RecruitDemandService getService(User user) {
|
||||
return ServiceUtil.getService(RecruitDemandServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getRecruitDemandList")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getRecruitDemandList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getRecruitDemandList, params);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ public class TrainingApplicationAction implements Action {
|
|||
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
|
||||
DetailTable[] detailTables = detailTableInfo.getDetailTable();
|
||||
for (int i = 0; i < detailTables.length; i++) {
|
||||
String detailTableName = MODE_TABLE_NAME + "_" + (i + 1);
|
||||
String detailTableName = MODE_TABLE_NAME + "_dt" + (i + 1);
|
||||
DetailTable table = detailTables[i];
|
||||
Row[] rows = table.getRow();
|
||||
for (Row row : rows) {
|
||||
|
|
@ -95,6 +95,13 @@ public class TrainingApplicationAction implements Action {
|
|||
insertData.put("pxmc", mainDataMap.get("pxmc"));
|
||||
insertData.put("xs", mainDataMap.get("xs"));
|
||||
insertData.put("jf", mainDataMap.get("jf"));
|
||||
|
||||
insertData.put("xzk", mainDataMap.get("xzk"));
|
||||
insertData.put("yjpxrs", mainDataMap.get("yjpxrs"));
|
||||
String pxjh = mainDataMap.get("pxjh");
|
||||
String docIdByImageId = DataUtil.getDocIdByImageId(pxjh);
|
||||
insertData.put("pxjh", docIdByImageId);
|
||||
insertData.put("qsm", mainDataMap.get("qsm"));
|
||||
DataUtil.insertData(insertData, MODE_TABLE_NAME);
|
||||
return DataUtil.refreshRight(uuid, MODE_TABLE_NAME, formModeId, operateId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,217 @@
|
|||
package weaver.interfaces.hzzx.action;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.*;
|
||||
import weaver.workflow.webservices.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/27
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class TrainingManageCreateFlowAction implements Action {
|
||||
/**
|
||||
* 培训效果评估表 流程ID
|
||||
*/
|
||||
public static final String FLOW_ID = "65";
|
||||
// TODO 测试用 public static final String FLOW_ID = "19";
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
try {
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
Map<String, String> mainDataMap = new HashMap<>();
|
||||
for (Property property : properties) {
|
||||
mainDataMap.put(property.getName(), property.getValue());
|
||||
}
|
||||
|
||||
String pxxgpgfs = mainDataMap.get("pxxgpgfs");
|
||||
String drlzy = mainDataMap.get("drlzy");
|
||||
String pxmc = mainDataMap.get("pxmc");
|
||||
String requestId = requestInfo.getRequestid();
|
||||
rs.writeLog("pxxgpgfs==" + pxxgpgfs + ",drlzy==" + drlzy + ",pxmc==" + pxmc);
|
||||
if (!"0".equals(pxxgpgfs)) {
|
||||
// 不是“培训效果评估表”,不做处理
|
||||
return SUCCESS;
|
||||
}
|
||||
List<Map<String,String>> detailList = new ArrayList<>();
|
||||
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
|
||||
DetailTable detailTable = detailTableInfo.getDetailTable(2);
|
||||
Row[] rows = detailTable.getRow();
|
||||
for (Row row : rows) {
|
||||
Map<String,String> detailData = new HashMap<>();
|
||||
Cell[] cells = row.getCell();
|
||||
for (Cell cell : cells) {
|
||||
detailData.put(cell.getName(),cell.getValue());
|
||||
}
|
||||
detailList.add(detailData);
|
||||
}
|
||||
|
||||
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
if (StringUtils.isNotBlank(drlzy)) {
|
||||
String[] userIds = drlzy.split(",");
|
||||
for (String userId : userIds) {
|
||||
// 创建流程
|
||||
String lastName = resourceComInfo.getLastname(userId);
|
||||
String workCode = resourceComInfo.getWorkcode(userId);
|
||||
String departmentId = resourceComInfo.getDepartmentID(userId);
|
||||
rs.writeLog("lastName==" + lastName + ",workCode==" + workCode + ",departmentId==" + departmentId);
|
||||
createWorkFLow(requestId, lastName, userId, workCode, departmentId, pxmc,detailList);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
} catch (Exception e) {
|
||||
rs.writeLog(e);
|
||||
requestInfo.getRequestManager().setMessagecontent(e.getMessage());
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建流程
|
||||
*
|
||||
* @param lastName
|
||||
* @param userId
|
||||
* @param workCode
|
||||
* @param departmentId
|
||||
* @param pxmc
|
||||
*/
|
||||
private void createWorkFLow(String requestId, String lastName, String userId, String workCode, String departmentId, String pxmc,List<Map<String,String>> detailList) throws Exception {
|
||||
// 根据培训名称,获取培新信息
|
||||
String pxsj = "";
|
||||
String jssjyc = "";
|
||||
rs.executeQuery("select * from uf_pxsssq where id = ?", pxmc);
|
||||
if (rs.next()) {
|
||||
pxsj = rs.getString("pxsj");
|
||||
jssjyc = rs.getString("jssjyc");
|
||||
}
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
List<String> teachers = new ArrayList<>();
|
||||
rs.executeQuery("select * from uf_pxsssq_dt1 where mainid = ?", pxmc);
|
||||
while (rs.next()) {
|
||||
String sklsnb = rs.getString("sklsnb");
|
||||
if (StringUtils.isNotBlank(sklsnb)) {
|
||||
String lastname = resourceComInfo.getLastname(sklsnb);
|
||||
if (StringUtils.isNotBlank(lastname)) {
|
||||
teachers.add(lastname);
|
||||
}
|
||||
}
|
||||
String sklswb = rs.getString("sklswb");
|
||||
if (StringUtils.isNotBlank(sklswb)) {
|
||||
teachers.add(sklswb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 构建主表流程数据
|
||||
WorkflowRequestTableField[] workflowRequestTableField = {
|
||||
createWorkflowRequestTableField("xm", userId),
|
||||
createWorkflowRequestTableField("gh", workCode),
|
||||
createWorkflowRequestTableField("bm", departmentId),
|
||||
createWorkflowRequestTableField("lc", requestId),
|
||||
// 新加字段
|
||||
createWorkflowRequestTableField("pxmc", pxmc),
|
||||
createWorkflowRequestTableField("pxkssj", pxsj),
|
||||
createWorkflowRequestTableField("pxjssj", jssjyc),
|
||||
createWorkflowRequestTableField("pxs", StringUtils.join(teachers,",")),
|
||||
};
|
||||
|
||||
WorkflowMainTableInfo workflowMainTableInfo = new WorkflowMainTableInfo();
|
||||
WorkflowRequestTableRecord[] workflowRequestTableRecord = new WorkflowRequestTableRecord[1];
|
||||
workflowMainTableInfo.setRequestRecords(workflowRequestTableRecord);
|
||||
workflowRequestTableRecord[0] = new WorkflowRequestTableRecord();
|
||||
workflowRequestTableRecord[0].setWorkflowRequestTableFields(workflowRequestTableField);
|
||||
|
||||
// 构建明细表数据
|
||||
WorkflowDetailTableInfo[] workflowDetailTableInfoArray = new WorkflowDetailTableInfo[3];
|
||||
workflowDetailTableInfoArray[0] = new WorkflowDetailTableInfo();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(detailList)) {
|
||||
// 明细表一
|
||||
WorkflowRequestTableRecord[] workflowRequestTableRecordDt = new WorkflowRequestTableRecord[detailList.size()];
|
||||
for (int i = 0; i < detailList.size(); i++) {
|
||||
Map<String, String> detailMap = detailList.get(i);
|
||||
WorkflowRequestTableField[] workflowRequestTableFieldDt = {
|
||||
// 插入课程名称
|
||||
createWorkflowRequestTableField("kcmc", detailMap.get("kcmc"))
|
||||
};
|
||||
workflowRequestTableRecordDt[i] = new WorkflowRequestTableRecord();
|
||||
workflowRequestTableRecordDt[i].setWorkflowRequestTableFields(workflowRequestTableFieldDt);
|
||||
}
|
||||
workflowDetailTableInfoArray[0].setWorkflowRequestTableRecords(workflowRequestTableRecordDt);
|
||||
}
|
||||
|
||||
createWorkflowRequest(FLOW_ID, "培训效果评估表-" + lastName + "-" + DateUtil.getCurrentDate(), userId, "1", workflowMainTableInfo, workflowDetailTableInfoArray);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建流程
|
||||
*
|
||||
* @param flowId
|
||||
* @param title
|
||||
* @param creatorId
|
||||
* @param isNextFlow
|
||||
* @param workflowMainTableInfo
|
||||
* @param workflowDetailTableInfoArray
|
||||
* @return
|
||||
*/
|
||||
public static String createWorkflowRequest(String flowId, String title, String creatorId, String isNextFlow, WorkflowMainTableInfo workflowMainTableInfo, WorkflowDetailTableInfo[] workflowDetailTableInfoArray) {
|
||||
WorkflowBaseInfo workflowBaseInfo = new WorkflowBaseInfo();
|
||||
workflowBaseInfo.setWorkflowId(flowId);
|
||||
//工作流程请求信息
|
||||
WorkflowRequestInfo workflowRequestInfo = new WorkflowRequestInfo();
|
||||
//请求标题
|
||||
workflowRequestInfo.setRequestName(title);
|
||||
//请求重要级别
|
||||
workflowRequestInfo.setRequestLevel("1");
|
||||
//显示
|
||||
workflowRequestInfo.setCanView(true);
|
||||
//创建者id
|
||||
workflowRequestInfo.setCreatorId(creatorId);
|
||||
//工作流信息
|
||||
workflowRequestInfo.setWorkflowBaseInfo(workflowBaseInfo);
|
||||
//主表
|
||||
workflowRequestInfo.setWorkflowMainTableInfo(workflowMainTableInfo);
|
||||
workflowRequestInfo.setWorkflowDetailTableInfos(workflowDetailTableInfoArray);
|
||||
//是否提交下一节点
|
||||
workflowRequestInfo.setIsnextflow(isNextFlow);
|
||||
|
||||
WorkflowService workflow = new WorkflowServiceImpl();
|
||||
return workflow.doCreateWorkflowRequest(workflowRequestInfo, Convert.toInt(creatorId, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建流程字段
|
||||
*
|
||||
* @param fieldName
|
||||
* @param fieldValue
|
||||
* @return
|
||||
*/
|
||||
public static WorkflowRequestTableField createWorkflowRequestTableField(String fieldName, String fieldValue) {
|
||||
WorkflowRequestTableField tableField = new WorkflowRequestTableField();
|
||||
tableField.setFieldName(fieldName);
|
||||
tableField.setFieldValue(fieldValue);
|
||||
tableField.setView(true);
|
||||
tableField.setEdit(true);
|
||||
return tableField;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,254 @@
|
|||
package weaver.interfaces.hzzx.action;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.engine.hzzx.conn.DataUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/27
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class TrainingManageEndAction implements Action {
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
try {
|
||||
String trainingEffectFlowId = TrainingManageCreateFlowAction.FLOW_ID;
|
||||
String trainingEffectTableName = DataUtil.getTableNameById(trainingEffectFlowId);
|
||||
String requestId = requestInfo.getRequestid();
|
||||
int creatorId = requestInfo.getRequestManager().getCreater();
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
Map<String, String> mainDataMap = new HashMap<>();
|
||||
for (Property property : properties) {
|
||||
mainDataMap.put(property.getName(), property.getValue());
|
||||
}
|
||||
List<Map<String, String>> detailDataList = new ArrayList<>();
|
||||
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
|
||||
DetailTable detailTable = detailTableInfo.getDetailTable(0);
|
||||
Row[] rows = detailTable.getRow();
|
||||
for (Row row : rows) {
|
||||
Map<String, String> detailDataMap = new HashMap<>();
|
||||
Cell[] cells = row.getCell();
|
||||
for (Cell cell : cells) {
|
||||
detailDataMap.put(cell.getName(), cell.getValue());
|
||||
}
|
||||
detailDataList.add(detailDataMap);
|
||||
}
|
||||
|
||||
List<String> userIdList = new ArrayList<>();
|
||||
DetailTable detailTable2 = detailTableInfo.getDetailTable(1);
|
||||
Row[] rows2 = detailTable2.getRow();
|
||||
for (Row row : rows2) {
|
||||
Map<String, String> detailDataMap = new HashMap<>();
|
||||
Cell[] cells = row.getCell();
|
||||
for (Cell cell : cells) {
|
||||
detailDataMap.put(cell.getName(), cell.getValue());
|
||||
}
|
||||
String sftg = detailDataMap.get("sftg");
|
||||
String cjry = detailDataMap.get("cjry");
|
||||
rs.writeLog("sftg===" + sftg);
|
||||
rs.writeLog("cjry===" + cjry);
|
||||
if ("0".equals(sftg) && StringUtils.isNotBlank(cjry)) {
|
||||
userIdList.add(cjry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
String pxfhgdyq = mainDataMap.get("pxfhgdyq");
|
||||
String pxxgpgfs = mainDataMap.get("pxxgpgfs");
|
||||
String pxmc = mainDataMap.get("pxmc");
|
||||
rs.writeLog("pxfhgdyq==" + pxfhgdyq + ",pxxgpgfs==" + pxxgpgfs);
|
||||
|
||||
// 培训效果评估 流程归档,修改培训计划台账 该培训名称所关联的主题 是否组织完成为是
|
||||
String sql = "update uf_bmjhbzsq set sfzzwc = 0 where id in =(select xzk from uf_pxsssq where id = ?)";
|
||||
rs.executeUpdate(sql,pxmc);
|
||||
if (!"0".equals(pxfhgdyq) || StringUtils.isBlank(pxxgpgfs)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
//查询培训基本信息
|
||||
Map<String, String> trainInfoMap = new HashMap<>();
|
||||
rs.executeQuery("select * from uf_pxsssq where id = ? ", pxmc);
|
||||
if (rs.next()) {
|
||||
trainInfoMap.put("pxmc", rs.getString("pxmc"));
|
||||
trainInfoMap.put("xzk", rs.getString("xzk"));
|
||||
trainInfoMap.put("pxsj", rs.getString("pxsj"));
|
||||
trainInfoMap.put("jssjyc", rs.getString("jssjyc"));
|
||||
trainInfoMap.put("pxdd", rs.getString("pxdd"));
|
||||
trainInfoMap.put("szbm", rs.getString("szbm"));
|
||||
trainInfoMap.put("pxdx", rs.getString("pxdx"));
|
||||
trainInfoMap.put("pxrs", rs.getString("pxrs"));
|
||||
trainInfoMap.put("xs", rs.getString("xs"));
|
||||
trainInfoMap.put("jf", rs.getString("jf"));
|
||||
}
|
||||
|
||||
switch (pxxgpgfs) {
|
||||
case "0":
|
||||
// 培训效果评估表
|
||||
assessment(String.valueOf(creatorId), requestId, trainingEffectTableName, mainDataMap, trainInfoMap);
|
||||
break;
|
||||
case "1":
|
||||
case "2":
|
||||
case "3":
|
||||
//考试、考核
|
||||
exam(userIdList, String.valueOf(creatorId), mainDataMap, trainInfoMap, pxxgpgfs);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Map<String, String> trainerMap = new HashMap<>();
|
||||
trainerMap.put("pxmc", pxmc);
|
||||
trainerMap.put("pxqssj", mainDataMap.get("sjpxjhkssj"));
|
||||
trainerMap.put("pxjssj", mainDataMap.get("sjpxjhjssj"));
|
||||
trainerMap.put("pxzt", trainInfoMap.get("xzk"));
|
||||
trainerMap.put("pxzzdw", mainDataMap.get("pxzzbm"));
|
||||
|
||||
// 写入培训授课信息
|
||||
for (Map<String, String> detailData : detailDataList) {
|
||||
String pxsnb = detailData.get("pxsnb");
|
||||
rs.writeLog("pxsnb==" + pxsnb);
|
||||
if (StringUtils.isNotBlank(pxsnb)) {
|
||||
insertTrainer(pxsnb, String.valueOf(creatorId), pxmc, new HashMap<>(trainerMap));
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
} catch (Exception e) {
|
||||
rs.writeLog(e);
|
||||
requestInfo.getRequestManager().setMessagecontent(e.getMessage());
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 培训效果评估表
|
||||
*
|
||||
* @param mainDataMap
|
||||
*/
|
||||
private void assessment(String creatorId, String requestId, String trainingEffectTableName, Map<String, String> mainDataMap, Map<String, String> trainInfoMap) throws Exception {
|
||||
// 查询流程归档的人
|
||||
rs.executeQuery("select a.xm from " + trainingEffectTableName + " a inner join workflow_requestbase b on a.requestid =b.requestid and b.currentnodetype =3 where a.lc= ? ", requestId);
|
||||
List<String> userIdList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
userIdList.add(rs.getString("xm"));
|
||||
}
|
||||
rs.writeLog("userIdList==" + JSON.toJSONString(userIdList));
|
||||
String insertTableName = "uf_pxxx";
|
||||
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
Map<String, String> trainEmployeesMap = new HashMap<>();
|
||||
trainEmployeesMap.put("pxmc", mainDataMap.get("pxmc"));
|
||||
trainEmployeesMap.put("pxqssj", mainDataMap.get("sjpxjhkssj"));
|
||||
trainEmployeesMap.put("pxjssj", mainDataMap.get("sjpxjhjssj"));
|
||||
trainEmployeesMap.put("pxzt", trainInfoMap.get("xzk"));
|
||||
trainEmployeesMap.put("pxxs", trainInfoMap.get("xs"));
|
||||
trainEmployeesMap.put("pxjf", trainInfoMap.get("jf"));
|
||||
trainEmployeesMap.put("pxzzdw", mainDataMap.get("pxzzbm"));
|
||||
|
||||
int formModeId = DataUtil.getModeIdByTableName(insertTableName);
|
||||
trainEmployeesMap.put("formmodeid", String.valueOf(formModeId));
|
||||
DataUtil.buildModeInsertFields(trainEmployeesMap, creatorId);
|
||||
for (String userId : userIdList) {
|
||||
Map<String, String> insertMap = new HashMap<>(trainEmployeesMap);
|
||||
insertMap.put("xm", userId);
|
||||
insertMap.put("gh", resourceComInfo.getWorkcode(userId));
|
||||
|
||||
// 插入数据
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
insertMap.put("modeuuid", uuid);
|
||||
rs.writeLog("insertMap==" + JSON.toJSONString(insertMap));
|
||||
DataUtil.insertData(insertMap, insertTableName);
|
||||
DataUtil.refreshRight(uuid, insertTableName, formModeId, creatorId);
|
||||
|
||||
// 更新个人签到台账
|
||||
rs.executeUpdate("update uf_grqdtz set pxxgpgbsftj = 0 where xm = ? and pxmc = ? ", userId, mainDataMap.get("pxmc"));
|
||||
}
|
||||
}
|
||||
|
||||
private void exam(List<String> userIdList, String creatorId, Map<String, String> mainDataMap, Map<String, String> trainInfoMap, String type) throws Exception {
|
||||
rs.writeLog("userIdList==" + JSON.toJSONString(userIdList));
|
||||
String sql = "update uf_grqdtz set kssftg = 0 where xm = ? and pxmc = ? ";
|
||||
if ("2".equals(type)) {
|
||||
sql = "update uf_grqdtz set khsftg = 0 where xm = ? and pxmc = ? ";
|
||||
|
||||
} else if ("3".equals(type)) {
|
||||
sql = "update uf_grqdtz set qt = 0 where xm = ? and pxmc = ? ";
|
||||
}
|
||||
String insertTableName = "uf_pxxx";
|
||||
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
Map<String, String> trainEmployeesMap = new HashMap<>();
|
||||
trainEmployeesMap.put("pxmc", mainDataMap.get("pxmc"));
|
||||
trainEmployeesMap.put("pxqssj", mainDataMap.get("sjpxjhkssj"));
|
||||
trainEmployeesMap.put("pxjssj", mainDataMap.get("sjpxjhjssj"));
|
||||
trainEmployeesMap.put("pxzt", trainInfoMap.get("xzk"));
|
||||
trainEmployeesMap.put("pxxs", trainInfoMap.get("xs"));
|
||||
trainEmployeesMap.put("pxjf", trainInfoMap.get("jf"));
|
||||
trainEmployeesMap.put("pxzzdw", mainDataMap.get("pxzzbm"));
|
||||
|
||||
int formModeId = DataUtil.getModeIdByTableName(insertTableName);
|
||||
trainEmployeesMap.put("formmodeid", String.valueOf(formModeId));
|
||||
DataUtil.buildModeInsertFields(trainEmployeesMap, creatorId);
|
||||
for (String userId : userIdList) {
|
||||
Map<String, String> insertMap = new HashMap<>(trainEmployeesMap);
|
||||
insertMap.put("xm", userId);
|
||||
insertMap.put("gh", resourceComInfo.getWorkcode(userId));
|
||||
|
||||
// 插入数据
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
insertMap.put("modeuuid", uuid);
|
||||
rs.writeLog("insertMap==" + JSON.toJSONString(insertMap));
|
||||
DataUtil.insertData(insertMap, insertTableName);
|
||||
DataUtil.refreshRight(uuid, insertTableName, formModeId, creatorId);
|
||||
|
||||
// 更新个人签到台账
|
||||
rs.executeUpdate(sql, userId, mainDataMap.get("pxmc"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入培训授课信息
|
||||
*
|
||||
* @param trainer
|
||||
* @param creatorId
|
||||
* @param pxmc
|
||||
* @param trainerMap
|
||||
* @throws Exception
|
||||
*/
|
||||
private void insertTrainer(String trainer, String creatorId, String pxmc, Map<String, String> trainerMap) throws Exception {
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
String workCode = resourceComInfo.getWorkcode(trainer);
|
||||
trainerMap.put("gh", workCode);
|
||||
trainerMap.put("xm", trainer);
|
||||
// 查询导师数据
|
||||
rs.executeQuery("select * from uf_pxsssq_dt1 where sklsnb = ? and mainid = ?", trainer, pxmc);
|
||||
if (rs.next()) {
|
||||
String jf = rs.getString("jf");
|
||||
String xs = rs.getString("xs");
|
||||
trainerMap.put("pxskxs", xs);
|
||||
trainerMap.put("pxskjf", jf);
|
||||
}
|
||||
|
||||
String insertTableName = "uf_pxskxx";
|
||||
int formModeId = DataUtil.getModeIdByTableName(insertTableName);
|
||||
trainerMap.put("formmodeid", String.valueOf(formModeId));
|
||||
DataUtil.buildModeInsertFields(trainerMap, creatorId);
|
||||
// 插入数据
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
trainerMap.put("modeuuid", uuid);
|
||||
rs.writeLog("trainerMap==" + JSON.toJSONString(trainerMap));
|
||||
DataUtil.insertData(trainerMap, insertTableName);
|
||||
DataUtil.refreshRight(uuid, insertTableName, formModeId, creatorId);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package weaver.interfaces.hzzx.cronjob;
|
||||
|
||||
import com.engine.hzzx.conn.DataUtil;
|
||||
import com.engine.hzzx.entity.RecruitingPlan;
|
||||
import com.engine.hzzx.exception.CustomizeRunTimeException;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/20
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class RecordUserCountJob extends BaseCronJob {
|
||||
private static final String MAIN_TABLE = "uf_nmgbmzgrs";
|
||||
private static final String OPERATE_ID = "1";
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
String sql = "select id from hrmdepartment where ISNULL(SUPDEPID,0)=0 and ISNULL(CANCELED,0)=0 ";
|
||||
rs.executeQuery(sql);
|
||||
List<RecruitingPlan> recruitingPlanList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
fillDepartmentInfo(rs.getInt("id"), recruitingPlanList);
|
||||
}
|
||||
|
||||
// 遍历recruitingPlanList,插入明细表数据
|
||||
for (RecruitingPlan plan : recruitingPlanList) {
|
||||
insertMainData(plan, DateUtil.getYear());
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new CustomizeRunTimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 遍历部门,查询部门下在岗人数
|
||||
*
|
||||
* @param departmentId
|
||||
* @param recruitingPlanList
|
||||
* @return
|
||||
*/
|
||||
private int fillDepartmentInfo(Integer departmentId, List<RecruitingPlan> recruitingPlanList) {
|
||||
if (departmentId == null || departmentId < 0) {
|
||||
return 0;
|
||||
}
|
||||
// 查询当前部门下的在岗人数
|
||||
int userCount = countUsersByDeptId(departmentId);
|
||||
|
||||
List<Integer> childDepartmentIdList = getChildDepartmentId(departmentId);
|
||||
if (CollectionUtils.isNotEmpty(childDepartmentIdList)) {
|
||||
for (Integer childDepartmentId : childDepartmentIdList) {
|
||||
userCount += fillDepartmentInfo(childDepartmentId, recruitingPlanList);
|
||||
}
|
||||
}
|
||||
recruitingPlanList.add(new RecruitingPlan(departmentId, userCount));
|
||||
return userCount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 插入主表数据
|
||||
*
|
||||
* @param plan
|
||||
* @return
|
||||
*/
|
||||
private String insertMainData(RecruitingPlan plan,String year) {
|
||||
rs.executeQuery("select id from " + MAIN_TABLE + " where nd = ? and bm = ? ",year , plan.getDepartmentId());
|
||||
if(rs.next()){
|
||||
Map<String, String> updateData = new HashMap<>();
|
||||
DataUtil.buildModeUpdateFields(updateData, OPERATE_ID);
|
||||
updateData.put("id", rs.getString("id"));
|
||||
updateData.put("nmzgrs",plan.getOnJobNumber() + "");
|
||||
}
|
||||
|
||||
// 插入基本数据
|
||||
Map<String, String> insertData = new HashMap<>();
|
||||
DataUtil.buildModeInsertFields(insertData, OPERATE_ID);
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
insertData.put("modeuuid", uuid);
|
||||
int formModeId = DataUtil.getModeIdByTableName(MAIN_TABLE);
|
||||
insertData.put("formmodeid", String.valueOf(formModeId));
|
||||
insertData.put("nd", year);
|
||||
insertData.put("bm", plan.getDepartmentId() + "");
|
||||
insertData.put("nmzgrs", plan.getOnJobNumber() + "");
|
||||
|
||||
DataUtil.insertData(insertData, MAIN_TABLE);
|
||||
int id = DataUtil.refreshRight(uuid, MAIN_TABLE, formModeId, OPERATE_ID);
|
||||
if (id > 0) {
|
||||
return String.valueOf(id);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询子部门
|
||||
*
|
||||
* @param departmentId
|
||||
* @return
|
||||
*/
|
||||
private List<Integer> getChildDepartmentId(Integer departmentId) {
|
||||
List<Integer> departmentIdList = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from HrmDepartment where supdepid = ?", departmentId);
|
||||
while (rs.next()) {
|
||||
departmentIdList.add(rs.getInt("id"));
|
||||
}
|
||||
return departmentIdList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询部门下在岗人数
|
||||
*
|
||||
* @param departmentId
|
||||
* @return
|
||||
*/
|
||||
private int countUsersByDeptId(Integer departmentId) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select count(id) from hrmresource where departmentid = ?", departmentId);
|
||||
if (rs.next()) {
|
||||
return rs.getInt(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int countPlanedNum(Integer departmentId) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select count(id) from uf_zpxqhztzaz where zpbm = ? and sqrq like '%" + DateUtil.getYear() + "%' ", departmentId);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -31,8 +31,8 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
private static final String APP_KEY = "EE7D602509E04A59AE5DEFF0841F6A1C";
|
||||
private static final String APP_SECRET = "F5229D9D83BF45DEBFA1EF8DAC13C0339D0074419CFE45FA8BAC2A0B9D170798";
|
||||
|
||||
private static final String EMPLOYEE_TABLE = "uf_sxszqbssjtz";
|
||||
private static final String INTERNSHIP_TABLE = "uf_ybygzqbssjtz";
|
||||
private static final String EMPLOYEE_TABLE = "uf_ybygzqbssjtz";
|
||||
private static final String INTERNSHIP_TABLE = "uf_sxszqbssjtz";
|
||||
|
||||
private static final String OPERATE_ID = "1";
|
||||
|
||||
|
|
@ -41,31 +41,38 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
String accessToken = getToken();
|
||||
// 获取近两天的数据
|
||||
String startTime = DateUtil.getYesterday() + "T00:00:00";
|
||||
String stopTime = DateUtil.getCurrentDate() + "T23:59:59";
|
||||
int[] empStatus = {1};
|
||||
int[] employType = {0};
|
||||
int[] internshipType = {2};
|
||||
List<Employee> employeeList = new ArrayList<>();
|
||||
getPendingEmployment(startTime, stopTime, empStatus, employType, accessToken, "", employeeList);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(employeeList)) {
|
||||
// 遍历待入职信息,插入数据库
|
||||
for (Employee employee : employeeList) {
|
||||
rs.writeLog("遍历待入职信息", employee.toString());
|
||||
try {
|
||||
String accessToken = getToken();
|
||||
// 获取近两天的数据
|
||||
String startTime = DateUtil.getYesterday() + "T00:00:00";
|
||||
String stopTime = DateUtil.getCurrentDate() + "T23:59:59";
|
||||
// TODO 测试使用
|
||||
startTime = "2025-03-01T00:00:00";
|
||||
int[] empStatus = {1};
|
||||
int[] employType = {0};
|
||||
int[] internshipType = {2};
|
||||
List<Employee> employeeList = new ArrayList<>();
|
||||
getPendingEmployment(startTime, stopTime, empStatus, employType, accessToken, "", employeeList);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(employeeList)) {
|
||||
// 遍历待入职信息,插入数据库
|
||||
for (Employee employee : employeeList) {
|
||||
rs.writeLog("遍历待入职信息===" + employee.toString());
|
||||
insertEmployee(employee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Employee> internshipList = new ArrayList<>();
|
||||
getPendingEmployment(startTime, stopTime, empStatus, internshipType, accessToken, "", internshipList);
|
||||
if (CollectionUtils.isNotEmpty(internshipList)) {
|
||||
// 遍历实习生信息,插入数据库
|
||||
for (Employee employee : internshipList) {
|
||||
rs.writeLog("遍历实习生信息", employee.toString());
|
||||
List<Employee> internshipList = new ArrayList<>();
|
||||
getPendingEmployment(startTime, stopTime, empStatus, internshipType, accessToken, "", internshipList);
|
||||
if (CollectionUtils.isNotEmpty(internshipList)) {
|
||||
// 遍历实习生信息,插入数据库
|
||||
for (Employee employee : internshipList) {
|
||||
rs.writeLog("遍历实习生信息===" + employee.toString());
|
||||
insertInternshipEmployee(employee);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
rs.writeLog("同步失败", e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -91,14 +98,14 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
if (StringUtils.isNotBlank(scrollId)) {
|
||||
json.put("scrollId", scrollId);
|
||||
}
|
||||
rs.writeLog("GetByTimeWindow,入参", json.toString());
|
||||
rs.writeLog("GetByTimeWindow,入参===" + json.toString());
|
||||
String response = HttpRequest.post(GET_EMPLOYMENT_URL)
|
||||
.header("Authorization", "Bearer " + accessToken)
|
||||
.body(json.toString())
|
||||
.contentType("application/json")
|
||||
.execute()
|
||||
.body();
|
||||
rs.writeLog("GetByTimeWindow,返参", response);
|
||||
rs.writeLog("GetByTimeWindow,返参===" + response);
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
|
||||
String code = jsonObject.getString("code");
|
||||
|
|
@ -107,7 +114,8 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
}
|
||||
scrollId = jsonObject.getString("scrollId");
|
||||
JSONArray data = jsonObject.getJSONArray("data");
|
||||
if (data.size() == 0) {
|
||||
if (data == null || data.size() == 0) {
|
||||
rs.writeLog("GetByTimeWindow,无数据");
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -115,7 +123,7 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
JSONObject dataObject = data.getJSONObject(i);
|
||||
JSONObject employeeInfo = dataObject.getJSONObject("employeeInfo");
|
||||
JSONObject recordInfo = dataObject.getJSONObject("recordInfo");
|
||||
String oIdDepartment = recordInfo.getString("oIdDepartment");
|
||||
Long oIdDepartment = recordInfo.getLong("oIdDepartment");
|
||||
String oIdJobPosition = recordInfo.getString("oIdJobPosition");
|
||||
Department department = getDepartment(oIdDepartment, accessToken);
|
||||
Position position = getPosition(oIdJobPosition, accessToken);
|
||||
|
|
@ -128,6 +136,7 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
if (null != position) {
|
||||
// 设置岗位编号
|
||||
employeeObject.setPositionCode(position.getCode());
|
||||
employeeObject.setPositionName(position.getName());
|
||||
}
|
||||
employeeList.add(employeeObject);
|
||||
}
|
||||
|
|
@ -144,13 +153,13 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
json.put("grant_type", "client_credentials");
|
||||
json.put("app_key", APP_KEY);
|
||||
json.put("app_secret", APP_SECRET);
|
||||
rs.writeLog("获取token,入参", json.toString());
|
||||
rs.writeLog("获取token,入参===" + json);
|
||||
String response = HttpRequest.post(TOKEN_URL)
|
||||
.body(json.toString())
|
||||
.contentType("application/json")
|
||||
.execute()
|
||||
.body();
|
||||
rs.writeLog("获取token,返参", response);
|
||||
rs.writeLog("获取token,返参===" + response);
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
|
||||
String accessToken = jsonObject.getString("access_token");
|
||||
|
|
@ -168,17 +177,17 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
* @param accessToken
|
||||
* @return
|
||||
*/
|
||||
private Department getDepartment(String oId, String accessToken) {
|
||||
private Department getDepartment(Long oId, String accessToken) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("oIds", new String[]{oId});
|
||||
rs.writeLog("GET_DEPARTMENT_URL,入参", json.toString());
|
||||
json.put("oIds", new Long[]{oId});
|
||||
rs.writeLog("GET_DEPARTMENT_URL,入参===" + json);
|
||||
String response = HttpRequest.post(GET_DEPARTMENT_URL)
|
||||
.header("Authorization", "Bearer " + accessToken)
|
||||
.body(json.toString())
|
||||
.contentType("application/json")
|
||||
.execute()
|
||||
.body();
|
||||
rs.writeLog("GET_DEPARTMENT_URL,返参", response);
|
||||
rs.writeLog("GET_DEPARTMENT_URL,返参===" + response);
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
|
||||
String code = jsonObject.getString("code");
|
||||
|
|
@ -208,14 +217,14 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
private Position getPosition(String oId, String accessToken) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("oIds", new String[]{oId});
|
||||
rs.writeLog("GET_POSITION_URL,入参", json.toString());
|
||||
rs.writeLog("GET_POSITION_URL,入参===" + json);
|
||||
String response = HttpRequest.post(GET_POSITION_URL)
|
||||
.header("Authorization", "Bearer " + accessToken)
|
||||
.body(json.toString())
|
||||
.contentType("application/json")
|
||||
.execute()
|
||||
.body();
|
||||
rs.writeLog("GET_POSITION_URL,返参", response);
|
||||
rs.writeLog("GET_POSITION_URL,返参===" + response);
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
|
||||
String code = jsonObject.getString("code");
|
||||
|
|
@ -257,14 +266,22 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
} else {
|
||||
objectId = UUID.randomUUID().toString();
|
||||
}
|
||||
int formModeId = DataUtil.getModeIdByTableName(EMPLOYEE_TABLE);
|
||||
int formId = DataUtil.getFormIdByTableName(EMPLOYEE_TABLE);
|
||||
|
||||
// 构建插入数据
|
||||
insertData.put("xm", employee.getName());
|
||||
insertData.put("xb", Util.null2String(employee.getGender()));
|
||||
insertData.put("nl", String.valueOf(employee.getAge()));
|
||||
// 政治面貌
|
||||
rs.writeLog("政治面貌Status==" + employee.getPoliticalStatus());
|
||||
String politicalStr = EmployeeTrans.getPoliticalStr(employee.getPoliticalStatus());
|
||||
rs.writeLog("政治面貌Str==" + politicalStr);
|
||||
if (StringUtils.isNotBlank(politicalStr)) {
|
||||
insertData.put("zzmm", DataUtil.getSelectValue(EMPLOYEE_TABLE, "zzmm", politicalStr));
|
||||
rs.writeLog("formId==" + formId);
|
||||
String zzmm = DataUtil.getSelectValue(String.valueOf(formId), "zzmm", politicalStr);
|
||||
rs.writeLog("政治面貌Id==" + zzmm);
|
||||
insertData.put("zzmm", zzmm);
|
||||
}
|
||||
// 部门
|
||||
String departmentId = EmployeeTrans.getDepartmentId(employee.getDepartmentCode());
|
||||
|
|
@ -272,7 +289,7 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
insertData.put("ypbm", departmentId);
|
||||
}
|
||||
// 职位
|
||||
String jobtitleId = EmployeeTrans.getJobtitleId(employee.getPositionCode());
|
||||
String jobtitleId = EmployeeTrans.getJobIdByName(employee.getPositionName());
|
||||
if (StringUtils.isNotBlank(jobtitleId)) {
|
||||
insertData.put("ypgw", jobtitleId);
|
||||
}
|
||||
|
|
@ -282,7 +299,7 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
insertData.put("xl", educationLevelId);
|
||||
}
|
||||
// 学校
|
||||
// TODO insertData.put("xx", employee.getLastSchool());
|
||||
insertData.put("xx", employee.getLastSchool());
|
||||
// 专业
|
||||
insertData.put("zy", employee.getMajor());
|
||||
// 工作年限
|
||||
|
|
@ -290,7 +307,6 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
|
||||
// 构建建模基本数据
|
||||
insertData.put("modeuuid", objectId);
|
||||
int formModeId = DataUtil.getModeIdByTableName(EMPLOYEE_TABLE);
|
||||
insertData.put("formmodeid", String.valueOf(formModeId));
|
||||
DataUtil.buildModeInsertFields(insertData, OPERATE_ID);
|
||||
|
||||
|
|
@ -314,40 +330,41 @@ public class SyncBeiSenInfoJob extends BaseCronJob {
|
|||
} else {
|
||||
objectId = UUID.randomUUID().toString();
|
||||
}
|
||||
int formModeId = DataUtil.getModeIdByTableName(INTERNSHIP_TABLE);
|
||||
|
||||
// 构建插入数据
|
||||
insertData.put("xm", employee.getName());
|
||||
insertData.put("xb", Util.null2String(employee.getGender()));
|
||||
insertData.put("nl", String.valueOf(employee.getAge()));
|
||||
// insertData.put("nl", String.valueOf(employee.getAge()));
|
||||
// 政治面貌
|
||||
String politicalStr = EmployeeTrans.getPoliticalStr(employee.getPoliticalStatus());
|
||||
if (StringUtils.isNotBlank(politicalStr)) {
|
||||
insertData.put("zzmm", DataUtil.getSelectValue(INTERNSHIP_TABLE, "zzmm", politicalStr));
|
||||
}
|
||||
// 部门
|
||||
String departmentId = EmployeeTrans.getDepartmentId(employee.getDepartmentCode());
|
||||
if (StringUtils.isNotBlank(departmentId)) {
|
||||
insertData.put("ypbm", departmentId);
|
||||
}
|
||||
// 职位
|
||||
String jobtitleId = EmployeeTrans.getJobtitleId(employee.getPositionCode());
|
||||
//String politicalStr = EmployeeTrans.getPoliticalStr(employee.getPoliticalStatus());
|
||||
//if (StringUtils.isNotBlank(politicalStr)) {
|
||||
// insertData.put("zzmm", DataUtil.getSelectValue(formModeId, "zzmm", politicalStr));
|
||||
//}
|
||||
//// 部门
|
||||
//String departmentId = EmployeeTrans.getDepartmentId(employee.getDepartmentCode());
|
||||
//if (StringUtils.isNotBlank(departmentId)) {
|
||||
// insertData.put("ypbm", departmentId);
|
||||
//}
|
||||
// 岗位
|
||||
String jobtitleId = EmployeeTrans.getJobIdByName(employee.getPositionName());
|
||||
if (StringUtils.isNotBlank(jobtitleId)) {
|
||||
insertData.put("ypgw", jobtitleId);
|
||||
insertData.put("gw", jobtitleId);
|
||||
}
|
||||
// 学历
|
||||
// 目前学历
|
||||
String educationLevelId = EmployeeTrans.getEducationLevelId(employee.getEducationLevel());
|
||||
if (StringUtils.isNotBlank(educationLevelId)) {
|
||||
insertData.put("xl", educationLevelId);
|
||||
insertData.put("mqxl", educationLevelId);
|
||||
}
|
||||
// 学校
|
||||
// TODO insertData.put("xx", employee.getLastSchool());
|
||||
// 专业
|
||||
insertData.put("zy", employee.getMajor());
|
||||
// 就读学校
|
||||
insertData.put("jdxx", employee.getLastSchool());
|
||||
// 就读专业
|
||||
insertData.put("jdzy", employee.getMajor());
|
||||
// 工作年限
|
||||
|
||||
|
||||
// 构建建模基本数据
|
||||
insertData.put("modeuuid", objectId);
|
||||
int formModeId = DataUtil.getModeIdByTableName(INTERNSHIP_TABLE);
|
||||
insertData.put("formmodeid", String.valueOf(formModeId));
|
||||
DataUtil.buildModeInsertFields(insertData, OPERATE_ID);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue