diff --git a/src/com/api/recruit/controller/OfferController.java b/src/com/api/recruit/controller/OfferController.java new file mode 100644 index 0000000..8604e44 --- /dev/null +++ b/src/com/api/recruit/controller/OfferController.java @@ -0,0 +1,12 @@ +package com.api.recruit.controller; + +import javax.ws.rs.Path; + +/** + * @author:dxfeng + * @createTime: 2023/10/30 + * @version: 1.0 + */ +@Path("/jcl/recruit/offer") +public class OfferController extends com.engine.recruit.controller.OfferController{ +} diff --git a/src/com/engine/recruit/conn/CheckRepeatResume.java b/src/com/engine/recruit/conn/CheckRepeatResume.java index 6ad47d6..bc9ab34 100644 --- a/src/com/engine/recruit/conn/CheckRepeatResume.java +++ b/src/com/engine/recruit/conn/CheckRepeatResume.java @@ -118,7 +118,7 @@ public class CheckRepeatResume { } dataMap.put("formmodeid", formModeId); RecruitRecordSet.buildModeBaseFields(dataMap, 1); - return RecruitRecordSet.refreshRight(uuid, "uf_jcl_yppc", formModeId); + return RecruitRecordSet.refreshRight(uuid, "uf_jcl_yppc", formModeId, 1); } /** diff --git a/src/com/engine/recruit/conn/RecruitRecordSet.java b/src/com/engine/recruit/conn/RecruitRecordSet.java index c2ad227..c6e2fc3 100644 --- a/src/com/engine/recruit/conn/RecruitRecordSet.java +++ b/src/com/engine/recruit/conn/RecruitRecordSet.java @@ -123,7 +123,7 @@ public class RecruitRecordSet { * @param modeTable * @param formModeId */ - public static int refreshRight(String uuid, String modeTable, int formModeId) { + public static int refreshRight(String uuid, String modeTable, int formModeId, int creator) { RecordSet rs = new RecordSet(); rs.executeQuery("select id from " + modeTable + " where modeuuid='" + uuid + "'"); if (rs.next()) { @@ -132,7 +132,7 @@ public class RecruitRecordSet { ModeRightInfo modeRightInfo = new ModeRightInfo(); modeRightInfo.setNewRight(true); //新建的时候添加共享 - modeRightInfo.editModeDataShare(1, formModeId, bid); + modeRightInfo.editModeDataShare(creator, formModeId, bid); return bid; } return -1; diff --git a/src/com/engine/recruit/controller/OfferController.java b/src/com/engine/recruit/controller/OfferController.java new file mode 100644 index 0000000..874ef77 --- /dev/null +++ b/src/com/engine/recruit/controller/OfferController.java @@ -0,0 +1,46 @@ +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.OfferWrapper; +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/30 + * @version: 1.0 + */ +public class OfferController { + public OfferWrapper getOfferWrapper(User user) { + return ServiceUtil.getService(OfferWrapper.class, user); + } + + @POST + @Path("/getOfferContent") + @Produces(MediaType.APPLICATION_JSON) + public String getOfferContent(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + Map params = ParamUtil.request2Map(request); + return new ResponseResult, Map>(user).run(getOfferWrapper(user)::getOfferContent, params); + } + + @POST + @Path("/updateOfferStatus") + @Produces(MediaType.APPLICATION_JSON) + public String updateOfferStatus(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + Map params = ParamUtil.request2Map(request); + return new ResponseResult, Map>(user).run(getOfferWrapper(user)::updateOfferStatus, params); + } +} diff --git a/src/com/engine/recruit/service/OfferService.java b/src/com/engine/recruit/service/OfferService.java new file mode 100644 index 0000000..d81f127 --- /dev/null +++ b/src/com/engine/recruit/service/OfferService.java @@ -0,0 +1,35 @@ +package com.engine.recruit.service; + +import java.util.Map; + +/** + * @author:dxfeng + * @createTime: 2023/10/30 + * @version: 1.0 + */ +public interface OfferService { + /** + * 获取offer移动端地址 + * + * @param param + * @return + */ + Map getOfferMobileLink(Map param); + + + /** + * 获取邮件内容 + * + * @param param + * @return + */ + Map getOfferContent(Map param); + + /** + * 更新offer状态 + * + * @param param + * @return + */ + Map updateOfferStatus(Map param); +} diff --git a/src/com/engine/recruit/service/impl/InductionManageServiceImpl.java b/src/com/engine/recruit/service/impl/InductionManageServiceImpl.java index bac7397..2f84049 100644 --- a/src/com/engine/recruit/service/impl/InductionManageServiceImpl.java +++ b/src/com/engine/recruit/service/impl/InductionManageServiceImpl.java @@ -9,6 +9,7 @@ import com.engine.recruit.exception.CustomizeRunTimeException; import com.engine.recruit.service.InductionManageService; import com.engine.recruit.util.RecruitMessageUtils; import org.apache.commons.lang3.StringUtils; +import weaver.common.DateUtil; import weaver.conn.RecordSet; import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil; import weaver.general.Util; @@ -21,6 +22,8 @@ import java.util.*; * @version: 1.0 */ public class InductionManageServiceImpl extends Service implements InductionManageService { + private static final String MOBILE_APPID_COLLECT = RecruitModeUtil.getRecruitPropValue("MOBILE_APPID_COLLECT"); + @Override public Map updateInductionManageInfo(Map param) { String operateType = Util.null2String(param.get("operateType")); @@ -38,8 +41,20 @@ public class InductionManageServiceImpl extends Service implements InductionMana public Map sendCollectInfo(Map param) { String ids = Util.null2String(param.get("ids")); String[] split = ids.split(","); - + if (StringUtils.isBlank(MOBILE_APPID_COLLECT)) { + throw new CustomizeRunTimeException("未获取到对应移动建模ID,请检查配置文件"); + } RecordSet rs = new RecordSet(); + rs.executeQuery("select noLoginUser from mobileappbaseinfo where id = ?", MOBILE_APPID_COLLECT); + int creator = -1; + if (rs.next()) { + creator = rs.getInt("noLoginUser"); + } + if (-1 == creator) { + throw new CustomizeRunTimeException("未配置免登陆访问用户,经检查移动建模应用配置"); + } + + for (String billId : split) { // 判断是否已发送信息采集,已发送的不重复发送 rs.executeQuery("select a.id from uf_jcl_xxcj a inner join uf_jcl_rzgl b on a.xm = b.xm and a.sjh = b.sjhm where b.id = ? ", billId); @@ -60,7 +75,7 @@ public class InductionManageServiceImpl extends Service implements InductionMana } dataMap.put("formmodeid", formModeId); // 构建建模表基本数据 - RecruitRecordSet.buildModeBaseFields(dataMap, user.getUID()); + RecruitRecordSet.buildModeBaseFields(dataMap, creator); rs.executeQuery("select * from uf_jcl_rzgl where id = ? ", billId); if (rs.next()) { @@ -77,6 +92,8 @@ public class InductionManageServiceImpl extends Service implements InductionMana String password = generatePassword(); dataMap.put("mm", password); + dataMap.put("modedatastatus", "1"); + // 发送短信 String mobile = Util.null2String(dataMap.get("sjh")); @@ -88,7 +105,7 @@ public class InductionManageServiceImpl extends Service implements InductionMana } // 插入数据 RecruitRecordSet.insertData(dataMap, "uf_jcl_xxcj"); - int id = RecruitRecordSet.refreshRight(uuid, "uf_jcl_xxcj", formModeId); + int id = RecruitRecordSet.refreshRight(uuid, "uf_jcl_xxcj", formModeId, creator); // 更新状态为已发送,反填信息采集ID rs.executeUpdate("update uf_jcl_rzgl set xxcj = ? ,xxcjid = ? where id = ? ", InfoCollectEnum.HAS_SENT.getId(), id, billId); @@ -103,18 +120,28 @@ public class InductionManageServiceImpl extends Service implements InductionMana HashMap map = new HashMap<>(2); String mobile = Util.null2String(param.get("mobile")); String pwd = Util.null2String(param.get("pwd")); - rs.executeQuery("select count(1) as sum from uf_jcl_rzgl where sjhm = ? and rzzt != 2",mobile); - rs.next(); - if (Util.getIntValue(rs.getString("sum")) == 0) { - map.put("message","当前链接已失效且不可操作"); - return map; + + // 校验当前链接的有效期 + 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("当前链接已失效"); + } } 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"))); - }else { - map.put("message","手机号或密码错误"); + } else { + throw new CustomizeRunTimeException("手机号或密码错误"); } return map; @@ -122,8 +149,8 @@ public class InductionManageServiceImpl extends Service implements InductionMana @Override public Map infoSubmit(String id) { - RecordSet rs = new RecordSet(); - rs.executeQuery("update uf_jcl_rzgl set xxcj = 2 where id = ?",id); + RecordSet rs = new RecordSet(); + rs.executeQuery("update uf_jcl_rzgl set xxcj = 2 where id = ?", id); return null; } diff --git a/src/com/engine/recruit/service/impl/NextStageServiceImpl.java b/src/com/engine/recruit/service/impl/NextStageServiceImpl.java index 85d575c..7e9cacb 100644 --- a/src/com/engine/recruit/service/impl/NextStageServiceImpl.java +++ b/src/com/engine/recruit/service/impl/NextStageServiceImpl.java @@ -62,10 +62,12 @@ public class NextStageServiceImpl extends Service implements RecruitButtonServic } } } - - - // 更新应聘者简历为下一阶段 - rs.executeUpdate("update uf_jcl_yppc set zpjd = ? where id = ?", target, billId); + rs.executeQuery("select jdlx from uf_jcl_zpjdsz where id = ?", target); + if (rs.next()) { + String jdlx = rs.getString("jdlx"); + // 更新应聘者简历为下一阶段 + rs.executeUpdate("update uf_jcl_yppc set zpjd = ?,dqypjd = ? where id = ?", target, jdlx, billId); + } return returnMap; diff --git a/src/com/engine/recruit/service/impl/OfferServiceImpl.java b/src/com/engine/recruit/service/impl/OfferServiceImpl.java new file mode 100644 index 0000000..2bee018 --- /dev/null +++ b/src/com/engine/recruit/service/impl/OfferServiceImpl.java @@ -0,0 +1,64 @@ +package com.engine.recruit.service.impl; + +import com.engine.core.impl.Service; +import com.engine.recruit.exception.CustomizeRunTimeException; +import com.engine.recruit.service.OfferService; +import org.apache.commons.lang3.StringUtils; +import weaver.conn.RecordSet; +import weaver.general.Util; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author:dxfeng + * @createTime: 2023/10/30 + * @version: 1.0 + */ +public class OfferServiceImpl extends Service implements OfferService { + @Override + public Map getOfferMobileLink(Map param) { + return null; + } + + @Override + public Map getOfferContent(Map param) { + Map returnMap = new HashMap<>(); + String billId = Util.null2String(param.get("billid")); + String email = Util.null2String(param.get("dzyx")); + RecordSet rs = new RecordSet(); + String offerContent = ""; + rs.executeQuery("select tznr from uf_jcl_offer where id = ? and dzyx = ?", billId, email); + if (rs.next()) { + offerContent = rs.getString("tznr"); + } + if (StringUtils.isAnyBlank(billId, email, offerContent)) { + throw new CustomizeRunTimeException("非法访问"); + } + returnMap.put("content", offerContent); + return returnMap; + } + + @Override + public Map updateOfferStatus(Map param) { + String status = Util.null2String(param.get("status")); + String email = Util.null2String(param.get("dzyx")); + String billId = Util.null2String(param.get("billid")); + if (StringUtils.isAnyBlank(billId, email, status) || !("2".equals(status) || "3".equals(status))) { + throw new CustomizeRunTimeException("非法操作"); + } + RecordSet rs = new RecordSet(); + // 判断是否已提交 + rs.executeQuery("select zt from uf_jcl_offer where id = ? and dzyx = ? ", billId, email); + if (rs.next()) { + String zt = rs.getString("zt"); + if ("2".equals(zt) || "3".equals(zt)) { + throw new CustomizeRunTimeException("此反馈已提交,请勿重复提交"); + } + } + + rs.executeUpdate("update uf_jcl_offer set zt = ? where id = ? and dzyx = ?", status, billId, email); + return null; + } + +} diff --git a/src/com/engine/recruit/wrapper/OfferWrapper.java b/src/com/engine/recruit/wrapper/OfferWrapper.java new file mode 100644 index 0000000..a95019c --- /dev/null +++ b/src/com/engine/recruit/wrapper/OfferWrapper.java @@ -0,0 +1,28 @@ +package com.engine.recruit.wrapper; + +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.recruit.service.OfferService; +import com.engine.recruit.service.impl.OfferServiceImpl; +import weaver.hrm.User; + +import java.util.Map; + +/** + * @author:dxfeng + * @createTime: 2023/10/30 + * @version: 1.0 + */ +public class OfferWrapper extends Service { + private OfferService getOfferService(User user) { + return ServiceUtil.getService(OfferServiceImpl.class, user); + } + + public Map getOfferContent(Map params) { + return getOfferService(user).getOfferContent(params); + } + + public Map updateOfferStatus(Map params) { + return getOfferService(user).updateOfferStatus(params); + } +} diff --git a/src/weaver/formmode/recruit/modeexpand/offer/CreateOfferModeExpand.java b/src/weaver/formmode/recruit/modeexpand/offer/CreateOfferModeExpand.java index a788af2..a342947 100644 --- a/src/weaver/formmode/recruit/modeexpand/offer/CreateOfferModeExpand.java +++ b/src/weaver/formmode/recruit/modeexpand/offer/CreateOfferModeExpand.java @@ -1,10 +1,13 @@ package weaver.formmode.recruit.modeexpand.offer; +import com.engine.recruit.exception.CustomizeRunTimeException; import com.engine.recruit.util.RecruitMessageUtils; +import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew; import weaver.general.Util; import weaver.hrm.User; +import weaver.hrm.company.SubCompanyComInfo; import weaver.soa.workflow.request.MainTableInfo; import weaver.soa.workflow.request.Property; import weaver.soa.workflow.request.RequestInfo; @@ -47,6 +50,8 @@ public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew { } // 发送信息 sendMessage(billId); + // 更新状态为已发送 + recordSet.executeUpdate("update uf_jcl_offer set zt = 1 where id = ? ", billId); } } } catch (Exception e) { @@ -59,7 +64,7 @@ public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew { private void sendMessage(int billId) { String querySql = "select sjhm,dzyx,yjtzmb,tznr,tzypz from uf_jcl_offer where id = ?"; - recordSet.executeQuery(querySql,billId); + recordSet.executeQuery(querySql, billId); String sjhm = ""; String dzyx = ""; String yjtzmb = ""; @@ -73,7 +78,7 @@ public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew { tzypz = Util.null2String(recordSet.getString("tzypz")); } - Map params = new HashMap<>(); + Map params = new HashMap<>(); String[] ways = tzypz.split(","); for (String way : ways) { switch (way) { @@ -86,9 +91,20 @@ public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew { break; case "1": // 短信 - params.put("receiver", sjhm); - params.put("content", tznr); - RecruitMessageUtils.sendSMS(params); + recordSet.executeQuery("select b.xm , c.zpzwmc , a.sxrq , a.rzgs from uf_jcl_offer a inner join uf_jcl_yppc b on a.xm = b.id inner join uf_jcl_zp_zpzw c on a.ypzw = c.id where a.id = ?", billId); + if (recordSet.next()) { + String name = recordSet.getString("xm"); + String positionName = recordSet.getString("zpzwmc"); + String endDate = recordSet.getString("sxrq"); + String companyId = recordSet.getString("rzgs"); + if (StringUtils.isAnyBlank(name, positionName, endDate, companyId)) { + throw new CustomizeRunTimeException("offer短信发送失败,应聘者信息获取失败"); + } + String msgContent = name + "你好,恭喜你成功通过" + new SubCompanyComInfo().getSubCompanyname(companyId) + "的" + positionName + "面试,聘用通知已发送至你的邮箱,请注意查收邮件,并于" + endDate + "前确认,逾期将失效。"; + params.put("receiver", sjhm); + params.put("content", msgContent); + RecruitMessageUtils.sendSMS(params); + } break; default: break; @@ -99,9 +115,10 @@ public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew { /** * 获取邮件模板主题 + * * @param id */ - private String getEmailTitle (String id) { + private String getEmailTitle(String id) { String emailTitle = ""; recordSet.executeQuery("select yjzt from uf_jcl_yjtzmb where id = ?", id); if (recordSet.next()) {