|
@@ -19,9 +19,11 @@ import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
|
|
import kd.bos.servicehelper.user.UserServiceHelper;
|
|
|
import kd.bos.util.StringUtils;
|
|
|
+import nckd.jimin.jyyy.fi.common.ReimAmountSourceTypeEnum;
|
|
|
import nckd.jimin.jyyy.fi.common.constant.BillTypeConstants;
|
|
|
import nckd.jimin.jyyy.fi.common.util.CommonUtils;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -41,12 +43,11 @@ public class PersonReimYearQuotaCopyTask extends AbstractTask implements StopTas
|
|
|
* @param map
|
|
|
*/
|
|
|
protected void copyYearData(Map<String, Object> map){
|
|
|
- logger.info("PersonReimYearCopyTask_begin");
|
|
|
+ logger.info("PersonReimYearCopyTask_begin------------");
|
|
|
int year = getYear(map);
|
|
|
|
|
|
// 复制的到第二年
|
|
|
int copyYear = year + 1;
|
|
|
-
|
|
|
// 查询去年的个人额度信息
|
|
|
|
|
|
List<Object> copyDataId = QueryServiceHelper.query(BillTypeConstants.ER_REIMBURSEAMOUNT, "id", new QFilter[]{
|
|
@@ -62,7 +63,7 @@ public class PersonReimYearQuotaCopyTask extends AbstractTask implements StopTas
|
|
|
// 查询已经生成的数据
|
|
|
Set<Object> hasCreateIdSet = QueryServiceHelper.query(BillTypeConstants.ER_REIMBURSEAMOUNT, "nckd_sourcebillid", new QFilter[]{
|
|
|
new QFilter("dateyear", QCP.equals, String.valueOf(copyYear)),
|
|
|
- new QFilter("nckd_sourcetype", QCP.equals, "yearcopy"),
|
|
|
+ new QFilter("nckd_sourcetype", QCP.equals, ReimAmountSourceTypeEnum.YEARCOPY.getValue()),
|
|
|
new QFilter("nckd_sourcebillid", QCP.in, patchIdList),
|
|
|
}).stream().map(r -> r.get("nckd_sourcebillid")).collect(Collectors.toSet());
|
|
|
|
|
@@ -88,19 +89,20 @@ public class PersonReimYearQuotaCopyTask extends AbstractTask implements StopTas
|
|
|
|
|
|
Date now = new Date();
|
|
|
long currentUserId = UserServiceHelper.getCurrentUserId();
|
|
|
+ // 获取12月的个人额度,创建新年额度
|
|
|
+ BigDecimal quatoAmount = reimburseQuota.getBigDecimal("month12");
|
|
|
+
|
|
|
DynamicObject remiQuota = BusinessDataServiceHelper.newDynamicObject(BillTypeConstants.ER_REIMBURSEAMOUNT);
|
|
|
remiQuota.set("company", reimburseQuota.get("company"));
|
|
|
remiQuota.set("expenseitem", reimburseQuota.get("expenseitem"));
|
|
|
remiQuota.set("currency", reimburseQuota.get("currency"));
|
|
|
remiQuota.set("dateyear", dateYear);
|
|
|
- remiQuota.set("totalamount", reimburseQuota.get("totalamount"));
|
|
|
+
|
|
|
+ remiQuota.set("totalamount", quatoAmount.multiply(BigDecimal.valueOf(12L)));
|
|
|
remiQuota.set("costcompany", reimburseQuota.get("costcompany"));
|
|
|
|
|
|
for(int i = 1; i <= 12; i++) {
|
|
|
- remiQuota.set("month" + i, reimburseQuota.get("month" + i));
|
|
|
- if (i <= 4) {
|
|
|
- remiQuota.set("quarter" + i, reimburseQuota.get("quarter" + i));
|
|
|
- }
|
|
|
+ remiQuota.set("month" + i, quatoAmount);
|
|
|
}
|
|
|
|
|
|
remiQuota.set("amounttype", "1");
|
|
@@ -113,7 +115,7 @@ public class PersonReimYearQuotaCopyTask extends AbstractTask implements StopTas
|
|
|
remiQuota.set("modifier", currentUserId);
|
|
|
remiQuota.set("wbsrcbilltype", "er_reimctl_new");
|
|
|
|
|
|
- remiQuota.set("nckd_sourcetype", "yearcopy");
|
|
|
+ remiQuota.set("nckd_sourcetype", ReimAmountSourceTypeEnum.YEARCOPY.getValue());
|
|
|
remiQuota.set("nckd_sourcebillid", reimburseQuota.getPkValue());
|
|
|
|
|
|
// 调用保存
|
|
@@ -138,7 +140,7 @@ public class PersonReimYearQuotaCopyTask extends AbstractTask implements StopTas
|
|
|
return Integer.parseInt(map.get(YEAR).toString());
|
|
|
}
|
|
|
// 第二年执行前一年的数据
|
|
|
- return Calendar.getInstance().get(Calendar.YEAR)-1;
|
|
|
+ return Calendar.getInstance().get(Calendar.YEAR);
|
|
|
}
|
|
|
|
|
|
}
|