|
|
|
|
@ -24,8 +24,10 @@ import org.dromara.oa.erp.domain.bo.ErpContractChangeSaveBo;
|
|
|
|
|
import org.dromara.oa.erp.domain.vo.*;
|
|
|
|
|
import org.dromara.oa.erp.mapper.*;
|
|
|
|
|
import org.dromara.oa.erp.service.IErpContractChangeService;
|
|
|
|
|
import org.dromara.system.api.RemoteCodeRuleService;
|
|
|
|
|
|
|
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
@ -49,8 +51,13 @@ public class ErpContractChangeServiceImpl implements IErpContractChangeService {
|
|
|
|
|
private final ErpContractMaterialMapper contractMaterialMapper;
|
|
|
|
|
private final ErpContractPaymentMethodMapper contractPaymentMethodMapper;
|
|
|
|
|
|
|
|
|
|
/** 合同变更流程编码(审批通过后回写用) */
|
|
|
|
|
@DubboReference
|
|
|
|
|
private RemoteCodeRuleService remoteCodeRuleService;
|
|
|
|
|
|
|
|
|
|
/** 合同变更流程编码 */
|
|
|
|
|
public static final String FLOW_CODE_CONTRACT_CHANGE = "HTBG";
|
|
|
|
|
/** 变更编号编码规则 */
|
|
|
|
|
private static final String CONTRACT_CHANGE_CODE_RULE = "1021";
|
|
|
|
|
|
|
|
|
|
/** 变更类型:1内容变更 2解除合同 */
|
|
|
|
|
private static final String CHANGE_TYPE_CONTENT = "1";
|
|
|
|
|
@ -201,8 +208,13 @@ public class ErpContractChangeServiceImpl implements IErpContractChangeService {
|
|
|
|
|
deleteChangeSubByChangeId(main.getContractChangeId());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (StringUtils.isBlank(main.getChangeCode())) {
|
|
|
|
|
String changeCode = remoteCodeRuleService.selectCodeRuleCode(CONTRACT_CHANGE_CODE_RULE);
|
|
|
|
|
main.setChangeCode(changeCode);
|
|
|
|
|
}
|
|
|
|
|
baseMapper.insert(main);
|
|
|
|
|
bo.setContractChangeId(main.getContractChangeId());
|
|
|
|
|
bo.setChangeCode(main.getChangeCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CHANGE_TYPE_CONTENT.equals(bo.getChangeType())) {
|
|
|
|
|
@ -366,7 +378,7 @@ public class ErpContractChangeServiceImpl implements IErpContractChangeService {
|
|
|
|
|
contract.setBusinessDirection(snap.getBusinessDirection());
|
|
|
|
|
contract.setContractDeptId(snap.getContractDeptId());
|
|
|
|
|
contract.setContractDate(snap.getContractDate());
|
|
|
|
|
contract.setTotalPrice(toBigDecimal(snap.getTotalPrice()));
|
|
|
|
|
contract.setTotalPrice(snap.getTotalPrice());
|
|
|
|
|
contract.setOneCustomerId(snap.getOneCustomerId());
|
|
|
|
|
contract.setOneRepresent(snap.getOneRepresent());
|
|
|
|
|
contract.setOneDate(snap.getOneDate());
|
|
|
|
|
@ -388,7 +400,7 @@ public class ErpContractChangeServiceImpl implements IErpContractChangeService {
|
|
|
|
|
contract.setWarrantyPeriodDescription(snap.getWarrantyPeriodDescription());
|
|
|
|
|
contract.setDeliveryLocation(snap.getDeliveryLocation());
|
|
|
|
|
contract.setShipMethod(snap.getShipMethod());
|
|
|
|
|
contract.setTaxRate(toBigDecimal(snap.getTaxRate()));
|
|
|
|
|
contract.setTaxRate(snap.getTaxRate());
|
|
|
|
|
contract.setSigningPlace(snap.getSigningPlace());
|
|
|
|
|
contract.setMaterialRemark(snap.getMaterialRemark());
|
|
|
|
|
contract.setContractTemplateFlag(snap.getContractTemplateFlag());
|
|
|
|
|
@ -409,38 +421,28 @@ public class ErpContractChangeServiceImpl implements IErpContractChangeService {
|
|
|
|
|
cm.setUnitId(m.getUnitId());
|
|
|
|
|
cm.setRemark(m.getRemark());
|
|
|
|
|
cm.setActiveFlag(StringUtils.isNotBlank(m.getActiveFlag()) ? m.getActiveFlag() : "1");
|
|
|
|
|
cm.setAmount(toBigDecimal(m.getAmount()));
|
|
|
|
|
cm.setBeforePrice(toBigDecimal(m.getBeforePrice()));
|
|
|
|
|
cm.setTaxRate(toBigDecimal(m.getTaxRate()));
|
|
|
|
|
cm.setIncludingPrice(toBigDecimal(m.getIncludingPrice()));
|
|
|
|
|
cm.setSubtotal(toBigDecimal(m.getSubtotal()));
|
|
|
|
|
cm.setAmount(m.getAmount());
|
|
|
|
|
cm.setBeforePrice(m.getBeforePrice());
|
|
|
|
|
cm.setTaxRate(m.getTaxRate());
|
|
|
|
|
cm.setIncludingPrice(m.getIncludingPrice());
|
|
|
|
|
cm.setSubtotal(m.getSubtotal());
|
|
|
|
|
return cm;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 变更付款方式快照转合同付款方式(回写),兼容 Long/Number 与 BigDecimal */
|
|
|
|
|
/** 变更付款方式快照转合同付款方式(回写) */
|
|
|
|
|
private ErpContractPaymentMethod copyChangePaymentToContract(ErpContractChangePaymentMethod p, Long contractId) {
|
|
|
|
|
ErpContractPaymentMethod cpm = new ErpContractPaymentMethod();
|
|
|
|
|
cpm.setContractId(contractId);
|
|
|
|
|
cpm.setPaymentMethodId(null);
|
|
|
|
|
cpm.setSortOrder(p.getSortOrder());
|
|
|
|
|
cpm.setPaymentStageId(p.getPaymentStageId());
|
|
|
|
|
cpm.setPaymentDeadline(toBigDecimal(p.getPaymentDeadline()));
|
|
|
|
|
cpm.setPaymentPercentage(toBigDecimal(p.getPaymentPercentage()));
|
|
|
|
|
cpm.setInvoicePercentage(toBigDecimal(p.getInvoicePercentage()));
|
|
|
|
|
cpm.setPaymentAmount(toBigDecimal(p.getPaymentAmount()));
|
|
|
|
|
cpm.setPaymentDeadline(p.getPaymentDeadline());
|
|
|
|
|
cpm.setPaymentPercentage(p.getPaymentPercentage());
|
|
|
|
|
cpm.setInvoicePercentage(p.getInvoicePercentage());
|
|
|
|
|
cpm.setPaymentAmount(p.getPaymentAmount());
|
|
|
|
|
cpm.setPaymentDescription(p.getPaymentDescription());
|
|
|
|
|
cpm.setRemark(p.getRemark());
|
|
|
|
|
cpm.setActiveFlag(StringUtils.isNotBlank(p.getActiveFlag()) ? p.getActiveFlag() : "1");
|
|
|
|
|
return cpm;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static BigDecimal toBigDecimal(Number n) {
|
|
|
|
|
if (n == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (n instanceof BigDecimal) {
|
|
|
|
|
return (BigDecimal) n;
|
|
|
|
|
}
|
|
|
|
|
return BigDecimal.valueOf(n.doubleValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|