|
@@ -133,7 +133,7 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
newCp.setExpendQuantity(newCp.getQuantity());
|
|
|
if (ObjectUtil.isNotEmpty(newCp.getId())) {//如果新合同产品ID不为空
|
|
|
//取出旧合同
|
|
|
- ContractProduct oldContractProduct = oldContractProductMap.getOrDefault(newCp.getId(),null).get(0);
|
|
|
+ ContractProduct oldContractProduct = oldContractProductMap.getOrDefault(newCp.getId(), null).get(0);
|
|
|
// //取出旧合同包装方式
|
|
|
// JSONObject oldJson = JSONObject.parseObject(oldContractProduct.getEhsdJson());
|
|
|
// String oldPackMethod = oldJson.getOrDefault("packMethod",null)==null?null:oldJson.getOrDefault("packMethod",null).toString();
|
|
@@ -143,10 +143,10 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
/**
|
|
|
* 商品英文名、尺寸、包装方式、数量 没有变更---取原本的剩余数量
|
|
|
*/
|
|
|
- if(oldContractProduct.getQuantity().compareTo(newCp.getQuantity())==0){//如果数量没有变动
|
|
|
+ if (oldContractProduct.getQuantity().compareTo(newCp.getQuantity()) == 0) {//如果数量没有变动
|
|
|
//取出旧的剩余数量
|
|
|
newCp.setExpendQuantity(oldContractProduct.getExpendQuantity());
|
|
|
- }else{//变动了
|
|
|
+ } else {//变动了
|
|
|
BigDecimal quantity = newCp.getQuantity().subtract(oldContractProduct.getQuantity()).subtract(oldContractProduct.getExpendQuantity());//剩余数量
|
|
|
newCp.setExpendQuantity(quantity);
|
|
|
}
|
|
@@ -291,30 +291,31 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
|
|
|
|
|
|
List<ClaimContract> claimContractList = claimContractService.list(Wrappers.<ClaimContract>query().lambda().eq(ClaimContract::getContractId,oldContractId));
|
|
|
- List<Long> claimIds = claimContractList.stream().map(ClaimContract::getClaimId).collect(Collectors.toList());
|
|
|
- List<Long> claimContractIds = claimContractList.stream().map(ClaimContract::getId).collect(Collectors.toList());
|
|
|
- //取出到账认领数据
|
|
|
- List<Claim> claims = claimService.list(q -> q.in(Claim::getId, CollectionUtils.isEmpty(claimIds)? Arrays.asList("0000"):claimIds));
|
|
|
- for(Claim c : claims){
|
|
|
- //查询流水数据
|
|
|
- AccountRunningWater accountRunningWater = accountRunningWaterService.getById(c.getBusinessId());
|
|
|
- BigDecimal sumClaimMoney = accountRunningWater.getClaimAmount().subtract(c.getAmount());
|
|
|
- //更新流水数据为认领状态---已认领金额还原
|
|
|
- AccountRunningWater water = new AccountRunningWater();
|
|
|
- if(sumClaimMoney.compareTo(BigDecimal.ZERO)>0){
|
|
|
- water.setIsClaim(2);//部分认领
|
|
|
- }else{
|
|
|
- water.setIsClaim(0);//未认领
|
|
|
+ if (ObjectUtil.isNotEmpty(claimContractList)) {
|
|
|
+ List<Long> claimIds = claimContractList.stream().map(ClaimContract::getClaimId).collect(Collectors.toList());
|
|
|
+ List<Long> claimContractIds = claimContractList.stream().map(ClaimContract::getId).collect(Collectors.toList());
|
|
|
+ //取出到账认领数据
|
|
|
+ List<Claim> claims = claimService.list(q -> q.in(Claim::getId, CollectionUtils.isEmpty(claimIds) ? Arrays.asList("0000") : claimIds));
|
|
|
+ for (Claim c : claims) {
|
|
|
+ //查询流水数据
|
|
|
+ AccountRunningWater accountRunningWater = accountRunningWaterService.getById(c.getBusinessId());
|
|
|
+ BigDecimal sumClaimMoney = accountRunningWater.getClaimAmount().subtract(c.getAmount());
|
|
|
+ //更新流水数据为认领状态---已认领金额还原
|
|
|
+ AccountRunningWater water = new AccountRunningWater();
|
|
|
+ if (sumClaimMoney.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ water.setIsClaim(2);//部分认领
|
|
|
+ } else {
|
|
|
+ water.setIsClaim(0);//未认领
|
|
|
+ }
|
|
|
+ water.setId(c.getBusinessId());
|
|
|
+ water.setClaimAmount(sumClaimMoney);
|
|
|
+ accountRunningWaterService.updateById(water);
|
|
|
}
|
|
|
- water.setId(c.getBusinessId());
|
|
|
- water.setClaimAmount(sumClaimMoney);
|
|
|
- accountRunningWaterService.updateById(water);
|
|
|
+ //删除到账认领数据
|
|
|
+ claimContractService.remove(q -> q.in(ClaimContract::getId, claimContractIds));
|
|
|
+ //删除到账认领数据
|
|
|
+ claimService.remove(q -> q.in(Claim::getId, claimIds));
|
|
|
}
|
|
|
- //删除到账认领数据
|
|
|
- claimContractService.remove(q -> q.in(ClaimContract::getId, claimContractIds));
|
|
|
- //删除到账认领数据
|
|
|
- claimService.remove(q -> q.in(Claim::getId, claimIds));
|
|
|
-
|
|
|
|
|
|
oldContract.setUpId(temOldId);
|
|
|
oldContract.setIsShow(1);//隐藏旧合同
|