generated from dxfeng/secondev-chapanda-feishu
部门筛选-新增操作;部门筛选反馈-删除操作
This commit is contained in:
parent
4c14329a77
commit
09e56843aa
|
|
@ -0,0 +1,138 @@
|
|||
package weaver.formmode.recruit.departmentscreening;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.soa.workflow.request.MainTableInfo;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>聚才林招聘</p>
|
||||
* 发起部门筛选,转部门筛选反馈数据
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/09/18
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class AddDeptScreeningModeExpand extends AbstractModeExpandJavaCodeNew {
|
||||
/**
|
||||
* JCL_部门筛选反馈(uf_jcl_bmsxfk)
|
||||
*/
|
||||
private static final String MODE_TABLE_NAME = "uf_jcl_bmsxfk";
|
||||
|
||||
@Override
|
||||
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
try {
|
||||
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||
if (requestInfo != null) {
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
for (Property property : properties) {
|
||||
dataMap.put(property.getName(), property.getValue());
|
||||
}
|
||||
|
||||
int formModeId = -1;
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from modeinfo where formid =( select id from workflow_bill where tablename = ? )", MODE_TABLE_NAME);
|
||||
if (rs.next()) {
|
||||
formModeId = rs.getInt("id");
|
||||
}
|
||||
|
||||
// 填充数据集合信息
|
||||
dataMap.put("bmsxid", requestInfo.getRequestid());
|
||||
dataMap.put("formmodeid", formModeId);
|
||||
dataMap.put("modedatacreater", requestInfo.getCreatorid());
|
||||
String dateTime = DateUtil.getFullDate();
|
||||
String[] split = dateTime.split(" ");
|
||||
dataMap.put("modedatacreatedate", split[0]);
|
||||
dataMap.put("modedatacreatetime", split[1]);
|
||||
dataMap.put("modedatamodifier", requestInfo.getCreatorid());
|
||||
dataMap.put("modedatamodifydatetime", dateTime);
|
||||
dataMap.put("modedatacreatertype", "0");
|
||||
|
||||
List<List<Object>> paramList = new ArrayList<>();
|
||||
buildParamList(dataMap, paramList);
|
||||
if (CollectionUtils.isNotEmpty(paramList)) {
|
||||
String insertSql = "insert into " + MODE_TABLE_NAME + " (modeuuid, modedatacreatertype, formmodeid, modedatacreater, modedatacreatedate, modedatacreatetime, modedatamodifier, modedatamodifydatetime, bmsxid, ypz, ypzw, tdsj, fkr) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
for (List<Object> objects : paramList) {
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
objects.add(0, uuid);
|
||||
rs.executeUpdate(insertSql, objects);
|
||||
refreshRight(rs, uuid, formModeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
new BaseBean().writeLog(e);
|
||||
result.put("errmsg", "自定义出错信息");
|
||||
result.put("flag", "false");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建批量插入数据集合
|
||||
*
|
||||
* @param map 表单参数
|
||||
* @param paramList 待插入数据集合
|
||||
*/
|
||||
private void buildParamList(Map<String, Object> map, List<List<Object>> paramList) {
|
||||
List<Object> param = new ArrayList<>();
|
||||
// 填充建模表相关字段
|
||||
param.add(map.get("modedatacreatertype"));
|
||||
param.add(map.get("formmodeid"));
|
||||
param.add(map.get("modedatacreater"));
|
||||
param.add(map.get("modedatacreatedate"));
|
||||
param.add(map.get("modedatacreatetime"));
|
||||
param.add(map.get("modedatamodifier"));
|
||||
param.add(map.get("modedatamodifydatetime"));
|
||||
|
||||
//部门筛选ID
|
||||
param.add(map.get("bmsxid"));
|
||||
// 应聘者
|
||||
param.add(map.get("ypz"));
|
||||
// 应聘职位
|
||||
param.add(map.get("ypzw"));
|
||||
// 投递时间
|
||||
param.add(map.get("tdsj"));
|
||||
// 反馈人
|
||||
String fkr = Util.null2String(map.get("fkr"));
|
||||
if (StringUtils.isNotBlank(fkr)) {
|
||||
String[] fkrArray = fkr.split(",");
|
||||
for (String fkrId : fkrArray) {
|
||||
ArrayList<Object> objects = new ArrayList<>(param);
|
||||
objects.add(fkrId);
|
||||
paramList.add(objects);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限重构
|
||||
*
|
||||
* @param rs RecordSet
|
||||
* @param uuid UUID
|
||||
* @param formModeId 建模ID
|
||||
*/
|
||||
private void refreshRight(RecordSet rs, String uuid, int formModeId) {
|
||||
rs.executeQuery("select id from " + MODE_TABLE_NAME + " where modeuuid='" + uuid + "'");
|
||||
if (rs.next()) {
|
||||
//建模数据的id
|
||||
int bid = Util.getIntValue(rs.getString("id"));
|
||||
ModeRightInfo modeRightInfo = new ModeRightInfo();
|
||||
modeRightInfo.setNewRight(true);
|
||||
//新建的时候添加共享
|
||||
modeRightInfo.editModeDataShare(1, formModeId, bid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package weaver.formmode.recruit.departmentscreening;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.general.Util;
|
||||
import weaver.soa.workflow.request.MainTableInfo;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>聚才林招聘</p>
|
||||
* 部门筛选反馈数据删除,更新/删除部门筛选数据
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/09/18
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class DeleteDeptScreeningFeedbackExpand extends AbstractModeExpandJavaCodeNew {
|
||||
/**
|
||||
* JCL_部门筛选(uf_jcl_bmsx)
|
||||
*/
|
||||
private static final String MODE_TABLE_NAME = "uf_jcl_bmsx";
|
||||
|
||||
@Override
|
||||
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
try {
|
||||
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||
if (requestInfo != null) {
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
for (Property property : properties) {
|
||||
dataMap.put(property.getName(), property.getValue());
|
||||
}
|
||||
String bmsxid = Util.null2String(dataMap.get("bmsxid"));
|
||||
String fkr = Util.null2String(dataMap.get("fkr"));
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select fkr from " + MODE_TABLE_NAME + " where id = ?", bmsxid);
|
||||
if (rs.next()) {
|
||||
String fkrStr = rs.getString("fkr");
|
||||
List<String> strings = new ArrayList<>(Arrays.asList(fkrStr.split(",")));
|
||||
strings.remove(fkr);
|
||||
if (CollectionUtils.isEmpty(strings)) {
|
||||
// 直接删除部门筛选数据
|
||||
rs.executeUpdate("delete from " + MODE_TABLE_NAME + " where id = ?", bmsxid);
|
||||
} else {
|
||||
// 更新部门筛选数据的反馈人信息
|
||||
rs.executeUpdate("update " + MODE_TABLE_NAME + " set fkr = ? where id = ?", StringUtils.join(strings, ","), bmsxid);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("errmsg", "自定义出错信息");
|
||||
result.put("flag", "false");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue