Commit 1f38a5fb by jianan

电子报聘回退优化1

parent 9f7ad72c
......@@ -33,14 +33,14 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import java.util.stream.Collectors;
/**
* @author xxy
......@@ -173,14 +173,9 @@ public class AgmsHiringServiceImpl implements AgmsHiringService {
Long hiringBasicInfoId = requestVO.getHiringBasicInfoId();
AclPractitionerHiringBasicInfo basicInfo = basicInfoMapper.selectByPrimaryKey(hiringBasicInfoId);
if (basicInfo != null && StringUtils.isNotEmpty(basicInfo.getApproveStatus())) {
List<AclPractitionerHiringApproveRecords> recordsList = aclPractitionerHiringApproveRecordsDalService.queryListByBasicInfoId(hiringBasicInfoId);
for (AclPractitionerHiringApproveRecords record : recordsList) {
if (record.getStepSeq().equals(String.valueOf(hiringApproveStepsSeq))) {
responseVO.setCommonResult(new CommonResult(false, "当前流程已审批,请勿重复提交"));
return responseVO;
}
}
if (basicInfo != null && StringUtils.isNotEmpty(basicInfo.getApproveStatus()) && basicInfo.getApproveStatus().compareTo(String.valueOf(hiringApproveStepsSeq)) >= 0) {
responseVO.setCommonResult(new CommonResult(false, "当前流程已审批,请勿重复提交"));
return responseVO;
}
Integer plateform = requestVO.getPlateform();
......@@ -486,6 +481,7 @@ public class AgmsHiringServiceImpl implements AgmsHiringService {
PractitionerHiringApproveResponseVO responseVO) {
Long basicInfoId = requestVO.getHiringBasicInfoId();
String stepsSeqBackTo = requestVO.getStepsSeqBackTo();
BeanPropertyValueEqualsPredicate predicate = new BeanPropertyValueEqualsPredicate("stepSeq", requestVO.getHiringApproveStepsSeq());
List<MdPractitionerHiringApproveSteps> steps = (List<MdPractitionerHiringApproveSteps>) CollectionUtils.select(hiringApproveStepsList, predicate);
......@@ -515,12 +511,20 @@ public class AgmsHiringServiceImpl implements AgmsHiringService {
AclPractitionerHiringBasicInfo updateObj = new AclPractitionerHiringBasicInfo();
updateObj.setId(basicInfoId);
updateObj.setApproveStatus(step.getStepSeq().toString());
basicInfoMapper.updateByPrimaryKeySelective(updateObj);
if (CommonUtil.isNullOrZero(requestVO.getApprovingStatus())) {
if (stepsSeqBackTo == null) {
basicInfoMapper.changeBasicinfoUpdatable(basicInfoId);
} else {
updateObj.setApproveStatus(stepsSeqBackTo);
basicInfoMapper.updateByPrimaryKeySelective(updateObj);
}
} else {
basicInfoMapper.updateByPrimaryKeySelective(updateObj);
}
if (CommonUtil.isNullOrZero(requestVO.getApprovingStatus())) {
// 审批拒绝 1.更新basicInfo表审批状态为 "null-可修改" 2.删除全部审批记录
basicInfoMapper.changeBasicinfoUpdatable(basicInfoId);
aclPractitionerHiringApproveRecordsDalService.deleteByHiringBasicInfoId(basicInfoId);
// 审批回退, 将指定审批记录设置"回退"状态
this.setRecordsRollBack(stepsSeqBackTo, step.getStepSeq(), basicInfoId);
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return;
......@@ -561,6 +565,64 @@ public class AgmsHiringServiceImpl implements AgmsHiringService {
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
}
private void setRecordsRollBack(String stepsSeqBackTo, Integer stepSeq, Long basicInfoId) {
List<AclPractitionerHiringApproveRecords> recordsList = aclPractitionerHiringApproveRecordsDalService.queryListByBasicInfoId(basicInfoId);
int stepSeqStart;
switch (stepsSeqBackTo) {
case "-2" :
stepSeqStart = 1;
break;
case "1" :
stepSeqStart = 2;
break;
case "2" :
stepSeqStart = 3;
break;
case "3" :
stepSeqStart = 4;
break;
case "4" :
stepSeqStart = 5;
break;
default:
stepSeqStart = 1;
break;
}
List<AclPractitionerHiringApproveRecords> records = recordsList.stream()
.filter((AclPractitionerHiringApproveRecords i) -> (Integer.valueOf(i.getStepSeq()) >= stepSeqStart && Integer.valueOf(i.getStepSeq()) < stepSeq)
)
.collect(Collectors.toList());
List<Long> practitionerIds = new ArrayList<>();
for (AclPractitionerHiringApproveRecords record : records) {
record.setIsBack(1);
// 退回发短信的经纪人Id
practitionerIds.add(record.getApprovingPractitionerId());
}
aclPractitionerHiringApproveRecordsDalService.updateBatch(records);
List<AclPractitioner> practitionerList = aclPractitionerDalService.findByIds(practitionerIds);
// String mobileNo;
// String name;
// for (AclPractitioner practitioner : practitionerList) {
// mobileNo = practitioner.getMobileNo();
// name = practitioner.getName();
// if (StringUtils.isNotBlank(mobileNo)) {
// logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》电子报聘回退发送短信");
// logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》" + name + ": " + mobileNo);
// // 发短信
// // ${name},您好!${name2}(S3纵队S2体系S1分部的XX)经纪人已提交报聘审批,请至“赢家平台>我的团队-报聘审批”进行查看审批,谢谢!
// String templateCode = systemConfigService.getSingleConfigValue("ALI_SMS_HiringApproveNotice");
// String content = "{\"name\":\"" + name + "\",\"hiringName\":\"" + "已回退: " + "\"}";
// sendService.sendEmailOrSMS("sms", mobileNo, "0", content, templateCode, null, null, "电子报聘审批回退", 99, basicInfoId);
// } else {
// logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》电子报聘审批人电话号码不存在");
// throw new RuntimeException("电子报聘审批人电话号码不存在");
// }
// }
}
private boolean isHasNextStep(Long loginPractitionerId, String mobileNo, Long basicInfoId, MdPractitionerHiringApproveSteps nextStep) {
// 判断是辅导人和团队长
if (!CommonUtil.isNullOrZero(loginPractitionerId)) {
......
......@@ -25,10 +25,14 @@ public class PractitionerHiringApproveRequestVO {
*/
private Integer hiringApproveStepsSeq;
/**
* 1:通过,0:驳回
* 1:通过,0:驳回(回退)
*/
private Long approvingStatus;
/**
* 回退到哪一个节点(null:报聘人, -2:辅导人, 1:体系负责人, 2:公司运营主管, 3:寿险总经理, 4:公司总经理)
*/
private String stepsSeqBackTo;
/**
* 备注,驳回原因
*/
private String rejectNote;
......@@ -141,4 +145,12 @@ public class PractitionerHiringApproveRequestVO {
public void setPractitionerId(Long practitionerId) {
this.practitionerId = practitionerId;
}
public String getStepsSeqBackTo() {
return stepsSeqBackTo;
}
public void setStepsSeqBackTo(String stepsSeqBackTo) {
this.stepsSeqBackTo = stepsSeqBackTo;
}
}
package com.yd.dal.entity.customer;
import java.util.Date;
import lombok.Data;
import java.util.Date;
/**
* 報聘经纪人報聘审批记录
*/
......@@ -74,4 +75,8 @@ public class AclPractitionerHiringApproveRecords {
private Date updatedAt;
private Long updatedBy;
/**
* 0=No, 1=Yes
*/
private Integer isBack;
}
\ No newline at end of file
......@@ -182,57 +182,59 @@ public class AgmsHiringDALServiceImpl implements AgmsHiringDALService {
// 1.3 查询审批人列表
List<PractitionerInfo> practitionerList = aclPractitionerDALService.findPractitionerInfoByMobileList(Arrays.asList(mobileNoArray));
// 2.报聘人组织关系, 姓名
StringBuilder name2 = new StringBuilder();
StringBuilder orgInfo = new StringBuilder();
String s3SubordinateSystemName = hiringMemberShip.getS3SubordinateSystemName();
String s2SubordinateSystemName = hiringMemberShip.getS2SubordinateSystemName();
String s1SubordinateSystemName = hiringMemberShip.getS1SubordinateSystemName();
boolean flag = false;
if (StringUtils.isNotEmpty(s3SubordinateSystemName)) {
name2.append(s3SubordinateSystemName);
orgInfo.append(s3SubordinateSystemName);
if (s3SubordinateSystemName.indexOf("纵队") < 0) {
name2.append("纵队");
orgInfo.append("纵队");
}
flag = true;
}
if (StringUtils.isNotEmpty(s2SubordinateSystemName)) {
name2.append(s2SubordinateSystemName);
orgInfo.append(s2SubordinateSystemName);
if (s2SubordinateSystemName.indexOf("体系") < 0) {
name2.append("体系");
orgInfo.append("体系");
}
flag = true;
}
if (StringUtils.isNotEmpty(s1SubordinateSystemName)) {
name2.append(s1SubordinateSystemName);
orgInfo.append(s1SubordinateSystemName);
if (s1SubordinateSystemName.indexOf("分部") < 0) {
name2.append("分部");
orgInfo.append("分部");
}
flag = true;
}
if (flag) {
name2.append("的");
orgInfo.append("的");
}
name2.append(basicInfo.getName());
orgInfo.append(basicInfo.getName());
// 发送短信通知下一位审批人进行审批
this.noticeSendSMS(name2.toString(), practitionerList, basicInfo);
this.noticeSendSMS(orgInfo.toString(), practitionerList, basicInfo);
// 公众号推送通知下一位审批人进行审批
this.noticeSendWeChatMsg(name2.toString(), practitionerList, basicInfo);
String firstValue = systemConfigService.getSingleConfigValue("TENCENT_WECHAT_TEMPLATE_FIRST_HIRING");
firstValue.replace("hiringName", orgInfo.toString());
this.noticeSendWeChatMsg(firstValue, "待审批", practitionerList, basicInfo);
}
private void noticeSendWeChatMsg(String hiringName, List<PractitionerInfo> practitionerList, AclPractitionerHiringBasicInfo basicInfo) {
private void noticeSendWeChatMsg(String firstValue, String noticeMsg, List<PractitionerInfo> practitionerList, AclPractitionerHiringBasicInfo basicInfo) {
// 读取数据库配置
String templateId = systemConfigService.getSingleConfigValue("TENCENT_WECHAT_TEMPLATE_ID_HIRING");
String jumpUrl = systemConfigService.getSingleConfigValue("hiringApprove_page_url");
String firstValue = systemConfigService.getSingleConfigValue("TENCENT_WECHAT_TEMPLATE_FIRST_HIRING");
// String firstValue = systemConfigService.getSingleConfigValue("TENCENT_WECHAT_TEMPLATE_FIRST_HIRING");
String remarkValue = systemConfigService.getSingleConfigValue("TENCENT_WECHAT_TEMPLATE_REMARK_HIRING");
String color = systemConfigService.getSingleConfigValue("TENCENT_WECHAT_TEMPLATE_COLOR_XB");
// 组装模板数据
TemplateDataInfo dataInfo = new TemplateDataInfo();
DataDetailInfo first = new DataDetailInfo();
DataDetailInfo keyword1 = new DataDetailInfo("待审批", color);
DataDetailInfo keyword1 = new DataDetailInfo(noticeMsg, color);
DataDetailInfo keyword2 = new DataDetailInfo(CommonUtil.dateParseString(basicInfo.getCreatedAt(),"yyyy-MM-dd HH:mm:ss"), null);
DataDetailInfo remark = new DataDetailInfo(remarkValue, null);
......@@ -253,7 +255,7 @@ public class AgmsHiringDALServiceImpl implements AgmsHiringDALService {
if (StringUtils.isNotBlank(practitionerInfo.getYdWechatOpenid())) {
sendTemplateRequest.setToUser(practitionerInfo.getYdWechatOpenid());
// 审批人姓名
first.setValue(firstValue.replace("name", practitionerInfo.getName()).replace("hiringName", hiringName));
first.setValue(firstValue.replace("name", practitionerInfo.getName()));
logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》发送微信模板消息审批人");
logger.error("【》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》" + practitionerInfo.getName());
......
......@@ -14,5 +14,7 @@ public interface AclPractitionerHiringApproveRecordsDALService {
List<AclPractitionerHiringApproveRecords> queryListByBasicInfoId(Long hiringBasicInfoId);
int deleteByHiringBasicInfoId(Long basicInfoId);
void updateBatch(List<AclPractitionerHiringApproveRecords> records);
}
......@@ -31,4 +31,9 @@ public class AclPractitionerHiringApproveRecordsDALServiceImpl implements AclPra
public int deleteByHiringBasicInfoId(Long hiringBasicInfoId) {
return mapper.deleteByHiringBasicInfoId(hiringBasicInfoId);
}
@Override
public void updateBatch(List<AclPractitionerHiringApproveRecords> records) {
mapper.updateBatch(records);
}
}
......@@ -17,12 +17,13 @@
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
<result column="is_back" jdbcType="INTEGER" property="isBack" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, hiring_basic_info_id, approve_step_id, approve_step_name, approving_practitioner_id,
approving_status, reject_note, is_active, created_at, created_by, updated_at, updated_by,
interview_assessment
interview_assessment, is_back
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
......@@ -233,6 +234,11 @@
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedAt,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="is_back = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.isBack,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="updated_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedBy,jdbcType=BIGINT}
......
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