generated from dxfeng/secondev-chapanda-feishu
发送信息采集
This commit is contained in:
parent
d83b20b68b
commit
d86f902eac
|
|
@ -0,0 +1,12 @@
|
|||
package com.api.recruit.controller;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/10/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Path("/jcl/recruit/induction")
|
||||
public class InductionManageController extends com.engine.recruit.controller.InductionManageController{
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -70,4 +72,26 @@ public class RecruitRecordSet {
|
|||
mainDataMap.put("modedatacreatertype", "0");
|
||||
}
|
||||
|
||||
/**
|
||||
* 建模表数据权限重构
|
||||
*
|
||||
* @param uuid
|
||||
* @param modeTable
|
||||
* @param formModeId
|
||||
*/
|
||||
public static int refreshRight(String uuid, String modeTable, int formModeId) {
|
||||
RecordSet rs = new RecordSet();
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
package com.engine.recruit.controller;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.recruit.util.ResponseResult;
|
||||
import com.engine.recruit.wrapper.InductionManageWrapper;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/10/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class InductionManageController {
|
||||
public InductionManageWrapper getInductionManageWrapper(User user) {
|
||||
return ServiceUtil.getService(InductionManageWrapper.class, user);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/updateInductionManageInfo")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String updateInductionManageInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getInductionManageWrapper(user)::updateInductionManageInfo, params);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/sendCollectInfo")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String sendCollectInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getInductionManageWrapper(user)::sendCollectInfo, params);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/checkLoginInfo")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String checkLoginInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getInductionManageWrapper(user)::checkLoginInfo, params);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.engine.recruit.enums;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/10/24
|
||||
* @version: 1.0
|
||||
*/
|
||||
public enum InfoCollectEnum {
|
||||
/**
|
||||
* 信息采集状态
|
||||
*/
|
||||
NOT_SENT(0, "未发送"),
|
||||
HAS_SENT(1, "已发送"),
|
||||
NOT_SUBMITTED(2, "未提交"),
|
||||
SUBMITTED(3, "已提交");
|
||||
|
||||
InfoCollectEnum(Integer id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
private Integer id;
|
||||
private String name;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.engine.recruit.enums;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/10/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
public enum PositionOperateEnum {
|
||||
/**
|
||||
* 入职管理相关操作
|
||||
*/
|
||||
PREPARE("prepare", "入职准备"),
|
||||
HANDLE("prepare", "办理入职"),
|
||||
;
|
||||
|
||||
PositionOperateEnum(String operateType, String operateDesc) {
|
||||
this.operateType = operateType;
|
||||
this.operateDesc = operateDesc;
|
||||
}
|
||||
|
||||
private String operateType;
|
||||
private String operateDesc;
|
||||
|
||||
public String getOperateType() {
|
||||
return operateType;
|
||||
}
|
||||
|
||||
public void setOperateType(String operateType) {
|
||||
this.operateType = operateType;
|
||||
}
|
||||
|
||||
public String getOperateDesc() {
|
||||
return operateDesc;
|
||||
}
|
||||
|
||||
public void setOperateDesc(String operateDesc) {
|
||||
this.operateDesc = operateDesc;
|
||||
}
|
||||
|
||||
public static PositionOperateEnum getOperateType(String operateType) {
|
||||
for (PositionOperateEnum item : PositionOperateEnum.values()) {
|
||||
if (item.operateType.equalsIgnoreCase(operateType)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("不支持的操作类型");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.engine.recruit.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/10/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface InductionManageService {
|
||||
/**
|
||||
* 更新入职管理信息
|
||||
*
|
||||
* @param param 参数
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> updateInductionManageInfo(Map<String, Object> param);
|
||||
|
||||
|
||||
/**
|
||||
* 发送信息采集
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> sendCollectInfo(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 校验登录信息
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> checkLoginInfo(Map<String, Object> param);
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
package com.engine.recruit.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.recruit.conn.RecruitDataMap;
|
||||
import com.engine.recruit.conn.RecruitRecordSet;
|
||||
import com.engine.recruit.enums.InfoCollectEnum;
|
||||
import com.engine.recruit.enums.PositionOperateEnum;
|
||||
import com.engine.recruit.service.InductionManageService;
|
||||
import com.engine.recruit.util.RecruitMessageUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/10/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class InductionManageServiceImpl extends Service implements InductionManageService {
|
||||
@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(",");
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
for (String billId : split) {
|
||||
// 根据入职管理信息完善信息采集表单
|
||||
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);
|
||||
// 构建建模表基本数据
|
||||
RecruitRecordSet.buildModeBaseFields(dataMap, user.getUID());
|
||||
|
||||
rs.executeQuery("select * from uf_jcl_rzgl where id = ? ", billId);
|
||||
if (rs.next()) {
|
||||
dataMap.put("xm", RecruitModeUtil.parseBlankToNull(rs.getString("xm")));
|
||||
dataMap.put("sfzh", RecruitModeUtil.parseBlankToNull(rs.getString("sfzh")));
|
||||
dataMap.put("nl", RecruitModeUtil.parseBlankToNull(rs.getString("nl")));
|
||||
dataMap.put("xb", RecruitModeUtil.parseBlankToNull(rs.getString("xb")));
|
||||
dataMap.put("sjh", RecruitModeUtil.parseBlankToNull(rs.getString("sjhm")));
|
||||
dataMap.put("yx", RecruitModeUtil.parseBlankToNull(rs.getString("dzyx")));
|
||||
}
|
||||
|
||||
|
||||
// 生成登录密码
|
||||
String password = generatePassword();
|
||||
dataMap.put("mm", password);
|
||||
|
||||
|
||||
// 发送短信
|
||||
String mobile = Util.null2String(dataMap.get("sjh"));
|
||||
String messageContent = RecruitModeUtil.getRecruitPropValue("COLLECT_MESSAGE_CONTENT");
|
||||
// TODO
|
||||
if (StringUtils.isBlank(messageContent)) {
|
||||
//throw new CustomizeRunTimeException("未获取到短信内容,请检查配置");
|
||||
} else {
|
||||
RecruitMessageUtils.sendSMS(mobile, messageContent);
|
||||
}
|
||||
// 插入数据
|
||||
RecruitRecordSet.insertData(dataMap, "uf_jcl_xxcj");
|
||||
int id = RecruitRecordSet.refreshRight(uuid, "uf_jcl_xxcj", formModeId);
|
||||
|
||||
// 更新状态为已发送,反填信息采集ID
|
||||
rs.executeUpdate("update uf_jcl_rzgl set xxcj = ? ,xxcjid = ? where id = ? ", InfoCollectEnum.HAS_SENT, id, billId);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> checkLoginInfo(Map<String, Object> param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机八位不重复登录密码,含数字、字母
|
||||
*
|
||||
* @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();
|
||||
}
|
||||
}
|
||||
|
|
@ -15,13 +15,20 @@ public class RecruitMessageUtils {
|
|||
String sendTo = Util.null2String(param.get("sendTo"));
|
||||
String emailTitle = Util.null2String(param.get("emailTitle"));
|
||||
String emailContent = Util.null2String(param.get("emailContent"));
|
||||
//EmailWorkRunnable.threadModeReminder(sendTo, emailTitle, emailContent);
|
||||
return MessageUtil.sendEmail(sendTo, emailTitle, emailContent);
|
||||
return SendEmail(sendTo, emailTitle, emailContent);
|
||||
}
|
||||
|
||||
public static boolean sendSMS(Map<String, Object> param) {
|
||||
String receiver = Util.null2String(param.get("receiver"));
|
||||
String content = Util.null2String(param.get("content"));
|
||||
return sendSMS(receiver, content);
|
||||
}
|
||||
|
||||
public static boolean SendEmail(String sendTo, String emailTitle, String emailContent) {
|
||||
return MessageUtil.sendEmail(sendTo, emailTitle, emailContent);
|
||||
}
|
||||
|
||||
public static boolean sendSMS(String receiver, String content) {
|
||||
return MessageUtil.sendSMS(receiver, content);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
package com.engine.recruit.wrapper;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.recruit.service.InductionManageService;
|
||||
import com.engine.recruit.service.impl.InductionManageServiceImpl;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/10/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class InductionManageWrapper extends Service {
|
||||
private InductionManageService getInductionManageService(User user) {
|
||||
return ServiceUtil.getService(InductionManageServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public Map<String, Object> updateInductionManageInfo(Map<String, Object> param) {
|
||||
return getInductionManageService(user).updateInductionManageInfo(param);
|
||||
}
|
||||
|
||||
public Map<String, Object> sendCollectInfo(Map<String, Object> param) {
|
||||
return getInductionManageService(user).sendCollectInfo(param);
|
||||
}
|
||||
|
||||
public Map<String, Object> checkLoginInfo(Map<String, Object> param) {
|
||||
return getInductionManageService(user).checkLoginInfo(param);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue