|
@ -35,6 +35,8 @@ import com.qs.serve.modules.third.entity.ProcessGoodsItem; |
|
|
import com.qs.serve.modules.vtb.common.VtbVerificationState; |
|
|
import com.qs.serve.modules.vtb.common.VtbVerificationState; |
|
|
import com.qs.serve.modules.vtb.entity.VtbVerification; |
|
|
import com.qs.serve.modules.vtb.entity.VtbVerification; |
|
|
import com.qs.serve.modules.vtb.entity.VtbVerificationSubject; |
|
|
import com.qs.serve.modules.vtb.entity.VtbVerificationSubject; |
|
|
|
|
|
import com.qs.serve.modules.vtb.service.VtbVerificationService; |
|
|
|
|
|
import com.qs.serve.modules.vtb.service.VtbVerificationSubjectService; |
|
|
import lombok.AllArgsConstructor; |
|
|
import lombok.AllArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
@ -82,6 +84,8 @@ public class PortalOfCostApplication { |
|
|
private PayPaymentService paymentService; |
|
|
private PayPaymentService paymentService; |
|
|
private PayPaymentItemService paymentItemService; |
|
|
private PayPaymentItemService paymentItemService; |
|
|
|
|
|
|
|
|
|
|
|
private VtbVerificationService verificationService; |
|
|
|
|
|
private VtbVerificationSubjectService verificationSubjectService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
@ -92,6 +96,13 @@ public class PortalOfCostApplication { |
|
|
if(supplier==null){Assert.throwEx("客户不存在,请重新编辑");} |
|
|
if(supplier==null){Assert.throwEx("客户不存在,请重新编辑");} |
|
|
BmsSubject subject = subjectService.getByCode(createBo.getSubjectCode()); |
|
|
BmsSubject subject = subjectService.getByCode(createBo.getSubjectCode()); |
|
|
if(subject==null){Assert.throwEx("科目不存在,请重新编辑");} |
|
|
if(subject==null){Assert.throwEx("科目不存在,请重新编辑");} |
|
|
|
|
|
//发票号
|
|
|
|
|
|
String billNumber = createBo.getBillNumber(); |
|
|
|
|
|
//拦截是否已保存
|
|
|
|
|
|
LambdaQueryWrapper<PayPayment> payLqw = new LambdaQueryWrapper<>(); |
|
|
|
|
|
payLqw.eq(PayPayment::getBillNumber,billNumber); |
|
|
|
|
|
long countPay = paymentService.count(payLqw); |
|
|
|
|
|
if(countPay>0){Assert.throwEx("发票号已存在,请勿重复提交");} |
|
|
//初始化sku列表
|
|
|
//初始化sku列表
|
|
|
List<ProcessGoodsItem> processGoodsItems = createBo.getGoodsList(); |
|
|
List<ProcessGoodsItem> processGoodsItems = createBo.getGoodsList(); |
|
|
List<GoodsSku> skuList = this.initSkuListOfProcess(createBo); |
|
|
List<GoodsSku> skuList = this.initSkuListOfProcess(createBo); |
|
@ -101,17 +112,21 @@ public class PortalOfCostApplication { |
|
|
final BigDecimal OneHundred = new BigDecimal("100"); |
|
|
final BigDecimal OneHundred = new BigDecimal("100"); |
|
|
LocalDateTime nowTime = LocalDateTime.now(); |
|
|
LocalDateTime nowTime = LocalDateTime.now(); |
|
|
LocalDate nowDate = LocalDate.now(); |
|
|
LocalDate nowDate = LocalDate.now(); |
|
|
String billNumber = createBo.getBillNumber(); |
|
|
|
|
|
String erpCode = createBo.getErpCode(); |
|
|
String erpCode = createBo.getErpCode(); |
|
|
Long supplierId = Long.parseLong(supplier.getId()); |
|
|
Long supplierId = Long.parseLong(supplier.getId()); |
|
|
BigDecimal totalAmount = createBo.getTotalAmount(); |
|
|
BigDecimal totalAmount = createBo.getTotalAmount(); |
|
|
String costCode = createBo.getCostCode(); |
|
|
String costCode = createBo.getCostCode(); |
|
|
String costTheme = createBo.getCostTheme(); |
|
|
String costTheme = createBo.getCostTheme(); |
|
|
|
|
|
|
|
|
// String random = String.format("%03d",new Random().nextInt(999));
|
|
|
|
|
|
// activity.setActivityCode("G"+ StringUtils.genShortId() + random);
|
|
|
|
|
|
String activityCode = createBo.getActivityCode(); |
|
|
String activityCode = createBo.getActivityCode(); |
|
|
|
|
|
if(!StringUtils.hasText(activityCode)){ |
|
|
|
|
|
String random = String.format("%03d",new Random().nextInt(999)); |
|
|
|
|
|
activityCode = "G"+ StringUtils.genShortId() + random; |
|
|
|
|
|
} |
|
|
String activityTitle = createBo.getActivityTitle(); |
|
|
String activityTitle = createBo.getActivityTitle(); |
|
|
|
|
|
if(!StringUtils.hasText(activityTitle)){ |
|
|
|
|
|
activityTitle = "由核销API生成的活动"; |
|
|
|
|
|
} |
|
|
//构建费用申请
|
|
|
//构建费用申请
|
|
|
TbsCostApply costApply = new TbsCostApply(); |
|
|
TbsCostApply costApply = new TbsCostApply(); |
|
|
costApply.setCode(costCode); |
|
|
costApply.setCode(costCode); |
|
@ -211,6 +226,7 @@ public class PortalOfCostApplication { |
|
|
centerGoods.setPreCheckDate(nowDate); |
|
|
centerGoods.setPreCheckDate(nowDate); |
|
|
//设置目标
|
|
|
//设置目标
|
|
|
centerGoods.setTargetId(activityGoods.getTargetId()); |
|
|
centerGoods.setTargetId(activityGoods.getTargetId()); |
|
|
|
|
|
centerGoods.setTargetType(activityGoods.getTargetType()); |
|
|
centerGoods.setTargetCode(activityGoods.getTargetCode()); |
|
|
centerGoods.setTargetCode(activityGoods.getTargetCode()); |
|
|
centerGoods.setTargetName(activityGoods.getTargetName()); |
|
|
centerGoods.setTargetName(activityGoods.getTargetName()); |
|
|
centerGoods.setTargetLevelPathIds(activityGoods.getTargetLevelPathIds()); |
|
|
centerGoods.setTargetLevelPathIds(activityGoods.getTargetLevelPathIds()); |
|
@ -301,9 +317,11 @@ public class PortalOfCostApplication { |
|
|
verification.setAmount(totalAmount); |
|
|
verification.setAmount(totalAmount); |
|
|
verification.setAmountRecord(totalAmount); |
|
|
verification.setAmountRecord(totalAmount); |
|
|
verification.setPaymentState(ResultFlag.OK); |
|
|
verification.setPaymentState(ResultFlag.OK); |
|
|
|
|
|
verificationService.save(verification); |
|
|
|
|
|
|
|
|
//保存核销费用结果
|
|
|
//保存核销费用结果
|
|
|
VtbVerificationSubject verificationSubject = new VtbVerificationSubject(); |
|
|
VtbVerificationSubject verificationSubject = new VtbVerificationSubject(); |
|
|
|
|
|
verificationSubject.setVerificationId(verification.getId()); |
|
|
verificationSubject.setVerificationSubCode(verification.getVerificationCode()+"_1"); |
|
|
verificationSubject.setVerificationSubCode(verification.getVerificationCode()+"_1"); |
|
|
verificationSubject.setCostApplyId(costApply.getId()); |
|
|
verificationSubject.setCostApplyId(costApply.getId()); |
|
|
verificationSubject.setActivityId(activity.getId()); |
|
|
verificationSubject.setActivityId(activity.getId()); |
|
@ -318,6 +336,7 @@ public class PortalOfCostApplication { |
|
|
verificationSubject.setUsedAmountRecord(totalAmount); |
|
|
verificationSubject.setUsedAmountRecord(totalAmount); |
|
|
verificationSubject.setCountPerson(0); |
|
|
verificationSubject.setCountPerson(0); |
|
|
verificationSubject.setCountSession(0); |
|
|
verificationSubject.setCountSession(0); |
|
|
|
|
|
verificationSubjectService.save(verificationSubject); |
|
|
|
|
|
|
|
|
//保存支付
|
|
|
//保存支付
|
|
|
PayPayment payPayment = new PayPayment(); |
|
|
PayPayment payPayment = new PayPayment(); |
|
|