建模数据权限重构BUG修复

This commit is contained in:
dxfeng 2023-11-03 14:47:34 +08:00
parent 3735a73ad4
commit 8a20ce77f9
9 changed files with 22 additions and 65 deletions

View File

@ -4,9 +4,7 @@ import com.engine.recruit.entity.record.ApplicantRecordPo;
import com.engine.recruit.entity.recruitflow.po.RecruitStepPo;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.List;
@ -123,28 +121,6 @@ public class ApplicantCommonInfo {
}
/**
* 建模表数据权限重构
*
* @param rs
* @param uuid
* @param modeTable
* @param formModeId
*/
public static int refreshRight(RecordSet rs, String uuid, String modeTable, int formModeId) {
rs.executeQuery("select id from " + modeTable + " 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);
return bid;
}
return -1;
}
/**
* 创建操作记录数据
*

View File

@ -273,7 +273,7 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
ModeRightInfo modeRightInfo = new ModeRightInfo();
modeRightInfo.setNewRight(true);
//新建的时候添加共享
modeRightInfo.editModeDataShare(1, formModeId, targetId);
modeRightInfo.editModeDataShare(user.getUID(), formModeId, targetId);
// 复制明细表数据
rs.executeUpdate("insert into uf_jcl_yppc_dt1 (mainid,xxmc,xl,zy,kssj,jssj) select ?,xxmc,xl,zy,kssj,jssj from uf_jcl_yppc_dt1 where mainid = ?", targetId, sourceId);
@ -509,7 +509,7 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
ModeRightInfo modeRightInfo = new ModeRightInfo();
modeRightInfo.setNewRight(true);
//新建的时候添加共享
modeRightInfo.editModeDataShare(1, formModeId, bid);
modeRightInfo.editModeDataShare(user.getUID(), formModeId, bid);
// 插入明细表数据
rs.executeQuery("select * from uf_jcl_yppc_dt1 where mainid = ? ", applicantId);

View File

@ -1,11 +1,11 @@
package weaver.formmode.recruit.modeexpand.departmentscreening;
import com.engine.recruit.conn.ApplicantCommonInfo;
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 com.engine.recruit.conn.ApplicantCommonInfo;
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;

View File

@ -75,7 +75,7 @@ public class SingleAddDeptScreeningModeExpand extends AbstractModeExpandJavaCode
String uuid = UUID.randomUUID().toString();
objects.add(0, uuid);
rs.executeUpdate(insertSql, objects);
refreshRight(rs, uuid, formModeId);
refreshRight(user, rs, uuid, formModeId);
}
}
// 发送待办消息
@ -147,7 +147,7 @@ public class SingleAddDeptScreeningModeExpand extends AbstractModeExpandJavaCode
* @param uuid UUID
* @param formModeId 建模ID
*/
private void refreshRight(RecordSet rs, String uuid, int formModeId) {
private void refreshRight(User user, RecordSet rs, String uuid, int formModeId) {
rs.executeQuery("select id from " + MODE_TABLE_NAME + " where modeuuid='" + uuid + "'");
if (rs.next()) {
//建模数据的id
@ -155,7 +155,7 @@ public class SingleAddDeptScreeningModeExpand extends AbstractModeExpandJavaCode
ModeRightInfo modeRightInfo = new ModeRightInfo();
modeRightInfo.setNewRight(true);
//新建的时候添加共享
modeRightInfo.editModeDataShare(1, formModeId, bid);
modeRightInfo.editModeDataShare(user.getUID(), formModeId, bid);
}
}
}

View File

@ -7,12 +7,10 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.docx4j.wml.R;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
import weaver.formmode.recruit.modeexpand.written.CreateWrittenModeExpand;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.Util;
@ -114,7 +112,7 @@ public class BatchAddInterviewResultModeExpand extends AbstractModeExpandJavaCod
int bid = Util.getIntValue(rs.getString("id"));
ModeRightInfo modeRightInfo = new ModeRightInfo();
modeRightInfo.setNewRight(true);
modeRightInfo.editModeDataShare(1, formModeId, bid);
modeRightInfo.editModeDataShare(user.getUID(), formModeId, bid);
getApplicantsInfo(msgBuilder, Util.null2String(detailDataMap.get("ypz")), Util.null2String(detailDataMap.get("ypzw")));
}
}

View File

