|
|
@ -479,9 +479,8 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void release(Long activityId,String userCode,Boolean throwEx) { |
|
|
|
public void release(Long activityId,String userCode,Boolean throwEx,boolean checkState) { |
|
|
|
String url = "unknown"; |
|
|
|
try { |
|
|
|
HttpServletRequest request = ServletUtils.getRequest(); |
|
|
@ -502,12 +501,15 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe |
|
|
|
} |
|
|
|
TbsActivity activity = activityService.getById(activityId); |
|
|
|
BirActivityCenterGoodsUtil.buildBir(activity.getCostApplyId()); |
|
|
|
if(ReleaseConst.UseFilter){ |
|
|
|
if(!activity.getActivityState().equals(TbsActivityState.STATE_0_Todo)){ |
|
|
|
if(!throwEx){ |
|
|
|
return; |
|
|
|
//一般 checkState=true 普通核销 false是合并核销或者修复数据时使用
|
|
|
|
if(checkState){ |
|
|
|
if(ReleaseConst.UseFilter){ |
|
|
|
if(!activity.getActivityState().equals(TbsActivityState.STATE_0_Todo)){ |
|
|
|
if(!throwEx){ |
|
|
|
return; |
|
|
|
} |
|
|
|
Assert.throwEx("活动状态非待核销状态,操作失败"); |
|
|
|
} |
|
|
|
Assert.throwEx("活动状态非待核销状态,操作失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
if(activity.getCancelFlag().equals(1)){ |
|
|
@ -519,13 +521,18 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe |
|
|
|
Assert.throwEx("状态不支持释放活动费用"); |
|
|
|
} |
|
|
|
} |
|
|
|
BigDecimal releaseAmount = null; |
|
|
|
BigDecimal releaseAmount = BigDecimal.ZERO; |
|
|
|
String errorMsg = null; |
|
|
|
try { |
|
|
|
releaseAmount = this.validActivity(costApply.getContractFlag()!=null |
|
|
|
&&costApply.getContractFlag().equals(1),activity,false,false); |
|
|
|
} catch (Exception e) { |
|
|
|
errorMsg = e.getMessage(); |
|
|
|
//一般 checkState=true 普通核销 false是合并核销或者修复数据时使用
|
|
|
|
if(checkState){ |
|
|
|
try { |
|
|
|
releaseAmount = this.validActivity(costApply.getContractFlag()!=null |
|
|
|
&&costApply.getContractFlag().equals(1),activity,false,false); |
|
|
|
} catch (Exception e) { |
|
|
|
errorMsg = e.getMessage(); |
|
|
|
} |
|
|
|
}else { |
|
|
|
releaseAmount = this.getActivityReleaseAmt(activity); |
|
|
|
} |
|
|
|
if(StringUtils.hasText(errorMsg)){ |
|
|
|
if(throwEx){ |
|
|
@ -547,7 +554,7 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe |
|
|
|
//移除历史记录
|
|
|
|
fundFlowService.remove( |
|
|
|
new LambdaQueryWrapper<VtbFundFlow>() |
|
|
|
.eq(VtbFundFlow::getFundType,VtbFundFlowType.Release) |
|
|
|
.eq(VtbFundFlow::getFundType,VtbFundFlowType.Release) |
|
|
|
.eq(VtbFundFlow::getCostApplyId,activity.getCostApplyId()) |
|
|
|
.eq(VtbFundFlow::getActivityId,activity.getId()) |
|
|
|
); |
|
|
@ -613,6 +620,12 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe |
|
|
|
BirActivityCenterGoodsUtil.buildBir(costApply.getId()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void release(Long activityId,String userCode,Boolean throwEx) { |
|
|
|
this.release(activityId,userCode,throwEx,true); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void cancelRelease(Long activityId) { |
|
|
@ -1122,6 +1135,10 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe |
|
|
|
data.put("jinE", verification.getAmount().toString()); |
|
|
|
data.put("money", verification.getAmount().toString()); |
|
|
|
|
|
|
|
TbsCostApply costApply = costApplyService.getById(activity.getCostApplyId()); |
|
|
|
data.put("templateId", costApply.getTemplateId()); |
|
|
|
data.put("templateName", costApply.getTemplateTitle()); |
|
|
|
|
|
|
|
//核销拓展时间信息
|
|
|
|
//activityQuarter 活动期间所属季度
|
|
|
|
//activityMonth 活动期间所属月份
|
|
|
@ -1241,6 +1258,11 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return getActivityReleaseAmt(activity); |
|
|
|
} |
|
|
|
|
|
|
|
@NotNull |
|
|
|
private BigDecimal getActivityReleaseAmt(TbsActivity activity) { |
|
|
|
List<VtbFundFlow> fundFlowList = fundFlowService.listByActivity(activity.getId(),VtbFundFlowType.Verification); |
|
|
|
BigDecimal totalFunFlow = BigDecimal.ZERO; |
|
|
|
for (VtbFundFlow fundFlow : fundFlowList) { |
|
|
@ -1248,7 +1270,7 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe |
|
|
|
} |
|
|
|
BigDecimal allowAmount = activity.getTotalAmount().subtract(totalFunFlow); |
|
|
|
if(allowAmount.compareTo(BigDecimal.ZERO)<0){ |
|
|
|
log.error("无可用费用 activity id:{} code:{}",activity.getId(),activity.getActivityCode()); |
|
|
|
log.error("无可用费用 activity id:{} code:{}", activity.getId(), activity.getActivityCode()); |
|
|
|
Assert.throwEx("无可用费用"); |
|
|
|
} |
|
|
|
return allowAmount; |
|
|
@ -1462,7 +1484,7 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe |
|
|
|
&&verification.getRegReleaseFlag().equals(1)){ |
|
|
|
//更新活动状态
|
|
|
|
SysUser sysUser = sysUserService.getById(verification.getRegReleaseUserId()); |
|
|
|
this.release(verification.getActivityId(),sysUser.getCode(),false); |
|
|
|
this.release(verification.getActivityId(),sysUser.getCode(),true,false); |
|
|
|
} |
|
|
|
|
|
|
|
BigDecimal totalCostApplyUsed = costApplyService.totalCostUsed(activity.getCostApplyId()); |
|
|
@ -1511,6 +1533,7 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void successCommit(Long verificationId) { |
|
|
|
this.successCommit(verificationId,true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|