|
@ -33,7 +33,9 @@ import com.qs.serve.modules.third.entity.ProcessCreateCostApplyBo; |
|
|
import com.qs.serve.modules.third.entity.ProcessCreatePolicyCostBo; |
|
|
import com.qs.serve.modules.third.entity.ProcessCreatePolicyCostBo; |
|
|
import com.qs.serve.modules.third.entity.ProcessGoodsItem; |
|
|
import com.qs.serve.modules.third.entity.ProcessGoodsItem; |
|
|
import com.qs.serve.modules.tzc.entity.TzcPolicy; |
|
|
import com.qs.serve.modules.tzc.entity.TzcPolicy; |
|
|
|
|
|
import com.qs.serve.modules.tzc.entity.TzcPolicyGoodsSync; |
|
|
import com.qs.serve.modules.tzc.entity.TzcPolicyItem; |
|
|
import com.qs.serve.modules.tzc.entity.TzcPolicyItem; |
|
|
|
|
|
import com.qs.serve.modules.tzc.service.TzcPolicyGoodsSyncService; |
|
|
import com.qs.serve.modules.tzc.service.TzcPolicyItemService; |
|
|
import com.qs.serve.modules.tzc.service.TzcPolicyItemService; |
|
|
import com.qs.serve.modules.tzc.service.TzcPolicyService; |
|
|
import com.qs.serve.modules.tzc.service.TzcPolicyService; |
|
|
import com.qs.serve.modules.vtb.common.VtbVerificationState; |
|
|
import com.qs.serve.modules.vtb.common.VtbVerificationState; |
|
@ -93,6 +95,7 @@ public class PortalOfCostApplication { |
|
|
|
|
|
|
|
|
private TzcPolicyService policyService; |
|
|
private TzcPolicyService policyService; |
|
|
private TzcPolicyItemService policyItemServiceService; |
|
|
private TzcPolicyItemService policyItemServiceService; |
|
|
|
|
|
private TzcPolicyGoodsSyncService tzcPolicyGoodsSyncService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -104,7 +107,6 @@ public class PortalOfCostApplication { |
|
|
if(policyItem==null){ Assert.throwEx("政策项不存在,请重新编辑");} |
|
|
if(policyItem==null){ Assert.throwEx("政策项不存在,请重新编辑");} |
|
|
BmsSupplier supplier = supplierService.getById(policyItem.getSupplierId()); |
|
|
BmsSupplier supplier = supplierService.getById(policyItem.getSupplierId()); |
|
|
BmsSubject subject = subjectService.getById(policyItem.getSubjectId()); |
|
|
BmsSubject subject = subjectService.getById(policyItem.getSubjectId()); |
|
|
//TODO 校验商品信息
|
|
|
|
|
|
//发票号
|
|
|
//发票号
|
|
|
String billNumber = createBo.getBillNumber(); |
|
|
String billNumber = createBo.getBillNumber(); |
|
|
//拦截是否已保存
|
|
|
//拦截是否已保存
|
|
@ -112,6 +114,15 @@ public class PortalOfCostApplication { |
|
|
payLqw.eq(PayPayment::getBillNumber,billNumber); |
|
|
payLqw.eq(PayPayment::getBillNumber,billNumber); |
|
|
long countPay = paymentService.count(payLqw); |
|
|
long countPay = paymentService.count(payLqw); |
|
|
if(countPay>0){Assert.throwEx("发票号已存在,请勿重复提交");} |
|
|
if(countPay>0){Assert.throwEx("发票号已存在,请勿重复提交");} |
|
|
|
|
|
//TODO 校验商品信息
|
|
|
|
|
|
// List<String> skuCodes = createBo.getGoodsList().stream().map(a->a.getInventoryCode()).collect(Collectors.toList());
|
|
|
|
|
|
// LambdaQueryWrapper<TzcPolicyGoodsSync> goodsSyncLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
|
// goodsSyncLambdaQueryWrapper.eq(TzcPolicyGoodsSync::getPolicyItemCode,policyItem.getPolicyItemCode());
|
|
|
|
|
|
// goodsSyncLambdaQueryWrapper.in(TzcPolicyGoodsSync::getSkuCode,skuCodes);
|
|
|
|
|
|
// long countSku = tzcPolicyGoodsSyncService.count(goodsSyncLambdaQueryWrapper);
|
|
|
|
|
|
// if(countSku < skuCodes.size()){
|
|
|
|
|
|
// Assert.throwEx("部分商品不在政策范围内");
|
|
|
|
|
|
// }
|
|
|
//初始化sku列表
|
|
|
//初始化sku列表
|
|
|
List<ProcessGoodsItem> processGoodsItems = createBo.getGoodsList(); |
|
|
List<ProcessGoodsItem> processGoodsItems = createBo.getGoodsList(); |
|
|
List<GoodsSku> skuList = this.initSkuListOfProcess(createBo.getGoodsList()); |
|
|
List<GoodsSku> skuList = this.initSkuListOfProcess(createBo.getGoodsList()); |
|
@ -124,14 +135,13 @@ public class PortalOfCostApplication { |
|
|
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 costTheme = createBo.getCostTheme(); |
|
|
String costTheme = createBo.getCostTheme(); |
|
|
String random = String.format("%03d",new Random().nextInt(999)); |
|
|
String random = String.format("%03d",new Random().nextInt(999)); |
|
|
String activityCode = "G"+ StringUtils.genShortId() + random; |
|
|
String activityCode = "G"+ StringUtils.genShortId() + random; |
|
|
String activityTitle = "由核销API生成的活动"; |
|
|
String activityTitle = "由核销API生成的活动"; |
|
|
//构建费用申请
|
|
|
//构建费用申请
|
|
|
TbsCostApply costApply = new TbsCostApply(); |
|
|
TbsCostApply costApply = new TbsCostApply(); |
|
|
costApply.setCode(costCode); |
|
|
costApply.setCode("CA"+IdUtil.timeStampId()); |
|
|
costApply.setChargeTheme(costTheme); |
|
|
costApply.setChargeTheme(costTheme); |
|
|
costApply.setChargeState(TbsCostApplyState.State_3_finished.getCode()); |
|
|
costApply.setChargeState(TbsCostApplyState.State_3_finished.getCode()); |
|
|
costApply.setSupplierId(supplierId); |
|
|
costApply.setSupplierId(supplierId); |
|
@ -341,6 +351,17 @@ public class PortalOfCostApplication { |
|
|
paymentItemService.save(paymentItem); |
|
|
paymentItemService.save(paymentItem); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void createCostProcess(ProcessCreateCostApplyBo createBo){ |
|
|
public void createCostProcess(ProcessCreateCostApplyBo createBo){ |
|
|
SysUser user = userService.getByAccount(createBo.getUserCode()); |
|
|
SysUser user = userService.getByAccount(createBo.getUserCode()); |
|
|