|
@@ -19,8 +19,6 @@ import com.citu.module.menduner.system.dal.dataobject.job.JobAdvertisedDO;
|
|
|
import com.citu.module.menduner.system.dal.dataobject.job.JobCvRelDO;
|
|
|
import com.citu.module.menduner.system.dal.mysql.interview.InterviewInviteMapper;
|
|
|
import com.citu.module.menduner.system.dal.mysql.job.JobAdvertisedMapper;
|
|
|
-import com.citu.module.menduner.system.enums.MathOperationEnum;
|
|
|
-import com.citu.module.menduner.system.enums.account.BalanceBizTypeEnum;
|
|
|
import com.citu.module.menduner.system.enums.cv.ConversationStatusEnum;
|
|
|
import com.citu.module.menduner.system.enums.interview.InterviewInviteStatusEnum;
|
|
|
import com.citu.module.menduner.system.service.enterprise.bind.EnterpriseUserBindService;
|
|
@@ -65,6 +63,26 @@ public class InterviewInviteServiceImpl implements InterviewInviteService {
|
|
|
@Resource
|
|
|
private JobAdvertisedMapper jobAdvertisedMapper;
|
|
|
|
|
|
+ /**
|
|
|
+ * 计算佣金
|
|
|
+ *
|
|
|
+ * @param hirePrice 职位价格
|
|
|
+ * @param rate 比例
|
|
|
+ * @param totalRate 总比例
|
|
|
+ * @return 佣金
|
|
|
+ **/
|
|
|
+ public static Long calculateCommission(Long hirePrice, BigDecimal rate, BigDecimal totalRate) {
|
|
|
+ // 将hirePrice转换为BigDecimal
|
|
|
+ BigDecimal hirePriceBD = BigDecimal.valueOf(hirePrice);
|
|
|
+
|
|
|
+ // 计算佣金
|
|
|
+ // 使用 (hirePrice * rate + totalRate / 2) / totalRate 来确保四舍五入
|
|
|
+ BigDecimal commission = hirePriceBD.multiply(rate).add(totalRate.divide(BigDecimal.valueOf(2), 0, RoundingMode.HALF_UP)).divide(totalRate, 0, RoundingMode.HALF_UP);
|
|
|
+
|
|
|
+ // 将结果转换为Long类型
|
|
|
+ return commission.longValue();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Long createInterviewInvite(InterviewInviteSaveReqVO createReqVO) {
|
|
|
// 插入
|
|
@@ -109,7 +127,6 @@ public class InterviewInviteServiceImpl implements InterviewInviteService {
|
|
|
return mapper.selectPage(pageReqVO);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
@DSTransactional
|
|
|
public void consent(AppRecruitInterviewInviteReqConsentVO reqVO) {
|
|
@@ -264,34 +281,35 @@ public class InterviewInviteServiceImpl implements InterviewInviteService {
|
|
|
@Override
|
|
|
@DSTransactional
|
|
|
public void settlement(Long id) {
|
|
|
-
|
|
|
- InterviewInviteDO interviewInvite = validateInterviewInviteExists(id);
|
|
|
-
|
|
|
- checkStatusIsCompleted(interviewInvite);
|
|
|
-
|
|
|
- if (!interviewInvite.getConversationStatus()
|
|
|
- .equals(ConversationStatusEnum.ENTRY.getStatus())) {
|
|
|
- // 不是已入职状态
|
|
|
- throw exception(INTERVIEW_INVITE_STATUS_NOT_ENTRY);
|
|
|
- }
|
|
|
- // 标记为结算
|
|
|
- interviewInvite.setConversationStatus(ConversationStatusEnum.SETTLEMENT.getStatus());
|
|
|
- mapper.updateById(interviewInvite);
|
|
|
-
|
|
|
- // 获取 面试的求职者投递的简历信息
|
|
|
- JobCvRelDO cv = jobCvRelService
|
|
|
- .selectByUserIdAndJobId(interviewInvite.getUserId(), interviewInvite.getJobId());
|
|
|
-
|
|
|
- // 猎头、 推荐人、投递人
|
|
|
- // 获取比例配置
|
|
|
- HireCommissionRatioDO ratio = ratioService.get();
|
|
|
-
|
|
|
- JobAdvertisedDO job = jobAdvertisedMapper.selectById(cv.getJobId());
|
|
|
-
|
|
|
- if (null != job.getHirePrice()) {
|
|
|
- // 余额结算
|
|
|
- priceSettlement(job, ratio, cv);
|
|
|
- }
|
|
|
+ throw exception(INTERVIEW_INVITE_STATUS_NOT_SETTLEMENT);
|
|
|
+
|
|
|
+// InterviewInviteDO interviewInvite = validateInterviewInviteExists(id);
|
|
|
+//
|
|
|
+// checkStatusIsCompleted(interviewInvite);
|
|
|
+//
|
|
|
+// if (!interviewInvite.getConversationStatus()
|
|
|
+// .equals(ConversationStatusEnum.ENTRY.getStatus())) {
|
|
|
+// // 不是已入职状态
|
|
|
+// throw exception(INTERVIEW_INVITE_STATUS_NOT_ENTRY);
|
|
|
+// }
|
|
|
+// // 标记为结算
|
|
|
+// interviewInvite.setConversationStatus(ConversationStatusEnum.SETTLEMENT.getStatus());
|
|
|
+// mapper.updateById(interviewInvite);
|
|
|
+//
|
|
|
+// // 获取 面试的求职者投递的简历信息
|
|
|
+// JobCvRelDO cv = jobCvRelService
|
|
|
+// .selectByUserIdAndJobId(interviewInvite.getUserId(), interviewInvite.getJobId());
|
|
|
+//
|
|
|
+// // 猎头、 推荐人、投递人
|
|
|
+// // 获取比例配置
|
|
|
+// HireCommissionRatioDO ratio = ratioService.get();
|
|
|
+//
|
|
|
+// JobAdvertisedDO job = jobAdvertisedMapper.selectById(cv.getJobId());
|
|
|
+//
|
|
|
+// if (null != job.getHirePrice()) {
|
|
|
+// // 余额结算
|
|
|
+// priceSettlement(job, ratio, cv);
|
|
|
+// }
|
|
|
|
|
|
//TODO 发送推送消息
|
|
|
}
|
|
@@ -308,11 +326,11 @@ public class InterviewInviteServiceImpl implements InterviewInviteService {
|
|
|
// 总比例
|
|
|
BigDecimal totalRate = BigDecimal.valueOf(100);
|
|
|
// 猎头佣金
|
|
|
- Long headhuntPrice = calculateCommission(hirePrice, ratio.getHeadhuntRate(), totalRate);
|
|
|
+ Long headhuntPrice = calculateCommission(hirePrice, ratio.getHeadhuntRate(), totalRate);
|
|
|
// 推荐人佣金
|
|
|
Long recommendPrice = calculateCommission(hirePrice, ratio.getRecommendRate(), totalRate);
|
|
|
// 投递人佣金
|
|
|
- Long cvPrice =calculateCommission(hirePrice, ratio.getCvRate(), totalRate);
|
|
|
+ Long cvPrice = calculateCommission(hirePrice, ratio.getCvRate(), totalRate);
|
|
|
|
|
|
// 猎头 (平台自己)
|
|
|
if (headhuntPrice > 0) {
|
|
@@ -364,24 +382,4 @@ public class InterviewInviteServiceImpl implements InterviewInviteService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 计算佣金
|
|
|
- *
|
|
|
- * @param hirePrice 职位价格
|
|
|
- * @param rate 比例
|
|
|
- * @param totalRate 总比例
|
|
|
- * @return 佣金
|
|
|
- **/
|
|
|
- public static Long calculateCommission(Long hirePrice, BigDecimal rate, BigDecimal totalRate) {
|
|
|
- // 将hirePrice转换为BigDecimal
|
|
|
- BigDecimal hirePriceBD = BigDecimal.valueOf(hirePrice);
|
|
|
-
|
|
|
- // 计算佣金
|
|
|
- // 使用 (hirePrice * rate + totalRate / 2) / totalRate 来确保四舍五入
|
|
|
- BigDecimal commission = hirePriceBD.multiply(rate).add(totalRate.divide(BigDecimal.valueOf(2), 0, RoundingMode.HALF_UP)).divide(totalRate, 0, RoundingMode.HALF_UP);
|
|
|
-
|
|
|
- // 将结果转换为Long类型
|
|
|
- return commission.longValue();
|
|
|
- }
|
|
|
-
|
|
|
}
|