|
|
@@ -3,7 +3,9 @@ package com.zhongshu.card.server.core.service.paySetting;
|
|
|
import com.github.microservice.net.ResultContent;
|
|
|
import com.github.microservice.types.payment.PaymentType;
|
|
|
import com.zhongshu.card.client.model.paySetting.paySetting.*;
|
|
|
+import com.zhongshu.card.client.type.paySetting.RegularType;
|
|
|
import com.zhongshu.card.client.type.paySetting.SettlementRulesType;
|
|
|
+import com.zhongshu.card.client.utils.DateUtils;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
|
import com.zhongshu.card.server.core.dao.projectAbout.PayShareListDao;
|
|
|
import com.zhongshu.card.server.core.dao.projectAbout.ProjectMainPaySettingDao;
|
|
|
@@ -24,6 +26,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -164,6 +167,44 @@ public class ProjectMainPaySettingService extends SuperService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 得到结算定时任务的结算时间
|
|
|
+ *
|
|
|
+ * @param projectOid
|
|
|
+ * @param paymentType
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Long getCurrentRunTime(String projectOid, PaymentType paymentType) {
|
|
|
+ Long time = System.currentTimeMillis();
|
|
|
+ if (StringUtils.isNotEmpty(projectOid) && paymentType != null) {
|
|
|
+ ProjectMainPaySetting entity = getProjectMainPaySetting(projectOid, paymentType);
|
|
|
+ if (ObjectUtils.isNotEmpty(entity)) {
|
|
|
+ SettlementRulesType settlementRulesType = entity.getSettlementRulesType();
|
|
|
+ if (settlementRulesType == SettlementRulesType.Dn) {
|
|
|
+ // 结算N天前的
|
|
|
+ Integer days = entity.getDays();
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ c.setTimeInMillis(System.currentTimeMillis());
|
|
|
+ c.add(Calendar.DATE, days * -1);
|
|
|
+ time = c.getTimeInMillis();
|
|
|
+ } else if (settlementRulesType == SettlementRulesType.Regular) {
|
|
|
+ RegularType regularType = entity.getRegularType();
|
|
|
+ if (regularType == RegularType.Day) {
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ c.setTimeInMillis(System.currentTimeMillis());
|
|
|
+ c.add(Calendar.DATE, -1);
|
|
|
+ time = c.getTimeInMillis();
|
|
|
+ } else if (regularType == RegularType.Week) {
|
|
|
+ time = DateUtils.getPreWeekLastTime();
|
|
|
+ } else if (regularType == RegularType.Month) {
|
|
|
+ time = DateUtils.getPreMonthLastTime();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return time;
|
|
|
+ }
|
|
|
+
|
|
|
//---------------------------项目上的灵活 分账配置 start -----------------------
|
|
|
|
|
|
/**
|