|
|
@ -2,14 +2,21 @@ package com.ruoyi.financial.service.impl; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import com.ruoyi.common.core.redis.RedisCache; |
|
|
|
import com.ruoyi.common.exception.BusinessException; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
import com.ruoyi.purchase.domain.PurchaseOrder; |
|
|
|
import com.ruoyi.purchase.mapper.PurchaseOrderMapper; |
|
|
|
import com.ruoyi.system.domain.OutsourceOrder; |
|
|
|
import com.ruoyi.system.domain.OutsourceOrderDetail; |
|
|
|
import com.ruoyi.system.domain.SysSupplier; |
|
|
|
import com.ruoyi.system.domain.Vo.OutsourceOrderVO; |
|
|
|
import com.ruoyi.system.mapper.OutsourceOrderDetailMapper; |
|
|
|
import com.ruoyi.system.mapper.OutsourceOrderMapper; |
|
|
|
import com.ruoyi.system.mapper.SysSupplierMapper; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -40,6 +47,12 @@ public class FinancialAccountsPayableServiceImpl implements IFinancialAccountsPa |
|
|
|
@Autowired |
|
|
|
private PurchaseOrderMapper purchaseOrderMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private OutsourceOrderMapper outsourceOrderMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private OutsourceOrderDetailMapper outOrderDetailMapper; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询财务应付账款 |
|
|
|
* |
|
|
@ -197,6 +210,49 @@ public class FinancialAccountsPayableServiceImpl implements IFinancialAccountsPa |
|
|
|
throw new BusinessException("关联采购订单更新失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
else if(relatedCode.startsWith("WW")){ |
|
|
|
OutsourceOrder outsourceOrder = outsourceOrderMapper.selectOutsourceOrderByNo(relatedCode); |
|
|
|
String supplierCode = payable.getSupplierCode();; |
|
|
|
OutsourceOrderDetail tempDetail = new OutsourceOrderDetail(); |
|
|
|
tempDetail.setOutsourceOrderNo(relatedCode); |
|
|
|
tempDetail.setSupplierCode(supplierCode); |
|
|
|
List<OutsourceOrderDetail> orderDetails = outOrderDetailMapper.selectOutsourceOrderDetailList(tempDetail); |
|
|
|
if(StringUtils.isEmpty(orderDetails)){ |
|
|
|
throw new BusinessException("关联委外订单详情为空!"); |
|
|
|
} |
|
|
|
List<OutsourceOrderDetail> filtDetails = orderDetails.stream() |
|
|
|
.filter(item -> item.getSupplierCode().equals(supplierCode)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
for (OutsourceOrderDetail detail: filtDetails) { |
|
|
|
detail.setClosedStatus("3"); |
|
|
|
detail.setRemitStatus("3");//待结案
|
|
|
|
detail.setUpdateBy(ShiroUtils.getLoginName()); |
|
|
|
detail.setUpdateTime(DateUtils.getNowDate()); |
|
|
|
int updateResult = outOrderDetailMapper.updateOutsourceOrderDetail(detail); |
|
|
|
if(updateResult <= 0 ){ |
|
|
|
throw new BusinessException("关联委外订单详情更新失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
/*更新关联委外订单结案状态*/ |
|
|
|
boolean allToClose = true; |
|
|
|
for (OutsourceOrderDetail detail: filtDetails) { |
|
|
|
if(!detail.getRemitStatus().equals("2")&&!detail.getRemitStatus().equals("3")){ |
|
|
|
allToClose = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if(allToClose){ |
|
|
|
OutsourceOrderVO orderVO = new OutsourceOrderVO(); |
|
|
|
orderVO.setOutsourceOrderId(outsourceOrder.getOutsourceOrderId()); |
|
|
|
orderVO.setClosedStatus("3");//待结案
|
|
|
|
orderVO.setUpdateBy(ShiroUtils.getLoginName()); |
|
|
|
orderVO.setUpdateTime(DateUtils.getNowDate()); |
|
|
|
int updateResult = outsourceOrderMapper.updateOutsourceOrder(orderVO); |
|
|
|
if(updateResult <= 0 ){ |
|
|
|
throw new BusinessException("关联委外订单更新失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
int result = financialAccountsPayableMapper.updateFinancialAccountsPayable(payable); |
|
|
|
return result; |
|
|
|
} |
|
|
|