@ -37,16 +37,16 @@ public class StageDataInsert {
// modedatacreatetime
paramsList.add(dateSplit[1]);
// modedatamodifier
paramsList.add(creator);
paramsList.add(null);
// modedatamodifydatetime
paramsList.add(dateTime);
paramsList.add(null);
// modedatacreatertype
paramsList.add("0");
String processIdsStr = StringUtils.join(Arrays.asList(processIds), ",");
String insertSql = "insert into uf_jcl_zpjdsz (modeuuid, modedatacreater, modedatacreatedate, modedatacreatetime, modedatamodifier, modedatamodifydatetime, modedatacreatertype, formmodeid, jdmc, jdms, jdlx, hj, sfqy, zssx, zpjd, " + relateField + ") values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
if (StringUtils.isNotBlank(processIdsStr)) {
insertMainTableData(billId, processIdsStr, insertSql, paramsList);
insertMainTableData(creator, billId, processIdsStr, insertSql, paramsList);
}
}
@ -58,7 +58,7 @@ public class StageDataInsert {
* @param insertSql 插入SQL语句
* @param paramsList 待插入参数集合
*/
private static void insertMainTableData(String billId, String processIdsStr, String insertSql, List<Object> paramsList) {
private static void insertMainTableData(int userId, String billId, String processIdsStr, String insertSql, List<Object> paramsList) {
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_jcl_zpjdsz where id in (" + processIdsStr + ") order by hj,zssx");
while (rs.next()) {
@ -79,7 +79,7 @@ public class StageDataInsert {
insertList.add(RecruitModeUtil.parseBlankToNull(billId));
// 插入主表数据
rs.executeUpdate(insertSql, insertList);
refreshRight(uuid, formModeId, rs.getString("id"));
refreshRight(userId, uuid, formModeId, rs.getString("id"));
}
}
@ -89,7 +89,7 @@ public class StageDataInsert {
* @param uuid UUID
* @param formModeId formModeId
*/
private static void refreshRight(String uuid, String formModeId, String processId) {
private static void refreshRight(int userId, String uuid, String formModeId, String processId) {
RecordSet rs = new RecordSet();
rs.executeQuery("select id from uf_jcl_zpjdsz where modeuuid='" + uuid + "'");
if (rs.next()) {
@ -98,7 +98,7 @@ public class StageDataInsert {
ModeRightInfo modeRightInfo = new ModeRightInfo();
modeRightInfo.setNewRight(true);
//新建的时候添加共享
modeRightInfo.editModeDataShare(1, Util.getIntValue(formModeId), Util.getIntValue(bid));
modeRightInfo.editModeDataShare(userId, Util.getIntValue(formModeId), Util.getIntValue(bid));
// 插入明细表数据
rs.executeQuery("select * from uf_jcl_zpjdsz_dt1 where mainid = ? ", processId);

View File

@ -46,7 +46,7 @@ public class UpdateScreenExpand extends AbstractModeExpandJavaCodeNew {
// 插入应聘过程
String createName = RecruitModeUtil.getResourceNames(requestInfo.getCreatorid());
//mainDataMap.put("createName",createName);
mainDataMap.put("createName", createName);
ApplicantRecordPo recordPo = ApplicantRecordPo.builder()
.billId(String.valueOf(billId))
.modeId(String.valueOf(modeId))

View File

@ -1,5 +1,6 @@
package weaver.formmode.recruit.modeexpand.written;
import com.engine.recruit.conn.RecruitRecordSet;
import com.engine.recruit.util.RecruitMessageUtils;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -10,7 +11,6 @@ import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
@ -86,7 +86,7 @@ public class BatchAddWrittenResultModeExpand extends AbstractModeExpandJavaCodeN
String uuid = UUID.randomUUID().toString();
objects.add(0, uuid);
rs.executeUpdate(insertSql, objects);
refreshRight(rs, uuid, formModeId);
RecruitRecordSet.refreshRight(uuid, MODE_TABLE_NAME, formModeId, user.getUID());
}
}
}
@ -141,30 +141,12 @@ public class BatchAddWrittenResultModeExpand extends AbstractModeExpandJavaCodeN
paramList.add(param);
}
/**
* 权限重构
*
* @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);
}
}
private void sendMessage(int billId) {
String querySql = "select b.ypz,b.ypzw,b.sjh,b.yx,a.yjtzmb ,a.bssj ,a.bsdd,a.yjnr,a.tzypz from uf_jcl_apbs a \n" +
"left join uf_jcl_apbs_dt1 b on a.id = b.mainid where a.id = ?";
recordSet.executeQuery(querySql,billId);
recordSet.executeQuery(querySql, billId);
String yjnr;
String tzypz = "";
List<WrittenPerson> writtenPersonList = new ArrayList<>();
@ -176,7 +158,7 @@ public class BatchAddWrittenResultModeExpand extends AbstractModeExpandJavaCodeN
Matcher matcher = patten.matcher(yjnr);// 指定要匹配的字符串
StringBuffer sb = new StringBuffer();
while (matcher.find()) { //此处find每次被调用后会偏移到下一个匹配
matcher.appendReplacement(sb,Util.null2String(recordSet.getString(matcher.group().replace("$",""))));
matcher.appendReplacement(sb, Util.null2String(recordSet.getString(matcher.group().replace("$", ""))));
}
matcher.appendTail(sb);
@ -192,7 +174,7 @@ public class BatchAddWrittenResultModeExpand extends AbstractModeExpandJavaCodeN
for (WrittenPerson writtenPerson : writtenPersonList) {
Map<String,Object> params = new HashMap<>();
Map<String, Object> params = new HashMap<>();
String[] strings = tzypz.split(",");
for (String s : strings) {
switch (s) {

View File

@ -3,6 +3,7 @@ package weaver.interfaces.recruit.action;
import com.cloudstore.dev.api.bean.MessageBean;
import com.cloudstore.dev.api.bean.MessageType;
import com.cloudstore.dev.api.util.Util_Message;
import com.engine.recruit.conn.RecruitRecordSet;
import org.apache.commons.collections.CollectionUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
@ -106,7 +107,7 @@ public class RecruitFlowToModeAction implements Action {
String uuid = UUID.randomUUID().toString();
objects.add(0, uuid);
rst.executeUpdate(sql, objects);
refreshRight(rst, uuid, formModeId);
RecruitRecordSet.refreshRight(uuid, MODE_TABLE_NAME, formModeId, requestInfo.getRequestManager().getCreater());
// 申请人ID
String applicant = Util.null2String(map.get("sqr"));