|
@@ -1,31 +1,20 @@
|
|
|
package com.awspaas.user.apps.donenow_ctt.controller;
|
|
package com.awspaas.user.apps.donenow_ctt.controller;
|
|
|
|
|
|
|
|
import com.actionsoft.bpms.bo.engine.BO;
|
|
import com.actionsoft.bpms.bo.engine.BO;
|
|
|
-import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
|
|
|
|
|
-import com.actionsoft.bpms.commons.database.RowMap;
|
|
|
|
|
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
|
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
|
|
import com.actionsoft.bpms.server.UserContext;
|
|
import com.actionsoft.bpms.server.UserContext;
|
|
|
import com.actionsoft.bpms.server.bind.annotation.Controller;
|
|
import com.actionsoft.bpms.server.bind.annotation.Controller;
|
|
|
import com.actionsoft.bpms.server.bind.annotation.Mapping;
|
|
import com.actionsoft.bpms.server.bind.annotation.Mapping;
|
|
|
import com.actionsoft.bpms.util.DBSql;
|
|
import com.actionsoft.bpms.util.DBSql;
|
|
|
-import com.actionsoft.bpms.util.TypeUtil;
|
|
|
|
|
import com.actionsoft.sdk.local.SDK;
|
|
import com.actionsoft.sdk.local.SDK;
|
|
|
import com.actionsoft.sdk.local.api.Logger;
|
|
import com.actionsoft.sdk.local.api.Logger;
|
|
|
-import com.awspaas.user.apps.donenow_ctt.PeriodCalculationUtil;
|
|
|
|
|
import com.awspaas.user.apps.donenow_ctt.cttConstant;
|
|
import com.awspaas.user.apps.donenow_ctt.cttConstant;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
+import com.awspaas.user.apps.donenow_ctt.service.contractServiceAdj;
|
|
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
|
-import java.sql.Connection;
|
|
|
|
|
-import java.sql.SQLException;
|
|
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
-import java.time.LocalDateTime;
|
|
|
|
|
-import java.time.format.DateTimeFormatter;
|
|
|
|
|
-import java.util.Arrays;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
|
|
|
-import static com.awspaas.user.apps.donenow_ctt.PeriodCalculationUtil.*;
|
|
|
|
|
-import static com.awspaas.user.apps.donenow_ctt.service.contractService.*;
|
|
|
|
|
|
|
+import static com.awspaas.user.apps.donenow_ctt.service.contractService.LocalDateYYYYMMDD;
|
|
|
|
|
+import static com.awspaas.user.apps.donenow_ctt.service.contractService.getLocalDate;
|
|
|
|
|
|
|
|
@Controller
|
|
@Controller
|
|
|
public class contractServiceController {
|
|
public class contractServiceController {
|
|
@@ -39,56 +28,11 @@ public class contractServiceController {
|
|
|
*/
|
|
*/
|
|
|
@Mapping(value = "com.awspaas.user.apps.donenow_ctt.service_sale_adjust")
|
|
@Mapping(value = "com.awspaas.user.apps.donenow_ctt.service_sale_adjust")
|
|
|
public ResponseObject editServiceSale(UserContext uc, String serviceId) {
|
|
public ResponseObject editServiceSale(UserContext uc, String serviceId) {
|
|
|
-
|
|
|
|
|
- RowMap contractService = DBSql.getMap("SELECT * FROM BO_EU_DNCTT_CONTRACT_SERVICE_SALE_ADJUST WHERE CONTRACT_SERVICE_ID=? AND IS_EFFECTIVE='未执行' ", new Object[]{serviceId});
|
|
|
|
|
-
|
|
|
|
|
- //存在未完成的调整单,继续编辑
|
|
|
|
|
- if (contractService != null) {
|
|
|
|
|
- String processUrl = SDK.getFormAPI().getFormURL(SDK.getPortalAPI().getPortalUrl(), uc.getSessionId(), contractService.getString("BINDID"), null, 1, null, null, null, true);
|
|
|
|
|
- ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
|
|
|
- responseObject.setData(processUrl);
|
|
|
|
|
- return responseObject;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if (DBSql.getInt("SELECT count(1) CNT FROM BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD WHERE CONTRACT_SERVICE_ID=?", new Object[]{serviceId}) == 0)
|
|
if (DBSql.getInt("SELECT count(1) CNT FROM BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD WHERE CONTRACT_SERVICE_ID=?", new Object[]{serviceId}) == 0)
|
|
|
return ResponseObject.newErrResponse("请先完成未完成的合同服务");
|
|
return ResponseObject.newErrResponse("请先完成未完成的合同服务");
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- contractService = DBSql.getMap("SELECT * FROM BO_EU_DNCTT_CONTRACT_SERVICE_SALE_ADJUST WHERE CONTRACT_SERVICE_ID=? AND IS_EFFECTIVE='已执行' ORDER BY CREATEDATE DESC ", new Object[]{serviceId});
|
|
|
|
|
-
|
|
|
|
|
- String processDefId = "obj_e65c7e68c00544afb66a27848a5cba14";//销售
|
|
|
|
|
-
|
|
|
|
|
- if (contractService == null) {
|
|
|
|
|
- //初始化
|
|
|
|
|
- contractService = DBSql.getMap("SELECT * FROM BO_EU_DNCTT_CONTRACT_SERVICE WHERE ID=?", new Object[]{serviceId});
|
|
|
|
|
- contractService.remove("ID");
|
|
|
|
|
- contractService.remove("BINDID");
|
|
|
|
|
- ProcessInstance contractInstance = SDK.getProcessAPI().createBOProcessInstance(processDefId, uc.getUID(), "服务调整-" + contractService.getString("NAME") + "-初始");
|
|
|
|
|
- BO editBO = new BO();
|
|
|
|
|
- contractService.remove("CREATEDATE");
|
|
|
|
|
- contractService.remove("CREATEUSER");
|
|
|
|
|
- editBO.setAll(contractService);
|
|
|
|
|
- editBO.setBindId(contractInstance.getId());
|
|
|
|
|
- editBO.set("CONTRACT_SERVICE_ID", serviceId);
|
|
|
|
|
- editBO.set("IS_EFFECTIVE", "已执行");
|
|
|
|
|
- SDK.getBOAPI().create("BO_EU_DNCTT_CONTRACT_SERVICE_SALE_ADJUST", editBO, contractInstance, uc);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- contractService.remove("ID");
|
|
|
|
|
- contractService.remove("BINDID");
|
|
|
|
|
-
|
|
|
|
|
- //新的调整单
|
|
|
|
|
- ProcessInstance contractInstance = SDK.getProcessAPI().createBOProcessInstance(processDefId, uc.getUID(), "服务调整-" + contractService.getString("NAME") + "-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
|
|
|
|
|
- BO editBO = new BO();
|
|
|
|
|
- contractService.remove("CREATEDATE");
|
|
|
|
|
- contractService.remove("CREATEUSER");
|
|
|
|
|
- editBO.setAll(contractService);
|
|
|
|
|
- editBO.set("CONTRACT_SERVICE_ID", serviceId);
|
|
|
|
|
- editBO.setBindId(contractInstance.getId());
|
|
|
|
|
- editBO.set("IS_EFFECTIVE", "未执行");
|
|
|
|
|
- SDK.getBOAPI().create("BO_EU_DNCTT_CONTRACT_SERVICE_SALE_ADJUST", editBO, contractInstance, uc);
|
|
|
|
|
-
|
|
|
|
|
- String processUrl = SDK.getFormAPI().getFormURL(SDK.getPortalAPI().getPortalUrl(), uc.getSessionId(), contractInstance.getId(), null, 1, null, editBO.getId(), null, true);
|
|
|
|
|
|
|
+ //服务调整销售的表单地址
|
|
|
|
|
+ String processUrl = SDK.getFormAPI().getFormURL(SDK.getPortalAPI().getPortalUrl(), uc.getSessionId(), contractServiceAdj.getInstance().editServiceSale(uc, serviceId, null), null, 1, null, null, null, true);
|
|
|
|
|
|
|
|
ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
|
responseObject.setData(processUrl);
|
|
responseObject.setData(processUrl);
|
|
@@ -111,199 +55,30 @@ public class contractServiceController {
|
|
|
if (contractService.getString("IS_EFFECTIVE").equals("未执行") == false)
|
|
if (contractService.getString("IS_EFFECTIVE").equals("未执行") == false)
|
|
|
return ResponseObject.newErrResponse("请先完成未完成的调整单");
|
|
return ResponseObject.newErrResponse("请先完成未完成的调整单");
|
|
|
|
|
|
|
|
- String PERIOD_TYPE = contractService.getString("PERIOD_TYPE");
|
|
|
|
|
|
|
|
|
|
LocalDate EFFECTIVE_DATE = getLocalDate(contractService.get("EFFECTIVE_DATE"));//服务生效日期
|
|
LocalDate EFFECTIVE_DATE = getLocalDate(contractService.get("EFFECTIVE_DATE"));//服务生效日期
|
|
|
- LocalDate EFFECTIVE_END_DATE = getLocalDate(contractService.get("END_DATE"));//服务结束日期
|
|
|
|
|
|
|
|
|
|
- //合同服务
|
|
|
|
|
- BO orgContractService = SDK.getBOAPI().get("BO_EU_DNCTT_CONTRACT_SERVICE", serviceId);
|
|
|
|
|
-
|
|
|
|
|
- //生效日期之前的一次调整
|
|
|
|
|
- RowMap lastContractService = DBSql.getMap("select * from BO_EU_DNCTT_CONTRACT_SERVICE_SALE_ADJUST where CONTRACT_SERVICE_ID=? and EFFECTIVE_DATE <=? and IS_EFFECTIVE='已执行' order by EFFECTIVE_DATE desc", new Object[]{contractService.get("CONTRACT_SERVICE_ID"), LocalDateYYYYMMDD(EFFECTIVE_DATE)});
|
|
|
|
|
|
|
|
|
|
//2025年10月15日 一次性收费服务
|
|
//2025年10月15日 一次性收费服务
|
|
|
if (contractService.getString("PERIOD_TYPE").equals(cttConstant.PERIOD_TYPE_ONE_TIME)) {
|
|
if (contractService.getString("PERIOD_TYPE").equals(cttConstant.PERIOD_TYPE_ONE_TIME)) {
|
|
|
|
|
|
|
|
//有审批通过的;
|
|
//有审批通过的;
|
|
|
- if (DBSql.getInt("SELECT count(1) FROM BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD WHERE APPROVE_AND_POST_USER_ID IS NOT NULL AND LENGTH(APPROVE_AND_POST_USER_ID)>1 AND APPROVE_AND_POST_DATE IS NOT NULL and CONTRACT_SERVICE_ID=? ", new Object[]{contractService.get("CONTRACT_SERVICE_ID")}) > 0) {
|
|
|
|
|
|
|
+ if (DBSql.getInt("SELECT count(1) FROM BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD WHERE APPROVE_AND_POST_USER_ID IS NOT NULL AND LENGTH(APPROVE_AND_POST_USER_ID)>1 AND APPROVE_AND_POST_DATE IS NOT NULL and CONTRACT_SERVICE_ID=? ", new Object[]{serviceId}) > 0) {
|
|
|
return ResponseObject.newErrResponse("服务已审批不能再进行调整");
|
|
return ResponseObject.newErrResponse("服务已审批不能再进行调整");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
//生效日期之后有审批通过的;
|
|
//生效日期之后有审批通过的;
|
|
|
- if (DBSql.getInt("SELECT count(1) FROM BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD WHERE APPROVE_AND_POST_USER_ID IS NOT NULL AND LENGTH(APPROVE_AND_POST_USER_ID)>1 AND APPROVE_AND_POST_DATE IS NOT NULL and CONTRACT_SERVICE_ID=? AND PERIOD_END_DATE>=?", new Object[]{contractService.get("CONTRACT_SERVICE_ID"), LocalDateYYYYMMDD(EFFECTIVE_DATE)}) > 0) {
|
|
|
|
|
|
|
+ if (DBSql.getInt("SELECT count(1) FROM BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD WHERE APPROVE_AND_POST_USER_ID IS NOT NULL AND LENGTH(APPROVE_AND_POST_USER_ID)>1 AND APPROVE_AND_POST_DATE IS NOT NULL and CONTRACT_SERVICE_ID=? AND PERIOD_END_DATE>=?", new Object[]{serviceId, LocalDateYYYYMMDD(EFFECTIVE_DATE)}) > 0) {
|
|
|
return ResponseObject.newErrResponse("生效日期之后的合同服务已经进行审批!");
|
|
return ResponseObject.newErrResponse("生效日期之后的合同服务已经进行审批!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Connection conn = null;
|
|
|
|
|
- try {
|
|
|
|
|
- conn = DBSql.open();
|
|
|
|
|
- conn.setAutoCommit(false);
|
|
|
|
|
-
|
|
|
|
|
- //生效日期之后的服务周期删除
|
|
|
|
|
- DBSql.update(conn, "DELETE FROM BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD_BUNDLE_SERVICE WHERE CONTRACT_SERVICE_PERIOD_ID IN (SELECT ID FROM BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD WHERE CONTRACT_SERVICE_ID =? AND PERIOD_BEGIN_DATE >=?)", new Object[]{contractService.get("CONTRACT_SERVICE_ID"), LocalDateYYYYMMDD(EFFECTIVE_DATE)});
|
|
|
|
|
-
|
|
|
|
|
- DBSql.update(conn, "DELETE FROM BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD WHERE CONTRACT_SERVICE_ID=? AND PERIOD_BEGIN_DATE>=?", new Object[]{contractService.get("CONTRACT_SERVICE_ID"), LocalDateYYYYMMDD(EFFECTIVE_DATE)});
|
|
|
|
|
-
|
|
|
|
|
- //如果生效日期之后有服务周期
|
|
|
|
|
- String lastPeriodId = DBSql.getString(conn, "SELECT ID FROM BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD WHERE CONTRACT_SERVICE_ID=? AND PERIOD_END_DATE >=? ORDER BY PERIOD_BEGIN_DATE ASC ", new Object[]{contractService.get("CONTRACT_SERVICE_ID"), LocalDateYYYYMMDD(EFFECTIVE_DATE)});
|
|
|
|
|
-
|
|
|
|
|
- BigDecimal SERVICE_UNIT_PRICE = null;
|
|
|
|
|
- BigDecimal SERVICE_TOTAL_PRICE = null;
|
|
|
|
|
-
|
|
|
|
|
- boolean teshuchuli = false;//需要特殊处理
|
|
|
|
|
- BigDecimal PRICE_1STMONTH = null;
|
|
|
|
|
- String teshuchuliBeginDate = null;
|
|
|
|
|
- if (StringUtils.isNotBlank(lastPeriodId)) {
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //首月+12月为第一周期的情况
|
|
|
|
|
- if (contractService.get("CALC_METHOD_1STPERIOD").equals("4591")) {
|
|
|
|
|
-
|
|
|
|
|
- //获取第一笔
|
|
|
|
|
- RowMap firstContractService = DBSql.getMap("select * from BO_EU_DNCTT_CONTRACT_SERVICE_SALE_ADJUST where CONTRACT_SERVICE_ID=? and IS_EFFECTIVE='已执行' order by EFFECTIVE_DATE ASC", new Object[]{contractService.get("CONTRACT_SERVICE_ID")});
|
|
|
|
|
-
|
|
|
|
|
- LocalDate firstEFFECTIVE_DATE = getLocalDate(firstContractService.get("EFFECTIVE_DATE"));
|
|
|
|
|
-
|
|
|
|
|
- if (firstEFFECTIVE_DATE.getYear() == EFFECTIVE_DATE.getYear() && firstEFFECTIVE_DATE.getMonth() == EFFECTIVE_DATE.getMonth()) {
|
|
|
|
|
- teshuchuli = true;
|
|
|
|
|
- teshuchuliBeginDate = LocalDateYYYYMMDD(EFFECTIVE_DATE);
|
|
|
|
|
-
|
|
|
|
|
- SERVICE_UNIT_PRICE = TypeUtil.convert(contractService.get("UNIT_PRICE_1STMONTH"), BigDecimal.class);
|
|
|
|
|
- SERVICE_TOTAL_PRICE = multiply(SERVICE_UNIT_PRICE, contractService.get("QUANTITY"));
|
|
|
|
|
- SERVICE_TOTAL_PRICE = multiply(SERVICE_TOTAL_PRICE, 12);
|
|
|
|
|
|
|
+ if (contractServiceAdj.getInstance().execServiceSaleAdj(uc, boId))
|
|
|
|
|
|
|
|
- BigDecimal periodRate = PeriodCalculationUtil.divideToBigDecimal(getDateRate(EFFECTIVE_DATE, EFFECTIVE_DATE.plusMonths(1).withDayOfMonth(1).minusDays(1), false), GetPeriodMonth(contractService.getString("PERIOD_TYPE")));
|
|
|
|
|
|
|
+ return ResponseObject.newOkResponse();
|
|
|
|
|
|
|
|
- PRICE_1STMONTH = SERVICE_TOTAL_PRICE.multiply(periodRate);
|
|
|
|
|
-
|
|
|
|
|
- EFFECTIVE_DATE = EFFECTIVE_DATE.plusMonths(1).withDayOfMonth(1);//下个月1号
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //需要使用首月单价
|
|
|
|
|
- if (teshuchuli) {
|
|
|
|
|
- SERVICE_UNIT_PRICE = TypeUtil.convert(lastContractService.get("UNIT_PRICE_1STMONTH"), BigDecimal.class);
|
|
|
|
|
- SERVICE_TOTAL_PRICE = multiply(SERVICE_UNIT_PRICE, lastContractService.get("QUANTITY"));
|
|
|
|
|
- SERVICE_TOTAL_PRICE = multiply(SERVICE_TOTAL_PRICE, 12);
|
|
|
|
|
- } else {
|
|
|
|
|
- //正常处理
|
|
|
|
|
- SERVICE_UNIT_PRICE = TypeUtil.convert(lastContractService.get("UNIT_PRICE"), BigDecimal.class);
|
|
|
|
|
- SERVICE_TOTAL_PRICE = multiply(SERVICE_UNIT_PRICE, lastContractService.get("QUANTITY"));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- BO lastServicePeriod = SDK.getBOAPI().get("BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD", lastPeriodId);
|
|
|
|
|
-
|
|
|
|
|
- LocalDate last_period_begin_date = getLocalDate(lastServicePeriod.get("PERIOD_BEGIN_DATE"));
|
|
|
|
|
-
|
|
|
|
|
- lastServicePeriod.set("PERIOD_END_DATE", EFFECTIVE_DATE.minusDays(1));
|
|
|
|
|
-
|
|
|
|
|
- BigDecimal periodRate = PeriodCalculationUtil.divideToBigDecimal(getDateRate(last_period_begin_date, EFFECTIVE_DATE.minusDays(1), false), GetPeriodMonth(lastContractService.getString("PERIOD_TYPE")));
|
|
|
|
|
-
|
|
|
|
|
- lastServicePeriod.set("PERIOD_PRICE", multiply(SERVICE_TOTAL_PRICE, periodRate));
|
|
|
|
|
- lastServicePeriod.set("PARTYA_PERIOD_PRICE", multiply(lastContractService.get("PARTYA_TOTAL_PRICE"), periodRate));
|
|
|
|
|
- lastServicePeriod.set("PERIOD_ADJUSTED_PRICE", lastServicePeriod.get("PERIOD_PRICE"));
|
|
|
|
|
- SDK.getBOAPI().update("BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD", lastServicePeriod, conn);
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //获取服务周期
|
|
|
|
|
- List<PeriodCalculationUtil.Period> periodList = PeriodCalculationUtil.getPeriodListByConfig(PERIOD_TYPE, EFFECTIVE_DATE, EFFECTIVE_DATE, EFFECTIVE_END_DATE, contractService.getString("CALC_METHOD_1STPERIOD"), "4638", contractService.getString("MONTH_1STQUARTER"));
|
|
|
|
|
-
|
|
|
|
|
- SERVICE_UNIT_PRICE = TypeUtil.convert(contractService.get("UNIT_PRICE"), BigDecimal.class);
|
|
|
|
|
-
|
|
|
|
|
- SERVICE_TOTAL_PRICE = multiply(SERVICE_UNIT_PRICE, contractService.get("QUANTITY"));
|
|
|
|
|
-
|
|
|
|
|
- String vendor_account_id = DBSql.getString(conn, "select VENDOR_ACCOUNT_ID from BO_EU_DNIVT_SERVICE where ID=?", new Object[]{orgContractService.getString("OBJECT_ID")});//供应商账号
|
|
|
|
|
-
|
|
|
|
|
- if (periodList != null && periodList.size() > 0) {
|
|
|
|
|
-
|
|
|
|
|
- List<String> sbsList = null;
|
|
|
|
|
- String serviceIds = DBSql.getString("select SERVICE_ID from BO_EU_DNIVT_SERVICE_BUNDLE where ID=?", new Object[]{orgContractService.get("OBJECT_ID")});
|
|
|
|
|
- if (StringUtils.isNotBlank(serviceIds)) {
|
|
|
|
|
- sbsList = Arrays.asList(serviceIds.split(","));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- int i = 0;
|
|
|
|
|
- for (PeriodCalculationUtil.Period period : periodList) {
|
|
|
|
|
- i++;
|
|
|
|
|
- BO csp = new BO();//服务周期
|
|
|
|
|
- csp.set("CONTRACT_ID", orgContractService.get("CONTRACT_ID"));
|
|
|
|
|
- csp.set("OBJECT_ID", orgContractService.get("OBJECT_ID"));
|
|
|
|
|
- csp.set("OBJECT_TYPE", orgContractService.get("OBJECT_TYPE"));
|
|
|
|
|
- csp.set("CONTRACT_SERVICE_ID", orgContractService.get("ID"));
|
|
|
|
|
-
|
|
|
|
|
- csp.set("PERIOD_BEGIN_DATE", period.getPeriodBeginDateStr());
|
|
|
|
|
- csp.set("PERIOD_END_DATE", period.getPeriodEndDateStr());
|
|
|
|
|
- csp.set("QUANTITY", lastContractService.get("QUANTITY"));
|
|
|
|
|
-
|
|
|
|
|
- //第一条
|
|
|
|
|
- if (teshuchuli && i == 1) {
|
|
|
|
|
- csp.set("PERIOD_PRICE", period.getRate().multiply(SERVICE_TOTAL_PRICE).add(PRICE_1STMONTH));
|
|
|
|
|
- csp.set("PERIOD_BEGIN_DATE", teshuchuliBeginDate);
|
|
|
|
|
- } else {
|
|
|
|
|
- csp.set("PERIOD_PRICE", period.getRate().multiply(SERVICE_TOTAL_PRICE));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- csp.set("PERIOD_ADJUSTED_PRICE", csp.get("PERIOD_PRICE"));
|
|
|
|
|
- csp.set("PARTYA_PERIOD_PRICE", multiply(lastContractService.get("PARTYA_TOTAL_PRICE"), period.getRate()));//三方合同甲方含税总价
|
|
|
|
|
-
|
|
|
|
|
- csp.set("VENDOR_ACCOUNT_ID", vendor_account_id);
|
|
|
|
|
- csp.setBindId(orgContractService.getString("BINDID"));
|
|
|
|
|
- SDK.getBOAPI().createDataBO("BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD", csp, uc, conn);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if (orgContractService.getString("OBJECT_TYPE").equals("2"))//服务包
|
|
|
|
|
- {
|
|
|
|
|
- //本周期成本
|
|
|
|
|
- String prorated_cost_change = DBSql.getString(conn, "select UNIT_COST from BO_EU_DNIVT_SERVICE where ID=?", new Object[]{orgContractService.getString("OBJECT_ID")});//供应商账号
|
|
|
|
|
- if (sbsList != null) {
|
|
|
|
|
- for (String sbs : sbsList) {
|
|
|
|
|
- BO cspbs = new BO();
|
|
|
|
|
- cspbs.set("CONTRACT_SERVICE_PERIOD_ID", csp.getId());
|
|
|
|
|
- cspbs.set("SERVICE_ID", sbs);
|
|
|
|
|
- cspbs.set("VENDOR_ACCOUNT_ID", vendor_account_id);
|
|
|
|
|
- cspbs.set("PERIOD_COST", prorated_cost_change);
|
|
|
|
|
- cspbs.setBindId(orgContractService.getString("BINDID"));
|
|
|
|
|
- SDK.getBOAPI().createDataBO("BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD_BUNDLE_SERVICE", cspbs, uc, conn);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- contractService.set("IS_EFFECTIVE", "已执行");
|
|
|
|
|
- SDK.getBOAPI().update("BO_EU_DNCTT_CONTRACT_SERVICE_SALE_ADJUST", contractService, conn);
|
|
|
|
|
- DBSql.update(conn, "update BO_EU_DNCTT_CONTRACT_SERVICE_SALE_ADJUST set IS_EFFECTIVE='作废' where CONTRACT_SERVICE_ID=? and EFFECTIVE_DATE >?", new Object[]{contractService.get("CONTRACT_SERVICE_ID"), LocalDateYYYYMMDD(EFFECTIVE_DATE)});
|
|
|
|
|
-
|
|
|
|
|
- orgContractService.set("END_DATE", contractService.get("END_DATE"));
|
|
|
|
|
- orgContractService.set("UNIT_PRICE", contractService.get("UNIT_PRICE"));
|
|
|
|
|
- orgContractService.set("TOTAL_PRICE", contractService.get("TOTAL_PRICE"));
|
|
|
|
|
- orgContractService.set("QUANTITY", contractService.get("QUANTITY"));
|
|
|
|
|
- orgContractService.set("PERIOD_TYPE", contractService.get("PERIOD_TYPE"));
|
|
|
|
|
- orgContractService.set("CALC_METHOD_1STPERIOD", contractService.get("CALC_METHOD_1STPERIOD"));
|
|
|
|
|
- orgContractService.set("MONTH_1STQUARTER", contractService.get("MONTH_1STQUARTER"));
|
|
|
|
|
- SDK.getBOAPI().update("BO_EU_DNCTT_CONTRACT_SERVICE", orgContractService, conn);
|
|
|
|
|
-
|
|
|
|
|
- conn.commit();
|
|
|
|
|
- } catch (SQLException e) {
|
|
|
|
|
-
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- try {
|
|
|
|
|
- conn.rollback();
|
|
|
|
|
- } catch (SQLException e1) {
|
|
|
|
|
- e1.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- } finally {
|
|
|
|
|
- if (conn != null)
|
|
|
|
|
- DBSql.close(conn);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return ResponseObject.newOkResponse();
|
|
|
|
|
|
|
+ return ResponseObject.newErrResponse("失败");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -314,56 +89,11 @@ public class contractServiceController {
|
|
|
*/
|
|
*/
|
|
|
@Mapping(value = "com.awspaas.user.apps.donenow_ctt.service_purchase_adjust")
|
|
@Mapping(value = "com.awspaas.user.apps.donenow_ctt.service_purchase_adjust")
|
|
|
public ResponseObject editServicePurchase(UserContext uc, String serviceId) {
|
|
public ResponseObject editServicePurchase(UserContext uc, String serviceId) {
|
|
|
-
|
|
|
|
|
- RowMap contractService = DBSql.getMap("SELECT * FROM BO_EU_DNCTT_CONTRACT_SERVICE_PURCHASE_ADJUST WHERE CONTRACT_SERVICE_ID=? AND IS_EFFECTIVE='未执行' ", new Object[]{serviceId});
|
|
|
|
|
-
|
|
|
|
|
- //存在未完成的调整单,继续编辑
|
|
|
|
|
- if (contractService != null) {
|
|
|
|
|
- String processUrl = SDK.getFormAPI().getFormURL(SDK.getPortalAPI().getPortalUrl(), uc.getSessionId(), contractService.getString("BINDID"), null, 1, null, null, null, true);
|
|
|
|
|
- ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
|
|
|
- responseObject.setData(processUrl);
|
|
|
|
|
- return responseObject;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if (DBSql.getInt("select count(1) CNT from BO_EU_DNIVT_ORDER_PAYMENT_PLAN where CONTRACT_SERVICE_ID=? ", new Object[]{serviceId}) == 0) {
|
|
if (DBSql.getInt("select count(1) CNT from BO_EU_DNIVT_ORDER_PAYMENT_PLAN where CONTRACT_SERVICE_ID=? ", new Object[]{serviceId}) == 0) {
|
|
|
return ResponseObject.newErrResponse("请先生成该合同服务下的所有付款计划");
|
|
return ResponseObject.newErrResponse("请先生成该合同服务下的所有付款计划");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- contractService = DBSql.getMap("SELECT * FROM BO_EU_DNCTT_CONTRACT_SERVICE_PURCHASE_ADJUST WHERE CONTRACT_SERVICE_ID=? AND IS_EFFECTIVE='已执行' ORDER BY CREATEDATE DESC ", new Object[]{serviceId});
|
|
|
|
|
-
|
|
|
|
|
- String processDefId = "obj_b147ad05008546058736a06bc6205313";//采购
|
|
|
|
|
-
|
|
|
|
|
- if (contractService == null) {
|
|
|
|
|
- //初始化
|
|
|
|
|
- contractService = DBSql.getMap("SELECT * FROM BO_EU_DNCTT_CONTRACT_SERVICE WHERE ID=?", new Object[]{serviceId});
|
|
|
|
|
- contractService.remove("ID");
|
|
|
|
|
- contractService.remove("BINDID");
|
|
|
|
|
- ProcessInstance contractInstance = SDK.getProcessAPI().createBOProcessInstance(processDefId, uc.getUID(), "服务调整-" + contractService.getString("NAME") + "-初始");
|
|
|
|
|
- BO editBO = new BO();
|
|
|
|
|
- contractService.remove("CREATEDATE");
|
|
|
|
|
- contractService.remove("CREATEUSER");
|
|
|
|
|
- editBO.setAll(contractService);
|
|
|
|
|
- editBO.setBindId(contractInstance.getId());
|
|
|
|
|
- editBO.set("CONTRACT_SERVICE_ID", serviceId);
|
|
|
|
|
- editBO.set("IS_EFFECTIVE", "已执行");
|
|
|
|
|
- SDK.getBOAPI().create("BO_EU_DNCTT_CONTRACT_SERVICE_PURCHASE_ADJUST", editBO, contractInstance, uc);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- contractService.remove("ID");
|
|
|
|
|
- contractService.remove("BINDID");
|
|
|
|
|
-
|
|
|
|
|
- //新的调整单
|
|
|
|
|
- ProcessInstance contractInstance = SDK.getProcessAPI().createBOProcessInstance(processDefId, uc.getUID(), "服务调整-" + contractService.getString("NAME") + "-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
|
|
|
|
|
- BO editBO = new BO();
|
|
|
|
|
- contractService.remove("CREATEDATE");
|
|
|
|
|
- contractService.remove("CREATEUSER");
|
|
|
|
|
- editBO.setAll(contractService);
|
|
|
|
|
- editBO.set("CONTRACT_SERVICE_ID", serviceId);
|
|
|
|
|
- editBO.setBindId(contractInstance.getId());
|
|
|
|
|
- editBO.set("IS_EFFECTIVE", "未执行");
|
|
|
|
|
- SDK.getBOAPI().create("BO_EU_DNCTT_CONTRACT_SERVICE_PURCHASE_ADJUST", editBO, contractInstance, uc);
|
|
|
|
|
-
|
|
|
|
|
- String processUrl = SDK.getFormAPI().getFormURL(SDK.getPortalAPI().getPortalUrl(), uc.getSessionId(), contractInstance.getId(), null, 1, null, editBO.getId(), null, true);
|
|
|
|
|
|
|
+ String processUrl = SDK.getFormAPI().getFormURL(SDK.getPortalAPI().getPortalUrl(), uc.getSessionId(), contractServiceAdj.getInstance().editServicePurchase(uc, serviceId, null), null, 1, null, null, null, true);
|
|
|
|
|
|
|
|
ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
|
responseObject.setData(processUrl);
|
|
responseObject.setData(processUrl);
|
|
@@ -380,6 +110,9 @@ public class contractServiceController {
|
|
|
*/
|
|
*/
|
|
|
@Mapping(value = "com.awspaas.user.apps.donenow_ctt.service_purchase_execAdjust")
|
|
@Mapping(value = "com.awspaas.user.apps.donenow_ctt.service_purchase_execAdjust")
|
|
|
public ResponseObject execServicePurchaseAdj(UserContext uc, String boId, String serviceId) {
|
|
public ResponseObject execServicePurchaseAdj(UserContext uc, String boId, String serviceId) {
|
|
|
|
|
+ contractLogger.info("执行合同服务调整--采购");
|
|
|
|
|
+ contractLogger.info("boId:" + boId);
|
|
|
|
|
+ contractLogger.info("serviceId:" + serviceId);
|
|
|
|
|
|
|
|
//调整 服务
|
|
//调整 服务
|
|
|
BO contractService = SDK.getBOAPI().get("BO_EU_DNCTT_CONTRACT_SERVICE_PURCHASE_ADJUST", boId);
|
|
BO contractService = SDK.getBOAPI().get("BO_EU_DNCTT_CONTRACT_SERVICE_PURCHASE_ADJUST", boId);
|
|
@@ -387,160 +120,16 @@ public class contractServiceController {
|
|
|
if (contractService.getString("IS_EFFECTIVE").equals("未执行") == false)
|
|
if (contractService.getString("IS_EFFECTIVE").equals("未执行") == false)
|
|
|
return ResponseObject.newErrResponse("请先完成未完成的调整单");
|
|
return ResponseObject.newErrResponse("请先完成未完成的调整单");
|
|
|
|
|
|
|
|
- String PERIOD_TYPE = contractService.getString("PURCHASE_PERIOD_TYPE");
|
|
|
|
|
-
|
|
|
|
|
LocalDate EFFECTIVE_DATE = getLocalDate(contractService.get("PURCHASE_START_DATE"));//服务生效日期
|
|
LocalDate EFFECTIVE_DATE = getLocalDate(contractService.get("PURCHASE_START_DATE"));//服务生效日期
|
|
|
- LocalDate EFFECTIVE_END_DATE = getLocalDate(contractService.get("PURCHASE_END_DATE"));//服务结束日期
|
|
|
|
|
-
|
|
|
|
|
- //合同服务
|
|
|
|
|
- BO orgContractService = SDK.getBOAPI().get("BO_EU_DNCTT_CONTRACT_SERVICE", serviceId);
|
|
|
|
|
-
|
|
|
|
|
- //生效日期之前的一次调整
|
|
|
|
|
- RowMap lastContractService = DBSql.getMap("select * from BO_EU_DNCTT_CONTRACT_SERVICE_PURCHASE_ADJUST where CONTRACT_SERVICE_ID=? and PURCHASE_START_DATE <=? and IS_EFFECTIVE='已执行' order by PURCHASE_START_DATE desc", new Object[]{contractService.get("CONTRACT_SERVICE_ID"), LocalDateYYYYMMDD(EFFECTIVE_DATE)});
|
|
|
|
|
|
|
|
|
|
- //2025年10月15日 一次性收费服务
|
|
|
|
|
- if (DBSql.getInt("select count(1) CNT from BO_EU_DNIVT_ORDER_PAYMENT_PLAN where CONTRACT_SERVICE_ID=? and PERIOD_END_DATE >=? and PLAN_AMOUNT<>0 and PLAN_AMOUNT is not NULL ", new Object[]{contractService.get("CONTRACT_SERVICE_ID"), LocalDateYYYYMMDD(EFFECTIVE_DATE)}) > 0) {
|
|
|
|
|
|
|
+ if (DBSql.getInt("select count(1) CNT from BO_EU_DNIVT_ORDER_PAYMENT_PLAN where CONTRACT_SERVICE_ID=? and PERIOD_END_DATE >=? and PAY_AMOUNT<>0 and PAY_AMOUNT is not NULL ", new Object[]{contractService.get("CONTRACT_SERVICE_ID"), LocalDateYYYYMMDD(EFFECTIVE_DATE)}) > 0) {
|
|
|
return ResponseObject.newErrResponse("生效日期之后,已经进行支付,不能改到当前日期");
|
|
return ResponseObject.newErrResponse("生效日期之后,已经进行支付,不能改到当前日期");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Connection conn = null;
|
|
|
|
|
- try {
|
|
|
|
|
- conn = DBSql.open();
|
|
|
|
|
- conn.setAutoCommit(false);
|
|
|
|
|
-
|
|
|
|
|
- //生效日期之后的服务周期删除
|
|
|
|
|
- DBSql.update(conn, "DELETE FROM BO_EU_DNIVT_ORDER_PAYMENT_PLAN WHERE CONTRACT_SERVICE_ID=? and PERIOD_BEGIN_DATE >=? and (PLAN_AMOUNT=0 or PLAN_AMOUNT is NULL)", new Object[]{contractService.get("CONTRACT_SERVICE_ID"), LocalDateYYYYMMDD(EFFECTIVE_DATE)});
|
|
|
|
|
-
|
|
|
|
|
- String lastPeriodId = DBSql.getString(conn, "select ID from BO_EU_DNIVT_ORDER_PAYMENT_PLAN where CONTRACT_SERVICE_ID=? and PERIOD_END_DATE >=? order by PERIOD_BEGIN_DATE asc", new Object[]{contractService.get("CONTRACT_SERVICE_ID"), LocalDateYYYYMMDD(EFFECTIVE_DATE)});
|
|
|
|
|
-
|
|
|
|
|
- BigDecimal SERVICE_UNIT_COST = null;
|
|
|
|
|
- BigDecimal SERVICE_TOTAL_COST = null;
|
|
|
|
|
-
|
|
|
|
|
- boolean teshuchuli = false;
|
|
|
|
|
- String teshuchuliBeginDate = null;
|
|
|
|
|
- BigDecimal COST_1STMONTH = null;
|
|
|
|
|
- if (StringUtils.isNotBlank(lastPeriodId)) {
|
|
|
|
|
-
|
|
|
|
|
- //首月+12月为第一周期的情况
|
|
|
|
|
- if (contractService.get("PURCHASE_CALC_METHOD_1STPERIOD").equals("4591")) {
|
|
|
|
|
-
|
|
|
|
|
- //获取第一笔
|
|
|
|
|
- RowMap firstContractService = DBSql.getMap("select * from BO_EU_DNCTT_CONTRACT_SERVICE_PURCHASE_ADJUST where CONTRACT_SERVICE_ID=? and IS_EFFECTIVE='已执行' order by PURCHASE_START_DATE ASC", new Object[]{contractService.get("CONTRACT_SERVICE_ID")});
|
|
|
|
|
-
|
|
|
|
|
- LocalDate firstEFFECTIVE_DATE = getLocalDate(firstContractService.get("EFFECTIVE_DATE"));
|
|
|
|
|
-
|
|
|
|
|
- if (firstEFFECTIVE_DATE.getYear() == EFFECTIVE_DATE.getYear() && firstEFFECTIVE_DATE.getMonth() == EFFECTIVE_DATE.getMonth()) {
|
|
|
|
|
- teshuchuli = true;
|
|
|
|
|
- teshuchuliBeginDate = LocalDateYYYYMMDD(EFFECTIVE_DATE);
|
|
|
|
|
-
|
|
|
|
|
- SERVICE_UNIT_COST = TypeUtil.convert(contractService.get("UNIT_COST_1STMONTH"), BigDecimal.class);
|
|
|
|
|
- SERVICE_TOTAL_COST = multiply(SERVICE_UNIT_COST, contractService.get("QUANTITY"));
|
|
|
|
|
- SERVICE_TOTAL_COST = multiply(SERVICE_TOTAL_COST, 12);
|
|
|
|
|
|
|
|
|
|
- BigDecimal periodRate = PeriodCalculationUtil.divideToBigDecimal(getDateRate(EFFECTIVE_DATE, EFFECTIVE_DATE.plusMonths(1).withDayOfMonth(1).minusDays(1), false), GetPeriodMonth(contractService.getString("PURCHASE_PERIOD_TYPE")));
|
|
|
|
|
-
|
|
|
|
|
- COST_1STMONTH = SERVICE_TOTAL_COST.multiply(periodRate);
|
|
|
|
|
-
|
|
|
|
|
- EFFECTIVE_DATE = EFFECTIVE_DATE.plusMonths(1).withDayOfMonth(1);//下个月1号
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 首月单独计费
|
|
|
|
|
-
|
|
|
|
|
- if (teshuchuli) {
|
|
|
|
|
- SERVICE_UNIT_COST = TypeUtil.convert(lastContractService.get("UNIT_COST_1STMONTH"), BigDecimal.class);
|
|
|
|
|
- SERVICE_TOTAL_COST = multiply(SERVICE_UNIT_COST, lastContractService.get("QUANTITY"));
|
|
|
|
|
- SERVICE_TOTAL_COST = multiply(SERVICE_TOTAL_COST, 12);
|
|
|
|
|
- } else {
|
|
|
|
|
- SERVICE_UNIT_COST = TypeUtil.convert(lastContractService.get("UNIT_COST"), BigDecimal.class);
|
|
|
|
|
- SERVICE_TOTAL_COST = multiply(SERVICE_UNIT_COST, lastContractService.get("QUANTITY"));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- BO lastServicePeriod = SDK.getBOAPI().get("BO_EU_DNIVT_ORDER_PAYMENT_PLAN", lastPeriodId);
|
|
|
|
|
-
|
|
|
|
|
- LocalDate last_period_begin_date = getLocalDate(lastServicePeriod.get("PERIOD_BEGIN_DATE"));
|
|
|
|
|
-
|
|
|
|
|
- lastServicePeriod.set("PERIOD_END_DATE", EFFECTIVE_DATE.minusDays(1));
|
|
|
|
|
-
|
|
|
|
|
- BigDecimal periodRate = PeriodCalculationUtil.divideToBigDecimal(getDateRate(last_period_begin_date, EFFECTIVE_DATE.minusDays(1), false), GetPeriodMonth(lastContractService.getString("PURCHASE_PERIOD_TYPE")));
|
|
|
|
|
-
|
|
|
|
|
- lastServicePeriod.set("PLAN_AMOUNT", multiply(SERVICE_TOTAL_COST, periodRate));
|
|
|
|
|
- lastServicePeriod.set("REMAIN_AMOUNT", lastServicePeriod.get("PLAN_AMOUNT"));
|
|
|
|
|
- SDK.getBOAPI().update("BO_EU_DNIVT_ORDER_PAYMENT_PLAN", lastServicePeriod, conn);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //获取服务周期
|
|
|
|
|
- List<PeriodCalculationUtil.Period> periodList = PeriodCalculationUtil.getPeriodListByConfig(PERIOD_TYPE, EFFECTIVE_DATE, EFFECTIVE_DATE, EFFECTIVE_END_DATE, contractService.getString("PURCHASE_CALC_METHOD_1STPERIOD"), "4638", contractService.getString("MONTH_1STQUARTER"));
|
|
|
|
|
-
|
|
|
|
|
- SERVICE_UNIT_COST = TypeUtil.convert(contractService.get("UNIT_COST"), BigDecimal.class);
|
|
|
|
|
-
|
|
|
|
|
- SERVICE_TOTAL_COST = multiply(SERVICE_UNIT_COST, contractService.get("QUANTITY"));
|
|
|
|
|
- RowMap costProduct = DBSql.getMap("select * from BO_EU_DNIVT_ORDER_PRODUCT where CONTRACT_SERVICE_ID=?", new Object[]{contractService.get("CONTRACT_SERVICE_ID")});
|
|
|
|
|
-
|
|
|
|
|
- String orderId = costProduct.getString("ORDER_ID");
|
|
|
|
|
- String CONTRACT_COST_ID = costProduct.getString("CONTRACT_COST_ID");
|
|
|
|
|
- String VENDOR_ACCOUNT_ID = DBSql.getString("select VENDOR_ACCOUNT_ID from BO_EU_DNIVT_ORDER where ID=?", new Object[]{orderId});//供应商账户ID
|
|
|
|
|
- if (periodList != null && periodList.size() > 0) {
|
|
|
|
|
-
|
|
|
|
|
- int i = 0;
|
|
|
|
|
- for (PeriodCalculationUtil.Period period : periodList) {
|
|
|
|
|
- i++;
|
|
|
|
|
- ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_5cb4ae4a42944fd0a9a284ff4c64c65d", uc.getUID(), "付款计划");
|
|
|
|
|
- BO paymentPlan = new BO();
|
|
|
|
|
- paymentPlan.setBindId(processInstance.getId());
|
|
|
|
|
- paymentPlan.set("ORDER_ID", orderId);
|
|
|
|
|
- paymentPlan.set("PLAN_DATE", period.getPeriodBeginDateStr());
|
|
|
|
|
- paymentPlan.set("PERIOD_BEGIN_DATE", period.getPeriodBeginDateStr());
|
|
|
|
|
- paymentPlan.set("PERIOD_END_DATE", period.getPeriodEndDateStr());
|
|
|
|
|
-
|
|
|
|
|
- if (teshuchuli && i == 1) {
|
|
|
|
|
- paymentPlan.set("PLAN_AMOUNT", SERVICE_TOTAL_COST.multiply(period.getRate()).add(COST_1STMONTH));
|
|
|
|
|
- paymentPlan.set("PLAN_DATE", teshuchuliBeginDate);
|
|
|
|
|
- paymentPlan.set("PERIOD_BEGIN_DATE", teshuchuliBeginDate);
|
|
|
|
|
- } else {
|
|
|
|
|
- paymentPlan.set("PLAN_AMOUNT", SERVICE_TOTAL_COST.multiply(period.getRate()));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- paymentPlan.set("REMAIN_AMOUNT", paymentPlan.get("PLAN_AMOUNT"));
|
|
|
|
|
- paymentPlan.set("CONTRACT_COST_ID", CONTRACT_COST_ID);
|
|
|
|
|
- paymentPlan.set("CONTRACT_SERVICE_ID", orgContractService.getId());
|
|
|
|
|
- paymentPlan.set("PAY_DESC", orgContractService.getString("NAME"));
|
|
|
|
|
- paymentPlan.set("ACCOUNT_PAYEE", VENDOR_ACCOUNT_ID);//收款单位
|
|
|
|
|
- SDK.getBOAPI().create("BO_EU_DNIVT_ORDER_PAYMENT_PLAN", paymentPlan, processInstance, uc);
|
|
|
|
|
-
|
|
|
|
|
- System.out.println("==== 创建付款计划:" + paymentPlan.get("PLAN_DATE") + ",金额:" + paymentPlan.get("PLAN_AMOUNT") + " ====");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- contractService.set("IS_EFFECTIVE", "已执行");
|
|
|
|
|
- SDK.getBOAPI().update("BO_EU_DNCTT_CONTRACT_SERVICE_PURCHASE_ADJUST", contractService, conn);
|
|
|
|
|
- DBSql.update(conn, "update BO_EU_DNCTT_CONTRACT_SERVICE_PURCHASE_ADJUST set IS_EFFECTIVE='作废' where CONTRACT_SERVICE_ID=? and EFFECTIVE_DATE >?", new Object[]{contractService.get("CONTRACT_SERVICE_ID"), LocalDateYYYYMMDD(EFFECTIVE_DATE)});
|
|
|
|
|
-
|
|
|
|
|
- orgContractService.set("UNIT_COST", contractService.get("UNIT_COST"));
|
|
|
|
|
- orgContractService.set("TOTAL_COST", contractService.get("TOTAL_COST"));
|
|
|
|
|
- orgContractService.set("QUANTITY", contractService.get("QUANTITY"));
|
|
|
|
|
- orgContractService.set("PURCHASE_CALC_METHOD_1STPERIOD", contractService.get("PURCHASE_CALC_METHOD_1STPERIOD"));
|
|
|
|
|
- orgContractService.set("MONTH_1STQUARTER", contractService.get("MONTH_1STQUARTER"));
|
|
|
|
|
- orgContractService.set("PURCHASE_PERIOD_TYPE", contractService.get("PURCHASE_PERIOD_TYPE"));
|
|
|
|
|
- orgContractService.set("PURCHASE_END_DATE", contractService.get("PURCHASE_END_DATE"));
|
|
|
|
|
- SDK.getBOAPI().update("BO_EU_DNCTT_CONTRACT_SERVICE", orgContractService, conn);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- conn.commit();
|
|
|
|
|
- } catch (SQLException e) {
|
|
|
|
|
-
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- try {
|
|
|
|
|
- conn.rollback();
|
|
|
|
|
- } catch (SQLException e1) {
|
|
|
|
|
- e1.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- } finally {
|
|
|
|
|
- if (conn != null)
|
|
|
|
|
- DBSql.close(conn);
|
|
|
|
|
|
|
+ if (contractServiceAdj.getInstance().execServicePurchaseAdj(uc, boId)) {
|
|
|
|
|
+ return ResponseObject.newOkResponse();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
return ResponseObject.newOkResponse();
|
|
return ResponseObject.newOkResponse();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|