You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
165 lines
4.9 KiB
Java
165 lines
4.9 KiB
Java
package com.customization.sskj.util;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import weaver.conn.RecordSet;
|
|
import weaver.formmode.setup.ModeRightInfo;
|
|
import weaver.general.BaseBean;
|
|
import weaver.general.Util;
|
|
import weaver.hrm.User;
|
|
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
|
|
/**
|
|
* 职务类别工具类
|
|
* @author chenwnj
|
|
* @date 2023/10/19
|
|
* @description
|
|
**/
|
|
public class JobGroupUtil {
|
|
|
|
BaseBean basebean = new BaseBean();
|
|
|
|
public Map< String, Object> getJobGroupId(String jobGroupMark) {
|
|
Map< String, Object> result = new HashMap<>();
|
|
|
|
if (StringUtils.isEmpty(jobGroupMark)) {
|
|
result.put("code", 500);
|
|
result.put("msg", "jobGroupMark is null");
|
|
return result;
|
|
}
|
|
|
|
RecordSet rs = new RecordSet();
|
|
Integer id = -1;
|
|
String acqGroupIdSql = "select id from hrmjobgroups where jobgroupremark like '%" +jobGroupMark+ "%' ";
|
|
rs.executeQuery(acqGroupIdSql);
|
|
while (rs.next()) {
|
|
id = Util.getIntValue(Util.null2String(rs.getString("id")));
|
|
}
|
|
result.put("code", 200);
|
|
result.put("data", id);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* 查询职务类别描述是否存在
|
|
* @param jobGroup
|
|
* @return
|
|
*/
|
|
public Integer checkDesc(String jobGroup) {
|
|
if (StringUtils.isEmpty(jobGroup)) {
|
|
return -1;
|
|
}
|
|
|
|
RecordSet rs = new RecordSet();
|
|
Integer number = 0;
|
|
String cheDescSql = "select count(*) as number from uf_jobgroupDesc where jobgroup = ?";
|
|
rs.executeQuery(cheDescSql, jobGroup);
|
|
while (rs.next()) {
|
|
number = Util.getIntValue(Util.null2String(rs.getString("number")));
|
|
}
|
|
|
|
return number;
|
|
}
|
|
|
|
/**
|
|
* 获取职务类别描述
|
|
* @param jobGroup
|
|
* @return
|
|
*/
|
|
public String getDesc(String jobGroup) {
|
|
String jobGroupDesc = "";
|
|
|
|
if (StringUtils.isEmpty(jobGroup)) {
|
|
return jobGroupDesc;
|
|
}
|
|
|
|
RecordSet rs = new RecordSet();
|
|
String acqDescSql = "select jobGroupDesc from uf_jobgroupDesc where jobgroup = ?";
|
|
rs.executeQuery(acqDescSql, jobGroup);
|
|
while (rs.next()) {
|
|
jobGroupDesc = Util.null2String(rs.getString("jobGroupDesc"));
|
|
}
|
|
|
|
return jobGroupDesc;
|
|
}
|
|
|
|
/**
|
|
* 职务类别增加描述
|
|
* @param jobGroup
|
|
* @param jobGroupDesc
|
|
* @param user
|
|
* @return
|
|
*/
|
|
public boolean addJobGroupDesc(String jobGroup, String jobGroupDesc, User user){
|
|
boolean addFlag = false;
|
|
|
|
if (StringUtils.isEmpty(jobGroup)) {
|
|
return addFlag;
|
|
}
|
|
|
|
RecordSet recordSet = new RecordSet();
|
|
String addDescSql = "insert into uf_jobgroupDesc (jobGroup, jobGroupDesc, formmodeid, modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime, MODEUUID) values (?,?,?,?,?,?,?,?)";
|
|
|
|
String jobGroupDesModeId = basebean.getPropValue("project_sskj", "jobGroupDesModeId");
|
|
Integer modedatacreater = user.getUID();
|
|
Integer modedatacreatertype = user.getType();
|
|
String modedatacreatedate = DateUtil.format(new Date(), "yyyy-MM-dd");
|
|
String modedatacreatetime = DateUtil.format(new Date(), "HH:mm:ss");
|
|
String uuid = UUID.randomUUID().toString();
|
|
|
|
addFlag = recordSet.executeUpdate(addDescSql, jobGroup, jobGroupDesc, jobGroupDesModeId, modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime, uuid);
|
|
if (addFlag) {
|
|
String billid = "-1";
|
|
String acqModeIdSql = "select id from uf_jobgroupDesc where MODEUUID = ?";
|
|
recordSet.executeQuery(acqModeIdSql, uuid);
|
|
while (recordSet.next()) {
|
|
billid = Util.null2String(recordSet.getString("id"));
|
|
}
|
|
modePerRecon(modedatacreater, jobGroupDesModeId, billid);
|
|
}
|
|
|
|
|
|
return addFlag;
|
|
}
|
|
|
|
/**
|
|
* 修改职务类别描述
|
|
* @param jobGroup
|
|
* @param jobGroupDesc
|
|
* @param user
|
|
* @return
|
|
*/
|
|
public boolean modJobGroupDesc(String jobGroup, String jobGroupDesc, User user){
|
|
boolean modFlag = false;
|
|
|
|
if (StringUtils.isEmpty(jobGroup)) {
|
|
return modFlag;
|
|
}
|
|
|
|
RecordSet recordSet = new RecordSet();
|
|
String modDescSql = "update uf_jobgroupDesc set jobGroupDesc = ? where jobGroup = ? ";
|
|
|
|
modFlag = recordSet.executeUpdate(modDescSql, jobGroupDesc, jobGroup);
|
|
|
|
return modFlag;
|
|
}
|
|
|
|
/**
|
|
* 建模权限重构
|
|
* @param userId
|
|
* @param jobGroupDesModeId
|
|
* @param billid
|
|
*/
|
|
public void modePerRecon(Integer userId, String jobGroupDesModeId, String billid) {
|
|
ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
|
ModeRightInfo.setNewRight(true);
|
|
ModeRightInfo.editModeDataShare( userId, Integer.parseInt(jobGroupDesModeId), Integer.parseInt(billid));
|
|
}
|
|
|
|
|
|
}
|