2023-09-26 15:21:22 +08:00
|
|
|
package weaver.formmode.recruit.modeexpand.util;
|
|
|
|
|
|
|
|
|
|
import com.cloudstore.dev.api.bean.MessageBean;
|
|
|
|
|
import com.cloudstore.dev.api.bean.MessageType;
|
|
|
|
|
import com.cloudstore.dev.api.util.Util_Message;
|
2023-09-26 18:50:30 +08:00
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2023-10-17 15:18:53 +08:00
|
|
|
import org.apache.poi.util.IOUtils;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.docs.docs.DocCoder;
|
|
|
|
|
import weaver.docs.docs.DocComInfo;
|
|
|
|
|
import weaver.docs.docs.DocImageManager;
|
|
|
|
|
import weaver.docs.docs.DocManager;
|
|
|
|
|
import weaver.file.ImageFileManager;
|
2023-09-26 15:21:22 +08:00
|
|
|
import weaver.general.BaseBean;
|
2023-10-17 15:18:53 +08:00
|
|
|
import weaver.general.TimeUtil;
|
|
|
|
|
import weaver.hrm.User;
|
2023-09-26 15:21:22 +08:00
|
|
|
import weaver.hrm.resource.ResourceComInfo;
|
|
|
|
|
|
2023-10-17 15:18:53 +08:00
|
|
|
import java.io.BufferedInputStream;
|
2023-09-26 15:21:22 +08:00
|
|
|
import java.io.IOException;
|
2023-09-27 13:35:02 +08:00
|
|
|
import java.nio.charset.StandardCharsets;
|
2023-10-17 15:18:53 +08:00
|
|
|
import java.util.Objects;
|
2023-09-26 15:21:22 +08:00
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author:dxfeng
|
|
|
|
|
* @createTime: 2023/09/26
|
|
|
|
|
* @version: 1.0
|
|
|
|
|
*/
|
|
|
|
|
public class RecruitModeUtil {
|
|
|
|
|
/**
|
|
|
|
|
* 消息推送
|
|
|
|
|
*
|
|
|
|
|
* @param messageType 消息来源
|
|
|
|
|
* @param title 消息标题
|
|
|
|
|
* @param context 消息内容
|
|
|
|
|
* @param userIdList 接收人ID集合
|
|
|
|
|
* @param creater 消息创建者
|
|
|
|
|
*/
|
|
|
|
|
public static void messagePush(String messageType, String title, String context, Set<String> userIdList, Integer creater) {
|
2023-10-20 15:52:26 +08:00
|
|
|
messagePush(messageType, title, context, userIdList, creater, "", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param messageType 消息来源
|
|
|
|
|
* @param title 消息标题
|
|
|
|
|
* @param context 消息内容
|
|
|
|
|
* @param userIdList 接收人ID集合
|
|
|
|
|
* @param creater 消息创建者
|
|
|
|
|
* @param linkUrl 待办跳转地址
|
|
|
|
|
* @param linkMobileUrl 移动端跳转地址
|
|
|
|
|
*/
|
|
|
|
|
public static void messagePush(String messageType, String title, String context, Set<String> userIdList, Integer creater, String linkUrl, String linkMobileUrl) {
|
2023-09-26 15:21:22 +08:00
|
|
|
MessageType message = MessageType.newInstance(Integer.parseInt(messageType));
|
|
|
|
|
try {
|
2023-10-20 15:52:26 +08:00
|
|
|
MessageBean messageBean = Util_Message.createMessage(message, userIdList, title, context, linkUrl, linkMobileUrl);
|
2023-09-26 15:21:22 +08:00
|
|
|
messageBean.setCreater(creater);
|
|
|
|
|
Util_Message.store(messageBean);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
new BaseBean().writeLog(e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取人员姓名
|
|
|
|
|
*
|
|
|
|
|
* @param ids 人员ID
|
|
|
|
|
* @return 人员姓名
|
|
|
|
|
*/
|
|
|
|
|
public static String getResourceNames(String ids) {
|
|
|
|
|
try {
|
|
|
|
|
return new ResourceComInfo().getLastnames(ids);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
new BaseBean().writeLog(e);
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取聚才林招聘相关配置文件
|
|
|
|
|
*
|
2023-09-27 13:35:02 +08:00
|
|
|
* @param key key
|
|
|
|
|
* @return value
|
2023-09-26 15:21:22 +08:00
|
|
|
*/
|
|
|
|
|
public static String getRecruitPropValue(String key) {
|
|
|
|
|
String value = new BaseBean().getPropValue("jclRecruit", key);
|
2023-09-27 13:35:02 +08:00
|
|
|
value = new String(value.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
|
2023-09-26 15:21:22 +08:00
|
|
|
return value;
|
|
|
|
|
}
|
2023-09-26 18:50:30 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 转换空字符串为null
|
|
|
|
|
*
|
|
|
|
|
* @param str 字符串
|
|
|
|
|
* @return 转换后的字符串
|
|
|
|
|
*/
|
|
|
|
|
public static Object parseBlankToNull(String str) {
|
|
|
|
|
return StringUtils.isBlank(str) ? null : str;
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-17 15:18:53 +08:00
|
|
|
/**
|
|
|
|
|
* 转换空字符串为null
|
|
|
|
|
*
|
|
|
|
|
* @param obj 对象
|
|
|
|
|
* @return 转换后的字符串
|
|
|
|
|
*/
|
|
|
|
|
public static String parseBlankToNull(Object obj) {
|
|
|
|
|
return Objects.isNull(obj) ? null : StringUtils.isBlank(obj.toString()) ? null : obj.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生成附件ID
|
|
|
|
|
*
|
|
|
|
|
* @param inputStream
|
|
|
|
|
* @param filename
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public static int generateImageFileId(BufferedInputStream inputStream, String filename) {
|
|
|
|
|
int imageFileId;
|
|
|
|
|
try {
|
|
|
|
|
byte[] bytes = IOUtils.toByteArray(inputStream);
|
|
|
|
|
ImageFileManager ifm = new ImageFileManager();
|
|
|
|
|
ifm.setData(bytes);
|
|
|
|
|
ifm.setImagFileName(filename);
|
|
|
|
|
imageFileId = ifm.saveImageFile();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
return imageFileId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 附件imageFieldId生成docId
|
|
|
|
|
*
|
|
|
|
|
* @param secCategory
|
|
|
|
|
* @param imageFieldId
|
|
|
|
|
* @param user
|
|
|
|
|
* @return
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
public static int createDocId(int secCategory, int imageFieldId, User user) throws Exception {
|
|
|
|
|
ImageFileManager manager = new ImageFileManager();
|
|
|
|
|
manager.getImageFileInfoById(imageFieldId);
|
|
|
|
|
String filenameqc = manager.getImageFileName();
|
|
|
|
|
String filenamebc = filenameqc.substring(0, filenameqc.lastIndexOf("."));
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
DocManager dm = new DocManager();
|
|
|
|
|
DocImageManager imgManger = new DocImageManager();
|
|
|
|
|
|
|
|
|
|
imgManger.setDocfiletype("2");
|
|
|
|
|
|
|
|
|
|
int docId = dm.getNextDocId(rs);
|
|
|
|
|
imgManger.setDocid(docId);
|
|
|
|
|
imgManger.setImagefileid(imageFieldId);
|
|
|
|
|
imgManger.setImagefilename(filenameqc);
|
|
|
|
|
imgManger.setIsextfile("1");
|
|
|
|
|
imgManger.AddDocImageInfo();
|
|
|
|
|
|
|
|
|
|
String date = TimeUtil.getCurrentDateString();
|
|
|
|
|
String time = TimeUtil.getOnlyCurrentTimeString();
|
|
|
|
|
dm.setId(docId);
|
|
|
|
|
dm.setMaincategory(0);
|
|
|
|
|
dm.setSubcategory(0);
|
|
|
|
|
dm.setSeccategory(secCategory);
|
|
|
|
|
dm.setLanguageid(user.getLanguage());
|
|
|
|
|
|
|
|
|
|
dm.setDocstatus("1");
|
|
|
|
|
dm.setDocsubject(filenamebc);
|
|
|
|
|
dm.setDoccreaterid(user.getUID());
|
|
|
|
|
dm.setDocCreaterType(user.getLogintype());
|
|
|
|
|
dm.setUsertype(user.getLogintype());
|
|
|
|
|
dm.setOwnerid(user.getUID());
|
|
|
|
|
dm.setOwnerType(user.getLogintype());
|
|
|
|
|
dm.setDoclastmoduserid(user.getUID());
|
|
|
|
|
dm.setDocLastModUserType(user.getLogintype());
|
|
|
|
|
dm.setDoccreatedate(date);
|
|
|
|
|
dm.setDoclastmoddate(date);
|
|
|
|
|
dm.setDoccreatetime(time);
|
|
|
|
|
dm.setDoclastmodtime(time);
|
|
|
|
|
dm.setDoclangurage(user.getLanguage());
|
|
|
|
|
dm.setKeyword(filenameqc);
|
|
|
|
|
dm.setIsapprover("0");
|
|
|
|
|
dm.setIsreply("");
|
|
|
|
|
dm.setDocdepartmentid(user.getUserDepartment());
|
|
|
|
|
dm.setDocreplyable("1");
|
|
|
|
|
dm.setAccessorycount(1);
|
|
|
|
|
dm.setParentids("" + docId);
|
|
|
|
|
dm.setUserid(user.getUID());
|
|
|
|
|
DocCoder docCoder = new DocCoder();
|
|
|
|
|
dm.setDocCode(docCoder.getDocCoder("" + secCategory));
|
|
|
|
|
dm.setDocEditionId(dm.getNextEditionId(rs));
|
|
|
|
|
dm.setDocEdition(1);
|
|
|
|
|
dm.AddDocInfo();
|
|
|
|
|
dm.AddShareInfo();
|
|
|
|
|
DocComInfo dc = new DocComInfo();
|
|
|
|
|
dc.addDocInfoCache("" + docId);
|
|
|
|
|
return docId;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-26 15:21:22 +08:00
|
|
|
}
|