2023-10-24 15:26:07 +08:00
|
|
|
|
package com.engine.recruit.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.engine.core.impl.Service;
|
2023-11-06 14:31:25 +08:00
|
|
|
|
import com.engine.recruit.conn.ApplicantCommonInfo;
|
2023-10-24 15:26:07 +08:00
|
|
|
|
import com.engine.recruit.conn.RecruitDataMap;
|
|
|
|
|
|
import com.engine.recruit.conn.RecruitRecordSet;
|
2023-11-06 14:31:25 +08:00
|
|
|
|
import com.engine.recruit.entity.record.ApplicantRecordPo;
|
2023-11-20 09:24:08 +08:00
|
|
|
|
import com.engine.recruit.enums.EntryStatusEnum;
|
2023-10-24 15:26:07 +08:00
|
|
|
|
import com.engine.recruit.enums.InfoCollectEnum;
|
|
|
|
|
|
import com.engine.recruit.enums.PositionOperateEnum;
|
2023-11-06 14:31:25 +08:00
|
|
|
|
import com.engine.recruit.enums.RecordOperateEnum;
|
2023-10-24 17:41:46 +08:00
|
|
|
|
import com.engine.recruit.exception.CustomizeRunTimeException;
|
2023-10-24 15:26:07 +08:00
|
|
|
|
import com.engine.recruit.service.InductionManageService;
|
|
|
|
|
|
import com.engine.recruit.util.RecruitMessageUtils;
|
2023-11-14 16:46:53 +08:00
|
|
|
|
import com.weaver.formmodel.data.model.Formfield;
|
2023-10-24 15:26:07 +08:00
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2023-10-30 18:33:14 +08:00
|
|
|
|
import weaver.common.DateUtil;
|
2023-10-24 15:26:07 +08:00
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
|
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
2023-11-14 16:46:53 +08:00
|
|
|
|
import java.util.stream.Collectors;
|
2023-10-24 15:26:07 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @author:dxfeng
|
|
|
|
|
|
* @createTime: 2023/10/23
|
|
|
|
|
|
* @version: 1.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public class InductionManageServiceImpl extends Service implements InductionManageService {
|
2023-10-31 14:34:05 +08:00
|
|
|
|
private static final String MOBILE_APPID_COLLECT = RecruitModeUtil.getRecruitPropValue("MOBILE_APPID_COLLECT");
|
|
|
|
|
|
|
2023-10-24 15:26:07 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> updateInductionManageInfo(Map<String, Object> param) {
|
|
|
|
|
|
String operateType = Util.null2String(param.get("operateType"));
|
|
|
|
|
|
|
|
|
|
|
|
if (PositionOperateEnum.PREPARE.getOperateType().equals(operateType)) {
|
|
|
|
|
|
// 发起入职准备
|
|
|
|
|
|
|
|
|
|
|
|
// 反填流程信息到建模表
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> sendCollectInfo(Map<String, Object> param) {
|
|
|
|
|
|
String ids = Util.null2String(param.get("ids"));
|
|
|
|
|
|
String[] split = ids.split(",");
|
2023-10-31 14:34:05 +08:00
|
|
|
|
if (StringUtils.isBlank(MOBILE_APPID_COLLECT)) {
|
|
|
|
|
|
throw new CustomizeRunTimeException("未获取到对应移动建模ID,请检查配置文件");
|
|
|
|
|
|
}
|
2023-10-24 15:26:07 +08:00
|
|
|
|
RecordSet rs = new RecordSet();
|
2023-10-31 14:34:05 +08:00
|
|
|
|
rs.executeQuery("select noLoginUser from mobileappbaseinfo where id = ?", MOBILE_APPID_COLLECT);
|
|
|
|
|
|
int creator = -1;
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
creator = rs.getInt("noLoginUser");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (-1 == creator) {
|
2023-11-14 16:46:53 +08:00
|
|
|
|
throw new CustomizeRunTimeException("未配置免登陆访问用户,请检查移动建模应用配置");
|
2023-10-31 14:34:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-14 16:46:53 +08:00
|
|
|
|
// 查询信息采集模板内容
|
|
|
|
|
|
rs.executeQuery("select yjnr,mbmc from uf_jcl_yjtzmb where mblx = 3");
|
|
|
|
|
|
String yjnr = "";
|
|
|
|
|
|
String mbmc = "";
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
yjnr = rs.getString("yjnr");
|
|
|
|
|
|
mbmc = rs.getString("mbmc");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isBlank(yjnr)) {
|
|
|
|
|
|
throw new CustomizeRunTimeException("未获取到信息采集邮件通知模板");
|
|
|
|
|
|
}
|
|
|
|
|
|
// 查询字段信息
|
|
|
|
|
|
List<Formfield> fieldList = RecruitModeUtil.getFieldList("uf_jcl_rzgl");
|
|
|
|
|
|
Map<String, List<Formfield>> fieldMapList = fieldList.stream().collect(Collectors.groupingBy(Formfield::getLabelName));
|
2023-10-31 14:34:05 +08:00
|
|
|
|
|
2023-10-24 15:26:07 +08:00
|
|
|
|
for (String billId : split) {
|
2023-10-24 17:41:46 +08:00
|
|
|
|
// 判断是否已发送信息采集,已发送的不重复发送
|
2023-11-14 16:46:53 +08:00
|
|
|
|
rs.executeQuery("select xxcjid from uf_jcl_rzgl where id = ? ", billId);
|
2023-10-24 17:41:46 +08:00
|
|
|
|
if (rs.next()) {
|
2023-11-14 16:46:53 +08:00
|
|
|
|
if (StringUtils.isNotBlank(rs.getString("xxcjid"))) {
|
2023-10-24 17:41:46 +08:00
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-11-14 16:46:53 +08:00
|
|
|
|
// 查询当前数据字段值
|
|
|
|
|
|
rs.executeQuery("select * from uf_jcl_rzgl where id = ? ", billId);
|
|
|
|
|
|
Map<String, Object> mainDataMap = RecruitRecordSet.getSingleRecordMap(rs);
|
|
|
|
|
|
|
2023-10-24 17:41:46 +08:00
|
|
|
|
|
2023-10-24 15:26:07 +08:00
|
|
|
|
// 根据入职管理信息完善信息采集表单
|
|
|
|
|
|
Map<String, Object> dataMap = new RecruitDataMap<>();
|
|
|
|
|
|
String uuid = UUID.randomUUID().toString();
|
|
|
|
|
|
dataMap.put("modeuuid", uuid);
|
|
|
|
|
|
int formModeId = -1;
|
|
|
|
|
|
rs.executeQuery("select id from modeinfo where formid =( select id from workflow_bill where tablename = 'uf_jcl_xxcj' )");
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
formModeId = rs.getInt("id");
|
|
|
|
|
|
}
|
|
|
|
|
|
dataMap.put("formmodeid", formModeId);
|
|
|
|
|
|
// 构建建模表基本数据
|
2023-11-02 14:26:03 +08:00
|
|
|
|
RecruitRecordSet.buildModeInsertFields(dataMap, creator);
|
2023-11-14 16:46:53 +08:00
|
|
|
|
dataMap.put("xm", RecruitModeUtil.parseBlankToNull(mainDataMap.get("xm")));
|
|
|
|
|
|
dataMap.put("sfzh", RecruitModeUtil.parseBlankToNull(mainDataMap.get("sfzh")));
|
|
|
|
|
|
dataMap.put("nl", RecruitModeUtil.parseBlankToNull(mainDataMap.get("nl")));
|
|
|
|
|
|
dataMap.put("xb", RecruitModeUtil.parseBlankToNull(mainDataMap.get("xb")));
|
|
|
|
|
|
dataMap.put("sjh", RecruitModeUtil.parseBlankToNull(mainDataMap.get("sjhm")));
|
|
|
|
|
|
dataMap.put("yx", RecruitModeUtil.parseBlankToNull(mainDataMap.get("dzyx")));
|
2023-10-24 15:26:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 生成登录密码
|
|
|
|
|
|
String password = generatePassword();
|
|
|
|
|
|
dataMap.put("mm", password);
|
|
|
|
|
|
|
2023-10-31 14:34:05 +08:00
|
|
|
|
dataMap.put("modedatastatus", "1");
|
|
|
|
|
|
|
2023-10-24 15:26:07 +08:00
|
|
|
|
|
|
|
|
|
|
// 插入数据
|
|
|
|
|
|
RecruitRecordSet.insertData(dataMap, "uf_jcl_xxcj");
|
2023-11-14 16:46:53 +08:00
|
|
|
|
|
2023-10-31 14:34:05 +08:00
|
|
|
|
int id = RecruitRecordSet.refreshRight(uuid, "uf_jcl_xxcj", formModeId, creator);
|
2023-10-24 15:26:07 +08:00
|
|
|
|
|
|
|
|
|
|
// 更新状态为已发送,反填信息采集ID
|
2023-10-24 17:41:46 +08:00
|
|
|
|
rs.executeUpdate("update uf_jcl_rzgl set xxcj = ? ,xxcjid = ? where id = ? ", InfoCollectEnum.HAS_SENT.getId(), id, billId);
|
2023-11-06 14:31:25 +08:00
|
|
|
|
|
2023-11-14 16:46:53 +08:00
|
|
|
|
// 发送短信
|
|
|
|
|
|
String mobile = Util.null2String(dataMap.get("sjh"));
|
|
|
|
|
|
String email = Util.null2String(dataMap.get("yx"));
|
|
|
|
|
|
|
|
|
|
|
|
String messageLink = RecruitModeUtil.getRecruitPropValue("COLLECT_MESSAGE_LINK");
|
2023-11-20 09:24:08 +08:00
|
|
|
|
//messageLink += "&billId=" + id;
|
2023-11-14 16:46:53 +08:00
|
|
|
|
|
|
|
|
|
|
yjnr = yjnr.replace("{链接地址}", messageLink);
|
|
|
|
|
|
yjnr = yjnr.replace("{初始密码}", password);
|
|
|
|
|
|
String msgContent = RecruitModeUtil.getReplaceContent(yjnr, fieldMapList, mainDataMap);
|
|
|
|
|
|
// 发送邮件
|
2023-11-20 09:24:08 +08:00
|
|
|
|
boolean sendEmail = RecruitMessageUtils.sendEmail(email, mbmc, msgContent);
|
2023-11-14 16:46:53 +08:00
|
|
|
|
// 发送短信
|
|
|
|
|
|
boolean sendSMS = RecruitMessageUtils.sendSMS(mobile, msgContent);
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-06 14:31:25 +08:00
|
|
|
|
// 记录应聘过程
|
|
|
|
|
|
rs.executeQuery("select pcid from uf_jcl_rzgl where id = ? ", billId);
|
|
|
|
|
|
String pcid = "";
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
pcid = rs.getString("pcid");
|
|
|
|
|
|
}
|
|
|
|
|
|
Map<String, Object> otherParam = new HashMap<>();
|
|
|
|
|
|
otherParam.put("createName", user.getLastname());
|
|
|
|
|
|
otherParam.put("pcid", pcid);
|
|
|
|
|
|
ApplicantRecordPo recordPo = ApplicantRecordPo.builder()
|
|
|
|
|
|
.billId(String.valueOf(id))
|
|
|
|
|
|
.operateTime(DateUtil.getDateTime())
|
|
|
|
|
|
.modeId(String.valueOf(formModeId))
|
|
|
|
|
|
.formId(String.valueOf(ApplicantCommonInfo.getFormIdByTableName("uf_jcl_xxcj")))
|
|
|
|
|
|
.user(user)
|
|
|
|
|
|
.recordOperateType(RecordOperateEnum.INFO_COLLECT)
|
|
|
|
|
|
.otherParam(otherParam)
|
|
|
|
|
|
.build();
|
|
|
|
|
|
recordPo.execute();
|
2023-10-24 15:26:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-20 09:24:08 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> verifyIDCard(Map<String, Object> params) {
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
|
String sfzh = Util.null2String(params.get("sfzh"));
|
|
|
|
|
|
String rzzt = Util.null2String(params.get("rzzt"));
|
|
|
|
|
|
String billId = Util.null2String(params.get("billId"));
|
|
|
|
|
|
// 根据身份证号,判定,只能有一个状态为待入职的数据
|
|
|
|
|
|
if (EntryStatusEnum.PENDING.getValue().equals(rzzt)) {
|
|
|
|
|
|
rs.executeQuery("select count(id) as num from uf_jcl_rzgl where sfzh = ? and id != ? and rzzt = ? ", sfzh, billId, rzzt);
|
|
|
|
|
|
int countNum = 0;
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
countNum = rs.getInt("num");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (countNum > 0) {
|
|
|
|
|
|
throw new CustomizeRunTimeException("当前身份证号已存在待入职状态数据");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return new HashMap<>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-24 15:26:07 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> checkLoginInfo(Map<String, Object> param) {
|
2023-10-24 17:41:46 +08:00
|
|
|
|
RecordSet rs = new RecordSet();
|
2023-10-26 16:04:05 +08:00
|
|
|
|
HashMap<String, Object> map = new HashMap<>(2);
|
2023-10-24 17:41:46 +08:00
|
|
|
|
String mobile = Util.null2String(param.get("mobile"));
|
|
|
|
|
|
String pwd = Util.null2String(param.get("pwd"));
|
2023-10-30 18:33:14 +08:00
|
|
|
|
|
|
|
|
|
|
// 校验当前链接的有效期
|
|
|
|
|
|
rs.executeQuery("select * from uf_jcl_rzgl where sjhm = ? ", mobile);
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
// 当前关联入职已取消入职/已入职;点击提示当前链接已失效,且不可操作
|
|
|
|
|
|
String entryStatus = rs.getString("rzzt");
|
|
|
|
|
|
if ("1".equals(entryStatus) || "2".equals(entryStatus)) {
|
|
|
|
|
|
throw new CustomizeRunTimeException("当前链接已失效");
|
|
|
|
|
|
}
|
|
|
|
|
|
// 当前信息采集链接的地址默认有效期为发出日期~预计入职日期
|
|
|
|
|
|
String date = rs.getString("yjrzrq");
|
|
|
|
|
|
int compDate = DateUtil.compDate(DateUtil.getCurrentDate(), date);
|
|
|
|
|
|
if (compDate < 0) {
|
|
|
|
|
|
throw new CustomizeRunTimeException("当前链接已失效");
|
|
|
|
|
|
}
|
2023-10-26 16:04:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rs.executeQuery("select id from uf_jcl_xxcj where sjh = ? and mm = ?", mobile, pwd);
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
map.put("id", Util.getIntValue(rs.getString("id")));
|
2023-10-30 18:33:14 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
throw new CustomizeRunTimeException("手机号或密码错误");
|
2023-10-26 16:04:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return map;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> infoSubmit(String id) {
|
2023-10-30 18:33:14 +08:00
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
|
rs.executeQuery("update uf_jcl_rzgl set xxcj = 2 where id = ?", id);
|
2023-10-26 16:04:05 +08:00
|
|
|
|
return null;
|
2023-10-24 15:26:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 随机八位不重复登录密码,含数字、字母
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return 登录密码
|
|
|
|
|
|
*/
|
|
|
|
|
|
private String generatePassword() {
|
|
|
|
|
|
String letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
|
|
|
|
String numbers = "0123456789";
|
|
|
|
|
|
String characters = letters + numbers;
|
|
|
|
|
|
|
|
|
|
|
|
List<Character> randomChars = new ArrayList<>();
|
|
|
|
|
|
Random random = new Random();
|
|
|
|
|
|
|
|
|
|
|
|
// 随机取得一个字母
|
|
|
|
|
|
randomChars.add(letters.charAt(random.nextInt(letters.length())));
|
|
|
|
|
|
|
|
|
|
|
|
// 随机取得一个数字
|
|
|
|
|
|
randomChars.add(numbers.charAt(random.nextInt(numbers.length())));
|
|
|
|
|
|
|
|
|
|
|
|
// 随机取得六个字符(字母或数字)
|
|
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
|
|
|
randomChars.add(characters.charAt(random.nextInt(characters.length())));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 打乱字符的顺序
|
|
|
|
|
|
Collections.shuffle(randomChars);
|
|
|
|
|
|
|
|
|
|
|
|
// 将字符列表转为字符串
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
for (char c : randomChars) {
|
|
|
|
|
|
sb.append(c);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return sb.toString();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|