|
@@ -254,10 +254,36 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
|
|
expenseInfo.setStatusFlag(StatusEnum.COST_PAYMENT.getFlag());
|
|
expenseInfo.setStatusFlag(StatusEnum.COST_PAYMENT.getFlag());
|
|
expenseInfo.setStatus(StatusEnum.COST_PAYMENT.getName());
|
|
expenseInfo.setStatus(StatusEnum.COST_PAYMENT.getName());
|
|
//库点费用未分配金额默认等于费用金额
|
|
//库点费用未分配金额默认等于费用金额
|
|
- if(!"1".equals(expenseInfo.getCostType())&&!!"1".equals(expenseInfo.getExpensesPurpose())) {
|
|
|
|
|
|
+ if(!"1".equals(expenseInfo.getCostType())&&!"1".equals(expenseInfo.getExpensesPurpose())) {
|
|
expenseInfo.setUnallocatedAmount(expenseInfo.getAmountMoney());
|
|
expenseInfo.setUnallocatedAmount(expenseInfo.getAmountMoney());
|
|
}
|
|
}
|
|
this.insert(expenseInfo);
|
|
this.insert(expenseInfo);
|
|
|
|
+ //合同粮款校验
|
|
|
|
+ if("1".equals(expenseInfo.getCostType())&&"1".equals(expenseInfo.getExpensesPurpose())) {
|
|
|
|
+ ContractManagementInfo contractManagementInfo=contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
|
|
|
|
+ .eq("contract_no",expenseInfo.getContractNo())
|
|
|
|
+ .eq("comp_id",expenseInfo.getCompId()));
|
|
|
|
+ if(contractManagementInfo!=null){
|
|
|
|
+ if (contractManagementInfo.getUnitContractPrice()!=null){
|
|
|
|
+ //合同总粮款
|
|
|
|
+ Double grainFund=contractManagementInfo.getUnitContractPrice()*contractManagementInfo.getWeight();
|
|
|
|
+ //合同已请粮款金额
|
|
|
|
+ Double money=0d;
|
|
|
|
+ List<ExpenseInfo> expenseInfoList=this.selectList(new EntityWrapper<ExpenseInfo>()
|
|
|
|
+ .eq("contract_no",expenseInfo.getContractNo())
|
|
|
|
+ .ne("status","已驳回")
|
|
|
|
+ .eq("comp_id",expenseInfo.getCompId()));
|
|
|
|
+ if (!CollectionUtils.isEmpty(expenseInfoList)){
|
|
|
|
+ money = expenseInfoList.stream().mapToDouble(ExpenseInfo::getAmountMoney).sum();
|
|
|
|
+ }
|
|
|
|
+ //本次金额加上已请款金额>总粮款时
|
|
|
|
+ if (money+expenseInfo.getAmountMoney()>grainFund){
|
|
|
|
+ throw new YException(YExceptionEnum.AMOUNT_EXCEEDS__ERROR);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
//分配列表
|
|
//分配列表
|
|
List<ExpenseAllocationInfo> expenseAllocationInfoList = expenseInfo.getExpenseAllocationInfoList();
|
|
List<ExpenseAllocationInfo> expenseAllocationInfoList = expenseInfo.getExpenseAllocationInfoList();
|
|
if (!CollectionUtils.isEmpty(expenseAllocationInfoList)) {
|
|
if (!CollectionUtils.isEmpty(expenseAllocationInfoList)) {
|
|
@@ -469,6 +495,32 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
|
|
else if ("4".equals(expenseInfo.getFlag())){
|
|
else if ("4".equals(expenseInfo.getFlag())){
|
|
expenseInfo.setStatusFlag(StatusEnum.COST_RECEIVED.getFlag());
|
|
expenseInfo.setStatusFlag(StatusEnum.COST_RECEIVED.getFlag());
|
|
expenseInfo.setStatus(StatusEnum.COST_RECEIVED.getName());
|
|
expenseInfo.setStatus(StatusEnum.COST_RECEIVED.getName());
|
|
|
|
+ //合同粮款校验
|
|
|
|
+ if("1".equals(expenseInfo1.getCostType())&&"1".equals(expenseInfo1.getExpensesPurpose())) {
|
|
|
|
+ ContractManagementInfo contractManagementInfo=contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
|
|
|
|
+ .eq("contract_no",expenseInfo1.getContractNo())
|
|
|
|
+ .eq("comp_id",expenseInfo1.getCompId()));
|
|
|
|
+ if(contractManagementInfo!=null){
|
|
|
|
+ if (contractManagementInfo.getUnitContractPrice()!=null){
|
|
|
|
+ //合同总粮款
|
|
|
|
+ Double grainFund=contractManagementInfo.getUnitContractPrice()*contractManagementInfo.getWeight();
|
|
|
|
+ //合同已请粮款金额
|
|
|
|
+ Double money=0d;
|
|
|
|
+ List<ExpenseInfo> expenseInfoList=this.selectList(new EntityWrapper<ExpenseInfo>()
|
|
|
|
+ .eq("contract_no",expenseInfo1.getContractNo())
|
|
|
|
+ .ne("status","已驳回")
|
|
|
|
+ .eq("comp_id",expenseInfo1.getCompId()));
|
|
|
|
+ if (!CollectionUtils.isEmpty(expenseInfoList)){
|
|
|
|
+ money = expenseInfoList.stream().mapToDouble(ExpenseInfo::getAmountMoney).sum();
|
|
|
|
+ }
|
|
|
|
+ //本次金额加上已请款金额>总粮款时
|
|
|
|
+ if (money+expenseInfo.getAmountMoney()>grainFund){
|
|
|
|
+ throw new YException(YExceptionEnum.AMOUNT_EXCEEDS__ERROR);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
boolean isStartWorkflow = StringUtils.isBlank(expenseInfo.getWorkflowId());
|
|
boolean isStartWorkflow = StringUtils.isBlank(expenseInfo.getWorkflowId());
|
|
// 不是退回的单子
|
|
// 不是退回的单子
|
|
if (isStartWorkflow) {
|
|
if (isStartWorkflow) {
|