Commit d59a4401 by jianan

电子报聘回退优化8

parent fb7c5e69
...@@ -39,10 +39,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -39,10 +39,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -241,6 +238,14 @@ public class AgmsHiringServiceImpl implements AgmsHiringService { ...@@ -241,6 +238,14 @@ public class AgmsHiringServiceImpl implements AgmsHiringService {
} }
} }
} }
// 如果是回退
if (CommonUtil.isNullOrZero(requestVO.getApprovingStatus())) {
Integer stepSeqStart = this.getRecordsRollBackStepSeqStart(requestVO.getStepsSeqBackTo());
if (!Integer.valueOf("0").equals(stepSeqStart) && stepSeqStart >= step.getStepSeq()) {
responseVO.setCommonResult(new CommonResult(false, "只能退回到已审核的步骤"));
return;
}
}
//保存审批结果 //保存审批结果
saveRecords(practitionerId, mobileNo, hiringApproveStepsList, requestVO, responseVO); saveRecords(practitionerId, mobileNo, hiringApproveStepsList, requestVO, responseVO);
...@@ -532,7 +537,8 @@ public class AgmsHiringServiceImpl implements AgmsHiringService { ...@@ -532,7 +537,8 @@ public class AgmsHiringServiceImpl implements AgmsHiringService {
if (CommonUtil.isNullOrZero(requestVO.getApprovingStatus())) { if (CommonUtil.isNullOrZero(requestVO.getApprovingStatus())) {
// 审批回退, 将指定审批记录设置"回退"状态 // 审批回退, 将指定审批记录设置"回退"状态
this.setRecordsRollBack(stepsSeqBackTo, step.getStepSeq(), requestVO.getRejectNote(), basicInfoId); Integer stepSeqStart = this.getRecordsRollBackStepSeqStart(stepsSeqBackTo);
this.setRecordsRollBack(stepSeqStart, step.getStepSeq(), requestVO.getRejectNote(), basicInfoId);
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"))); responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return; return;
...@@ -573,36 +579,46 @@ public class AgmsHiringServiceImpl implements AgmsHiringService { ...@@ -573,36 +579,46 @@ public class AgmsHiringServiceImpl implements AgmsHiringService {
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"))); responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
} }
private void setRecordsRollBack(String stepsSeqBackTo, Integer stepSeq, String rejectNote, Long basicInfoId) { private Integer getRecordsRollBackStepSeqStart(String stepsSeqBackTo) {
String approveName; Integer stepSeqStart;
int stepSeqStart;
if ("-2".equals(stepsSeqBackTo)) { if ("-2".equals(stepsSeqBackTo)) {
stepSeqStart = 1; stepSeqStart = 1;
approveName = "辅导人";
} else if ("1".equals(stepsSeqBackTo)) { } else if ("1".equals(stepsSeqBackTo)) {
stepSeqStart = 2; stepSeqStart = 2;
approveName = "体系负责人";
} else if ("2".equals(stepsSeqBackTo)) { } else if ("2".equals(stepsSeqBackTo)) {
stepSeqStart = 3; stepSeqStart = 3;
approveName = "公司运营主管"; } else if ("3".equals(stepsSeqBackTo)) {
} else if ("3".equals(stepsSeqBackTo)) {
stepSeqStart = 4; stepSeqStart = 4;
approveName = "寿险总经理"; } else if ("4".equals(stepsSeqBackTo)) {
} else if ("4".equals(stepsSeqBackTo)) {
stepSeqStart = 5; stepSeqStart = 5;
approveName = "公司总经理"; } else {
} else { stepSeqStart = 0;
stepSeqStart = 1;
approveName = "辅导人";
} }
return stepSeqStart;
}
if (stepSeqStart >= stepSeq) { private void setRecordsRollBack(Integer stepSeqStart, Integer stepSeq, String rejectNote, Long basicInfoId) {
throw new RuntimeException("只能退回到已审核的步骤"); rejectNote = StringUtils.isBlank(rejectNote) ? "无" : rejectNote;
String approveName = null;
if (Integer.valueOf("1").equals(stepSeqStart)) {
approveName = "辅导人";
} else if (Integer.valueOf("2").equals(stepSeqStart)) {
approveName = "体系负责人";
} else if (Integer.valueOf("3").equals(stepSeqStart)) {
approveName = "公司运营主管";
} else if (Integer.valueOf("4").equals(stepSeqStart)) {
approveName = "寿险总经理";
} else if (Integer.valueOf("5").equals(stepSeqStart)) {
approveName = "公司总经理";
} else if (Integer.valueOf("0").equals(stepSeqStart)) {
approveName = "报聘人";
} }
// 查询审批记录
// 1.查询审批记录
List<AclPractitionerHiringApproveRecords> recordsList = aclPractitionerHiringApproveRecordsDalService.queryListByBasicInfoId(basicInfoId); List<AclPractitionerHiringApproveRecords> recordsList = aclPractitionerHiringApproveRecordsDalService.queryListByBasicInfoId(basicInfoId);
// 筛选需要提醒的经纪人id // 2.1 如果有审批记录,筛选需要提醒的审批经纪人id
List<Long> practitionerIds = recordsList.stream() List<Long> practitionerIds = recordsList.stream()
.filter(i -> (Integer.parseInt(i.getStepSeq()) >= stepSeqStart && Integer.parseInt(i.getStepSeq()) < stepSeq) .filter(i -> (Integer.parseInt(i.getStepSeq()) >= stepSeqStart && Integer.parseInt(i.getStepSeq()) < stepSeq)
) )
...@@ -611,12 +627,37 @@ public class AgmsHiringServiceImpl implements AgmsHiringService { ...@@ -611,12 +627,37 @@ public class AgmsHiringServiceImpl implements AgmsHiringService {
if (CollectionUtils.isNotEmpty(practitionerIds)) { if (CollectionUtils.isNotEmpty(practitionerIds)) {
List<PractitionerInfo> practitionerList = aclPractitionerDalService.findPractitionerInfoByIdList(practitionerIds); List<PractitionerInfo> practitionerList = aclPractitionerDalService.findPractitionerInfoByIdList(practitionerIds);
ArrayList<Map<String, String>> list = new ArrayList<>();
for (PractitionerInfo practitionerInfo : practitionerList) {
Map<String, String> map = new HashMap<>();
map.put("name", practitionerInfo.getName());
map.put("mobileNo", practitionerInfo.getMobileNo());
map.put("ydWechatOpenid", practitionerInfo.getYdWechatOpenid());
list.add(map);
}
// 回退提醒发消息(短信和微信推送)
this.approveRollBackNoticeSendMsg(approveName, rejectNote, list, basicInfoId);
}
// 2.2 如果没有审批记录,说明是从辅导人第一步直接退回到报聘人,则只要提醒报聘人
if (CollectionUtils.isEmpty(practitionerIds) && Integer.valueOf("0").equals(stepSeqStart)) {
AclPractitionerHiringBasicInfo basicInfo = aclPractitionerHiringBasicInfoDalService.findById(basicInfoId);
AclCustomer customer = aclCustomerDalService.findByMobileNo(basicInfo.getMobileNo());
Map<String, String> map = new HashMap<>();
map.put("name", basicInfo.getName());
map.put("mobileNo", basicInfo.getMobileNo());
map.put("ydWechatOpenid", customer == null ? null : customer.getYdWechatOpenid());
map.put("approveName", approveName);
ArrayList<Map<String, String>> list = new ArrayList<>();
list.add(map);
// 回退提醒发消息(短信和微信推送) // 回退提醒发消息(短信和微信推送)
this.approveRollBackNoticeSendMsg(approveName, rejectNote, practitionerList, basicInfoId); this.approveRollBackNoticeSendMsg(approveName, rejectNote, list, basicInfoId);
} }
} }
private void approveRollBackNoticeSendMsg(String approveName, String rejectNote, List<PractitionerInfo> practitionerList, Long basicInfoId) { private void approveRollBackNoticeSendMsg(String approveName, String rejectNote, List<Map<String, String>> practitionerList, Long basicInfoId) {
AclPractitionerHiringBasicInfo basicInfo = aclPractitionerHiringBasicInfoDalService.findById(basicInfoId); AclPractitionerHiringBasicInfo basicInfo = aclPractitionerHiringBasicInfoDalService.findById(basicInfoId);
// 查询辅导人所在S1,S2,S3 // 查询辅导人所在S1,S2,S3
AclPractitionerHiringMembership hiringMemberShip = practitionerHiringDalService.queryHiringMemberShip(basicInfoId); AclPractitionerHiringMembership hiringMemberShip = practitionerHiringDalService.queryHiringMemberShip(basicInfoId);
...@@ -629,9 +670,9 @@ public class AgmsHiringServiceImpl implements AgmsHiringService { ...@@ -629,9 +670,9 @@ public class AgmsHiringServiceImpl implements AgmsHiringService {
// 被提醒人的姓名手机号 // 被提醒人的姓名手机号
String mobileNo; String mobileNo;
String name; String name;
for (PractitionerInfo practitioner : practitionerList) { for (Map<String, String> practitioner : practitionerList) {
mobileNo = practitioner.getMobileNo(); mobileNo = practitioner.get("mobileNo");
name = practitioner.getName(); name = practitioner.get("name");
// 1.发短信 // 1.发短信
if (StringUtils.isNotBlank(mobileNo)) { if (StringUtils.isNotBlank(mobileNo)) {
logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》电子报聘退回发送短信"); logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》电子报聘退回发送短信");
...@@ -643,15 +684,11 @@ public class AgmsHiringServiceImpl implements AgmsHiringService { ...@@ -643,15 +684,11 @@ public class AgmsHiringServiceImpl implements AgmsHiringService {
if (mobileNo.equals(basicInfo.getMobileNo())) { if (mobileNo.equals(basicInfo.getMobileNo())) {
content.put("approveName", "公众号,退回原因<" + rejectNote + ">"); content.put("approveName", "公众号,退回原因<" + rejectNote + ">");
} else { } else {
if (name.equals(approveName)) { content.put("approveName", approveName + ",退回原因<" + rejectNote + ">" + ",请至“赢家平台>我的团队-报聘审批”进行查看审批,谢谢!" + jumpUrl);
content.put("approveName", "您,退回原因<" + rejectNote + ">" + ",请至“赢家平台>我的团队-报聘审批”进行查看审批,谢谢!" + jumpUrl);
} else {
content.put("approveName", approveName + ",退回原因<" + rejectNote + ">" + ",请至“赢家平台>我的团队-报聘审批”进行查看审批,谢谢!" + jumpUrl);
}
} }
sendService.sendEmailOrSMS("sms", mobileNo, "0", content.toJSONString(), templateCode, null, null, "电子报聘审批退回", 99, basicInfoId); sendService.sendEmailOrSMS("sms", mobileNo, "0", content.toJSONString(), templateCode, null, null, "电子报聘审批退回", 99, basicInfoId);
} else { } else {
logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》电子报聘审批人电话号码不存在"); logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》电子报聘聘退回发送短信电话号码不存在");
logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》" + name + ": " + mobileNo); logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》" + name + ": " + mobileNo);
} }
// 2.微信公众号推送 // 2.微信公众号推送
......
...@@ -5,10 +5,10 @@ import com.yd.api.agms.vo.hiring.PractitionerHiringListRequestVO; ...@@ -5,10 +5,10 @@ import com.yd.api.agms.vo.hiring.PractitionerHiringListRequestVO;
import com.yd.dal.entity.agms.hiring.*; import com.yd.dal.entity.agms.hiring.*;
import com.yd.dal.entity.customer.AclPractitionerHiringBasicInfo; import com.yd.dal.entity.customer.AclPractitionerHiringBasicInfo;
import com.yd.dal.entity.customer.AclPractitionerHiringMembership; import com.yd.dal.entity.customer.AclPractitionerHiringMembership;
import com.yd.dal.entity.customer.practitioner.PractitionerInfo;
import com.yd.dal.entity.meta.MdPractitionerHiringApproveSteps; import com.yd.dal.entity.meta.MdPractitionerHiringApproveSteps;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author xxy * @author xxy
...@@ -76,5 +76,5 @@ public interface AgmsHiringDALService { ...@@ -76,5 +76,5 @@ public interface AgmsHiringDALService {
void noticeNextStep(MdPractitionerHiringApproveSteps nextStep, Long basicInfoId); void noticeNextStep(MdPractitionerHiringApproveSteps nextStep, Long basicInfoId);
void noticeSendWeChatMsg(String firstValue, String noticeMsg, List<PractitionerInfo> practitionerList, AclPractitionerHiringBasicInfo basicInfo); void noticeSendWeChatMsg(String firstValue, String noticeMsg, List<Map<String, String>> practitionerList, AclPractitionerHiringBasicInfo basicInfo);
} }
...@@ -189,11 +189,22 @@ public class AgmsHiringDALServiceImpl implements AgmsHiringDALService { ...@@ -189,11 +189,22 @@ public class AgmsHiringDALServiceImpl implements AgmsHiringDALService {
// 公众号推送通知下一位审批人进行审批 // 公众号推送通知下一位审批人进行审批
String firstValue = systemConfigService.getSingleConfigValue("TENCENT_WECHAT_TEMPLATE_FIRST_HIRING"); String firstValue = systemConfigService.getSingleConfigValue("TENCENT_WECHAT_TEMPLATE_FIRST_HIRING");
firstValue = firstValue.replace("hiringName", orgInfo); firstValue = firstValue.replace("hiringName", orgInfo);
this.noticeSendWeChatMsg(firstValue, "待审批", practitionerList, basicInfo);
ArrayList<Map<String, String>> list = new ArrayList<>();
for (PractitionerInfo practitionerInfo : practitionerList) {
Map<String, String> map = new HashMap<>();
map.put("name", practitionerInfo.getName());
map.put("mobileNo", practitionerInfo.getMobileNo());
map.put("ydWechatOpenid", practitionerInfo.getYdWechatOpenid());
list.add(map);
}
this.noticeSendWeChatMsg(firstValue, "待审批", list, basicInfo);
} }
@Override @Override
public void noticeSendWeChatMsg(String firstValue, String noticeMsg, List<PractitionerInfo> practitionerList, AclPractitionerHiringBasicInfo basicInfo) { public void noticeSendWeChatMsg(String firstValue, String noticeMsg, List<Map<String, String>> practitionerList, AclPractitionerHiringBasicInfo basicInfo) {
// 读取数据库配置 // 读取数据库配置
String templateId = systemConfigService.getSingleConfigValue("TENCENT_WECHAT_TEMPLATE_ID_HIRING"); String templateId = systemConfigService.getSingleConfigValue("TENCENT_WECHAT_TEMPLATE_ID_HIRING");
String jumpUrl = systemConfigService.getSingleConfigValue("hiringApprove_page_url"); String jumpUrl = systemConfigService.getSingleConfigValue("hiringApprove_page_url");
...@@ -221,20 +232,20 @@ public class AgmsHiringDALServiceImpl implements AgmsHiringDALService { ...@@ -221,20 +232,20 @@ public class AgmsHiringDALServiceImpl implements AgmsHiringDALService {
sendTemplateRequest.setData(dataInfo); sendTemplateRequest.setData(dataInfo);
sendTemplateRequest.setUrl(jumpUrl); sendTemplateRequest.setUrl(jumpUrl);
for (PractitionerInfo practitionerInfo : practitionerList) { for (Map<String, String> practitionerInfo : practitionerList) {
// openId不为null, 执行 // openId不为null, 执行
if (StringUtils.isNotBlank(practitionerInfo.getYdWechatOpenid())) { if (StringUtils.isNotBlank(practitionerInfo.get("ydWechatOpenid"))) {
sendTemplateRequest.setToUser(practitionerInfo.getYdWechatOpenid()); sendTemplateRequest.setToUser(practitionerInfo.get("ydWechatOpenid"));
// 审批人姓名 // 审批人姓名
first.setValue(firstValue.replace("name", practitionerInfo.getName())); first.setValue(firstValue.replace("name", practitionerInfo.get("name")));
logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》发送微信模板消息审批人"); logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》发送微信模板消息审批人");
logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》" + practitionerInfo.getName()); logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》" + practitionerInfo.get("name"));
// 微信通知 // 微信通知
wechatService.sendTemplateMessage(sendTemplateRequest); wechatService.sendTemplateMessage(sendTemplateRequest);
} else { } else {
logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》发送微信模板消息审批人openId为空"); logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》发送微信模板消息审批人openId为空");
logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》" + practitionerInfo.getName()); logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》" + practitionerInfo.get("name"));
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment