|
@ -38,10 +38,7 @@ import com.qs.serve.modules.tbs.service.impl.TbsCostApplyOperationServiceImpl; |
|
|
import com.qs.serve.modules.vtb.common.VtbFundFlowType; |
|
|
import com.qs.serve.modules.vtb.common.VtbFundFlowType; |
|
|
import com.qs.serve.modules.vtb.common.VtbVerificationState; |
|
|
import com.qs.serve.modules.vtb.common.VtbVerificationState; |
|
|
import com.qs.serve.modules.vtb.entity.*; |
|
|
import com.qs.serve.modules.vtb.entity.*; |
|
|
import com.qs.serve.modules.vtb.entity.bo.VtbVerificationBo; |
|
|
import com.qs.serve.modules.vtb.entity.bo.*; |
|
|
import com.qs.serve.modules.vtb.entity.bo.VtbVerificationChannelBo; |
|
|
|
|
|
import com.qs.serve.modules.vtb.entity.bo.VtbVerificationChannelPointBo; |
|
|
|
|
|
import com.qs.serve.modules.vtb.entity.bo.VtbVerificationSubjectBo; |
|
|
|
|
|
import com.qs.serve.modules.seeyon.entity.XltApticlaim; |
|
|
import com.qs.serve.modules.seeyon.entity.XltApticlaim; |
|
|
import com.qs.serve.modules.vtb.mapper.VtbVerificationMapper; |
|
|
import com.qs.serve.modules.vtb.mapper.VtbVerificationMapper; |
|
|
import com.qs.serve.modules.vtb.mapper.VtbVerificationYardItemMapper; |
|
|
import com.qs.serve.modules.vtb.mapper.VtbVerificationYardItemMapper; |
|
@ -107,6 +104,83 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe |
|
|
private final BmsRegion2Mapper region2Mapper; |
|
|
private final BmsRegion2Mapper region2Mapper; |
|
|
private final TbsCostPercentMapper costPercentMapper; |
|
|
private final TbsCostPercentMapper costPercentMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void createContactRecord(VtbVerificationContactBo param) { |
|
|
|
|
|
SysUser sysUser = sysUserService.getByAccount(param.getUserCode()); |
|
|
|
|
|
if(sysUser==null){ |
|
|
|
|
|
Assert.throwEx("工号["+param.getUserCode()+"]在CRM不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
TbsActivityPayCondition condition = null; |
|
|
|
|
|
if(StringUtils.hasText(param.getContactCode())){ |
|
|
|
|
|
LambdaQueryWrapper<TbsActivityPayCondition> conditionLqw = new LambdaQueryWrapper<>(); |
|
|
|
|
|
conditionLqw.eq(TbsActivityPayCondition::getCode,param.getContactCode()); |
|
|
|
|
|
condition = activityPayConditionService.getOne(conditionLqw,false); |
|
|
|
|
|
if(condition==null){ |
|
|
|
|
|
Assert.throwEx("协议编码有误"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
TbsCostApply costApply = costApplyService.getById(param.getCostApplyId()); |
|
|
|
|
|
if(!costApply.getContractFlag().equals(1)){ |
|
|
|
|
|
Assert.throwEx("非协议类费用,访问拦截"); |
|
|
|
|
|
} |
|
|
|
|
|
if(!costApply.getChargeState().equals(TbsCostApplyState.State_2_actioning.getCode())){ |
|
|
|
|
|
Assert.throwEx("费用状态不支持"); |
|
|
|
|
|
} |
|
|
|
|
|
TbsActivity activity = activityService.getById(param.getActivityId()); |
|
|
|
|
|
if(!activity.getCostApplyId().equals(param.getCostApplyId())){ |
|
|
|
|
|
Assert.throwEx("参数异常"); |
|
|
|
|
|
} |
|
|
|
|
|
BigDecimal surplus = activity.getTotalAmount().subtract(activity.getUsedAmount()); |
|
|
|
|
|
if(surplus.compareTo(param.getCheckAmount())<0){ |
|
|
|
|
|
Assert.throwEx("金额溢出"); |
|
|
|
|
|
} |
|
|
|
|
|
Assert.throwEx("功能开发中..."); |
|
|
|
|
|
BigDecimal finalAmt = activity.getUsedAmount().add(param.getCheckAmount()); |
|
|
|
|
|
//更新费用
|
|
|
|
|
|
activity.setUsedAmount(finalAmt); |
|
|
|
|
|
if(finalAmt.compareTo(activity.getTotalAmount())==0) { |
|
|
|
|
|
activity.setActivityState(TbsActivityState.STATE_1_Finished); |
|
|
|
|
|
} |
|
|
|
|
|
activityService.updateById(activity); |
|
|
|
|
|
//TODO 更新活动相关费用
|
|
|
|
|
|
|
|
|
|
|
|
//判断是否其它费用也完成
|
|
|
|
|
|
if(finalAmt.compareTo(activity.getTotalAmount())==0){ |
|
|
|
|
|
LambdaQueryWrapper<TbsActivity> activityLqw = new LambdaQueryWrapper<>(); |
|
|
|
|
|
activityLqw.ne(TbsActivity::getActivityState,TbsActivityState.STATE_1_Finished); |
|
|
|
|
|
activityLqw.ne(TbsActivity::getReleaseFlag,1); |
|
|
|
|
|
Long count = activityService.count(activityLqw); |
|
|
|
|
|
if(count==0){ |
|
|
|
|
|
costApply.setChargeState(TbsCostApplyState.State_3_finished.getCode()); |
|
|
|
|
|
costApplyService.updateById(costApply); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//添加核销记录
|
|
|
|
|
|
VtbVerification verification = new VtbVerification(); |
|
|
|
|
|
if(condition!=null){ |
|
|
|
|
|
verification.setPayConditionId(condition.getId()); |
|
|
|
|
|
} |
|
|
|
|
|
verification.setVerificationCode("HX"+CodeGenUtil.generate(CodeGenUtil.SourceKey.Verification)); |
|
|
|
|
|
verification.setVerificationState(VtbVerificationState.Commiting.getCode()); |
|
|
|
|
|
verification.setCostApplyId(costApply.getId()); |
|
|
|
|
|
verification.setActivityId(activity.getId()); |
|
|
|
|
|
verification.setSupplierId(activity.getSupplierId()); |
|
|
|
|
|
verification.setSupplierCode(activity.getSupplierCode()); |
|
|
|
|
|
verification.setSupplierName(activity.getSupplierName()); |
|
|
|
|
|
verification.setUserId(sysUser.getId()); |
|
|
|
|
|
verification.setUserCode(sysUser.getCode()); |
|
|
|
|
|
verification.setUserName(sysUser.getName()); |
|
|
|
|
|
verification.setWayId(0L); |
|
|
|
|
|
verification.setWayTitle(param.getPayWay()); |
|
|
|
|
|
this.save(verification); |
|
|
|
|
|
|
|
|
|
|
|
//List<VtbFundFlow> addFundFlowList = new ArrayList<>();
|
|
|
|
|
|
//buildFundFlows(verification.getId(), addFundFlowList, activityGoodsListOfSubjectCenter,currentCenterAmount);
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void removeCheck(Long id) { |
|
|
public void removeCheck(Long id) { |
|
@ -335,6 +409,9 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe |
|
|
sysUser.checkSyAccount(); |
|
|
sysUser.checkSyAccount(); |
|
|
TbsActivity activity = activityService.getById(verificationBo.getActivityId()); |
|
|
TbsActivity activity = activityService.getById(verificationBo.getActivityId()); |
|
|
TbsCostApply costApply = costApplyService.getById(activity.getCostApplyId()); |
|
|
TbsCostApply costApply = costApplyService.getById(activity.getCostApplyId()); |
|
|
|
|
|
if(costApply.getCancelFlag().equals(1)){ |
|
|
|
|
|
Assert.throwEx("异动的费用申请不可核销!!"); |
|
|
|
|
|
} |
|
|
BmsSupplier supplier = bmsSupplierService.getById(activity.getSupplierId()); |
|
|
BmsSupplier supplier = bmsSupplierService.getById(activity.getSupplierId()); |
|
|
if(!costApply.getChargeState().equals(TbsCostApplyState.State_2_actioning.getCode())){ |
|
|
if(!costApply.getChargeState().equals(TbsCostApplyState.State_2_actioning.getCode())){ |
|
|
Assert.throwEx("当前费用状态不支持"); |
|
|
Assert.throwEx("当前费用状态不支持"); |
|
|