|
@@ -16,6 +16,7 @@ import com.citu.module.system.api.mail.dto.MailSendSingleToUserReqDTO;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -39,6 +40,8 @@ public class EnterpriseEmailNoticeTask {
|
|
|
@Resource
|
|
|
private MailSendApi mailSendApi;
|
|
|
|
|
|
+ private static final Integer JOB_NUM = 3;
|
|
|
+
|
|
|
@DSTransactional
|
|
|
public void sendEmailNotice() {
|
|
|
// 获取企业邮箱通知开关状态
|
|
@@ -60,7 +63,7 @@ public class EnterpriseEmailNoticeTask {
|
|
|
}
|
|
|
if (null == enterprise.getBizFlag() || !enterprise.getBizFlag()) {
|
|
|
// 没有发送过就发送邮件
|
|
|
- sendEmail(mapList);
|
|
|
+ sendEmail(mapList,enterprise);
|
|
|
enterprise.setBizFlag(true);
|
|
|
enterpriseMapper.updateById(enterprise);
|
|
|
|
|
@@ -68,7 +71,7 @@ public class EnterpriseEmailNoticeTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void sendEmail(List<EnterpriseUserBindDO> mapList) {
|
|
|
+ private void sendEmail(List<EnterpriseUserBindDO> mapList,EnterpriseDO enterprise) {
|
|
|
for (EnterpriseUserBindDO userBindDO : mapList) {
|
|
|
// 发送邮件
|
|
|
if (null == userBindDO.getEmail()) {
|
|
@@ -80,22 +83,25 @@ public class EnterpriseEmailNoticeTask {
|
|
|
|
|
|
MailSendSingleToUserReqDTO reqDTO = new MailSendSingleToUserReqDTO();
|
|
|
reqDTO.setMail(userBindDO.getEmail());
|
|
|
- reqDTO.setTemplateCode(CommonConstants.EMAIL_ENTERPRISE_INIT_PASSWORD);
|
|
|
- reqDTO.setTemplateParams(MapUtil.builder("password", (Object) userBindDO.getEmail()).build());
|
|
|
+ reqDTO.setTemplateCode(CommonConstants.EMAIL_ENTERPRISE_PUBLISH_JOB_QUOTA);
|
|
|
+ Map<String, Object> templateParamMap=new HashMap<>();
|
|
|
+ templateParamMap.put("enterpriseName",enterprise.getName());
|
|
|
+ templateParamMap.put("jobNum",JOB_NUM);
|
|
|
+ reqDTO.setTemplateParams(templateParamMap);
|
|
|
mailSendApi.sendSingleMailToMember(reqDTO).getCheckedData();
|
|
|
|
|
|
// 增加额度
|
|
|
EnterpriseEntitlementRespVO entitlement =
|
|
|
enterpriseEntitlementService.getByEnterpriseIdAndUserId(userBindDO.getEnterpriseId(), userBindDO.getUserId());
|
|
|
|
|
|
- if (entitlement.getPublishJobCount() <= 3) {
|
|
|
+ if (entitlement.getPublishJobCount() <= JOB_NUM) {
|
|
|
// 小于等于3不做处理,同时规避已经加过发布数量的情况
|
|
|
return;
|
|
|
}
|
|
|
// 设置为三个发布职位额度
|
|
|
enterpriseEntitlementService.update(EnterpriseEntitlementDO.builder()
|
|
|
.id(entitlement.getId())
|
|
|
- .publishJobCount(3)
|
|
|
+ .publishJobCount(JOB_NUM)
|
|
|
.build());
|
|
|
|
|
|
}
|