|
|
@ -58,10 +58,8 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* Project: anrui-buscenter(业务管理) <br/> |
|
|
@ -208,16 +206,48 @@ public class BusSalesOrderDepositService extends MybatisBaseService<BusSalesOrde |
|
|
|
if ("02".equals(dto.getDepositTypeKey())) { |
|
|
|
List<AppBusSalesOrderDepositListDto> listVos = dto.getVirtualOrderList(); |
|
|
|
listVos.removeAll(Collections.singleton(null)); |
|
|
|
for (AppBusSalesOrderDepositListDto listDto : listVos) { |
|
|
|
//查询付款人是否和客户一样
|
|
|
|
BusDeposit busDeposit = busDepositService.selectByBillSid(listDto.getDepositBillSid()); |
|
|
|
if (!busSalesOrder.getCustomerName().equals(busDeposit.getDraweeName())) { |
|
|
|
if (listDto.getEntrustImage().isEmpty()) { |
|
|
|
return rb.setMsg("选择的虚拟订金单中有付款人与该客户不一致,请上传款项支付委托书"); |
|
|
|
if (!listVos.isEmpty()) { |
|
|
|
//判断是否存在重复的虚拟订金单
|
|
|
|
List<String> depositNoList = listVos.stream().map(v->v.getDepositBillNo()).collect(Collectors.toList()); |
|
|
|
Set<String> set = new HashSet<>(depositNoList); |
|
|
|
if(depositNoList.size() != set.size()){ |
|
|
|
return rb.setMsg("存在相同虚拟订金单,请刷新后重新添加"); |
|
|
|
} |
|
|
|
//查询存在使用记录sid的与数据库中该销售订单的虚拟订金使用记录的是否一致,若不一致则提示刷新后重试。若一致则继续
|
|
|
|
List<String> recordSidList = listVos.stream().filter(v-> null != v.getUseDepositRecordSid()).filter(v->!v.getUseDepositRecordSid().isEmpty()).map(v->v.getUseDepositRecordSid()).collect(Collectors.toList()); |
|
|
|
Set<String> setRecord = new HashSet<>(recordSidList); |
|
|
|
if(recordSidList.size() != setRecord.size()) { |
|
|
|
return rb.setMsg("存在相同虚拟订金单,请刷新后重新添加"); |
|
|
|
} |
|
|
|
//查询该销售订单下的所有虚拟订金单的信息
|
|
|
|
List<String> recordSidLists = busDepositFictitiousService.getStringList(salesOrderSid); |
|
|
|
if(recordSidList.size() != recordSidLists.size()){ |
|
|
|
return rb.setMsg("存在缓存数据,请刷新后再进行保存操作"); |
|
|
|
}else{ |
|
|
|
recordSidList.removeAll(recordSidLists); |
|
|
|
if(recordSidList.size()>0){ |
|
|
|
return rb.setMsg("存在缓存数据,请刷新后再进行保存操作"); |
|
|
|
} |
|
|
|
recordSidList = listVos.stream().filter(v-> null != v.getUseDepositRecordSid()).filter(v->!v.getUseDepositRecordSid().isEmpty()).map(v->v.getUseDepositRecordSid()).collect(Collectors.toList()); |
|
|
|
recordSidLists.removeAll(recordSidList); |
|
|
|
if(recordSidLists.size()>0){ |
|
|
|
return rb.setMsg("存在缓存数据,请刷新后再进行保存操作"); |
|
|
|
} |
|
|
|
} |
|
|
|
makeUpDecimal = makeUpDecimal.add(new BigDecimal(listDto.getPrice())); |
|
|
|
|
|
|
|
for (AppBusSalesOrderDepositListDto listDto : listVos) { |
|
|
|
//查询付款人是否和客户一样
|
|
|
|
BusDeposit busDeposit = busDepositService.selectByBillSid(listDto.getDepositBillSid()); |
|
|
|
if (!busSalesOrder.getCustomerName().equals(busDeposit.getDraweeName())) { |
|
|
|
if (listDto.getEntrustImage().isEmpty()) { |
|
|
|
return rb.setMsg("选择的虚拟订金单中有付款人与该客户不一致,请上传款项支付委托书"); |
|
|
|
} |
|
|
|
} |
|
|
|
makeUpDecimal = makeUpDecimal.add(new BigDecimal(listDto.getPrice())); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
BusSalesOrderDeposit busSalesOrderDeposit = baseMapper.selectByOrderSid(salesOrderSid); |
|
|
|
String depositSid = ""; |
|
|
@ -341,8 +371,8 @@ public class BusSalesOrderDepositService extends MybatisBaseService<BusSalesOrde |
|
|
|
} |
|
|
|
//查询已审核通过的款项确认
|
|
|
|
ResultBean<List<String>> stringList = finCollectionConfirmationFeign.billeNoList(); |
|
|
|
if(stringList.getSuccess()){ |
|
|
|
qw.in("bmd.billNo",stringList.getData()); |
|
|
|
if (stringList.getSuccess()) { |
|
|
|
qw.in("bmd.billNo", stringList.getData()); |
|
|
|
} |
|
|
|
} |
|
|
|
qw.eq("bmd.nodeState", FlowComment.SETTLE.getRemark());//已办结
|
|
|
@ -371,7 +401,7 @@ public class BusSalesOrderDepositService extends MybatisBaseService<BusSalesOrde |
|
|
|
* @param salesOrderSid 销售订单sid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public int updateBySalesOrderSid(BigDecimal depositSum, String salesOrderSid,BigDecimal bigDecimalSum) { |
|
|
|
return baseMapper.updateBySalesOrderSid(depositSum, salesOrderSid,bigDecimalSum); |
|
|
|
public int updateBySalesOrderSid(BigDecimal depositSum, String salesOrderSid, BigDecimal bigDecimalSum) { |
|
|
|
return baseMapper.updateBySalesOrderSid(depositSum, salesOrderSid, bigDecimalSum); |
|
|
|
} |
|
|
|
} |