13 changed files with 716 additions and 92 deletions
@ -0,0 +1,21 @@ |
|||||
|
package com.qs.serve.modules.third; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2024/1/31 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("thirty/policy") |
||||
|
public class PortalPolicyController { |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
package com.qs.serve.modules.tran.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
||||
|
import com.qs.serve.modules.tran.domain.OldCost; |
||||
|
import com.qs.serve.modules.tran.domain.OldVerify; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2024/1/24 |
||||
|
*/ |
||||
|
public interface TranOldCostMapper { |
||||
|
|
||||
|
@InterceptorIgnore(tenantLine = "true") |
||||
|
@Select("SELECT " + |
||||
|
" old_cost.*, " + |
||||
|
" cus_code as supplierCode, cus_name as supplierName, " + |
||||
|
" usedAmount " + |
||||
|
"FROM " + |
||||
|
" `old_main_cost` old_cost " + |
||||
|
" LEFT JOIN ( " + |
||||
|
" SELECT " + |
||||
|
" cost_code, " + |
||||
|
" cus_code, cus_name, " + |
||||
|
" sum( check_amt ) AS usedAmount " + |
||||
|
" FROM " + |
||||
|
" ( SELECT * FROM old_main_verify UNION SELECT * FROM old_main_verify2 UNION SELECT * FROM old_main_verify3 ) tmp " + |
||||
|
" GROUP BY " + |
||||
|
" cost_code " + |
||||
|
" ) tmp2 on tmp2.cost_code = old_cost.cost_code ") |
||||
|
List<OldCost> listCost(); |
||||
|
|
||||
|
@InterceptorIgnore(tenantLine = "true") |
||||
|
@Select("SELECT * FROM old_main_verify UNION SELECT * FROM old_main_verify2 UNION SELECT * FROM old_main_verify3") |
||||
|
List<OldVerify> listVerifyList(); |
||||
|
|
||||
|
} |
@ -0,0 +1,434 @@ |
|||||
|
package com.qs.serve.modules.tran.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.config.properties.ProjectApisProperties; |
||||
|
import com.qs.serve.common.model.consts.ResultFlag; |
||||
|
import com.qs.serve.common.model.enums.BudgetLogOptFlag; |
||||
|
import com.qs.serve.common.util.CollectionUtil; |
||||
|
import com.qs.serve.common.util.StringUtils; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSubject; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplier; |
||||
|
import com.qs.serve.modules.bms.service.BmsCostCenterService; |
||||
|
import com.qs.serve.modules.bms.service.BmsRegionService; |
||||
|
import com.qs.serve.modules.bms.service.BmsSubjectService; |
||||
|
import com.qs.serve.modules.bms.service.BmsSupplierService; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsCategory; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsSpu; |
||||
|
import com.qs.serve.modules.goods.service.GoodsCategoryService; |
||||
|
import com.qs.serve.modules.goods.service.GoodsSkuService; |
||||
|
import com.qs.serve.modules.goods.service.GoodsSpuService; |
||||
|
import com.qs.serve.modules.pay.service.PayPaymentItemService; |
||||
|
import com.qs.serve.modules.pay.service.PayPaymentService; |
||||
|
import com.qs.serve.modules.seeyon.service.XiaoLuTonService; |
||||
|
import com.qs.serve.modules.sys.entity.SysUser; |
||||
|
import com.qs.serve.modules.sys.mapper.SysUserCodeMathMapper; |
||||
|
import com.qs.serve.modules.sys.service.SysSyncLogService; |
||||
|
import com.qs.serve.modules.sys.service.SysUserService; |
||||
|
import com.qs.serve.modules.tbs.common.TbsActivityState; |
||||
|
import com.qs.serve.modules.tbs.common.TbsCostApplyState; |
||||
|
import com.qs.serve.modules.tbs.common.util.TbsBudgetLogBuildUtil; |
||||
|
import com.qs.serve.modules.tbs.entity.*; |
||||
|
import com.qs.serve.modules.tbs.mapper.TbsBudgetMapper; |
||||
|
import com.qs.serve.modules.tbs.mapper.TbsScheduleItemBudgetMapper; |
||||
|
import com.qs.serve.modules.tbs.service.*; |
||||
|
import com.qs.serve.modules.tran.domain.OldCost; |
||||
|
import com.qs.serve.modules.tran.domain.OldVerify; |
||||
|
import com.qs.serve.modules.tran.mapper.TranOldCostMapper; |
||||
|
import com.qs.serve.modules.tzc.service.TzcPolicyGoodsSyncService; |
||||
|
import com.qs.serve.modules.tzc.service.TzcPolicyItemLogService; |
||||
|
import com.qs.serve.modules.tzc.service.TzcPolicyItemService; |
||||
|
import com.qs.serve.modules.vtb.common.VtbVerificationState; |
||||
|
import com.qs.serve.modules.vtb.entity.VtbVerification; |
||||
|
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.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2024/1/24 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class TranOldCostService { |
||||
|
|
||||
|
private TranOldCostMapper tranOldCostMapper; |
||||
|
private SysUserCodeMathMapper userCodeMathMapper; |
||||
|
private final SysSyncLogService sysSyncLogService; |
||||
|
|
||||
|
private TbsActivityService activityService; |
||||
|
private TbsActivityCenterService activityCenterService; |
||||
|
private TbsActivitySubjectService activitySubjectService; |
||||
|
private TbsActivityGoodsService activityGoodsService; |
||||
|
private TbsActivityCenterGoodsService activityCenterGoodsService; |
||||
|
|
||||
|
private BmsSupplierService supplierService; |
||||
|
private BmsSubjectService subjectService; |
||||
|
private BmsCostCenterService costCenterService; |
||||
|
private BmsRegionService saleRegionService; |
||||
|
|
||||
|
private SysUserService userService; |
||||
|
|
||||
|
private TbsCostApplyService costApplyService; |
||||
|
private TbsCostUnItemService costUnItemService; |
||||
|
private TbsBudgetCostItemService costItemService; |
||||
|
private TbsBudgetLogService budgetLogService; |
||||
|
private TbsBudgetApplicationService budgetApplicationService; |
||||
|
private TbsScheduleItemBudgetMapper scheduleItemBudgetMapper; |
||||
|
private TbsBudgetMapper tbsBudgetMapper; |
||||
|
|
||||
|
|
||||
|
private GoodsSkuService goodsSkuService; |
||||
|
private GoodsSpuService goodsSpuService; |
||||
|
private GoodsCategoryService goodsCategoryService; |
||||
|
|
||||
|
private PayPaymentService paymentService; |
||||
|
private PayPaymentItemService paymentItemService; |
||||
|
|
||||
|
private VtbVerificationService verificationService; |
||||
|
private VtbVerificationSubjectService verificationSubjectService; |
||||
|
|
||||
|
private TzcPolicyItemService policyItemServiceService; |
||||
|
private TzcPolicyItemLogService policyItemLogService; |
||||
|
private TzcPolicyGoodsSyncService tzcPolicyGoodsSyncService; |
||||
|
private final XiaoLuTonService xiaoLuTonService; |
||||
|
|
||||
|
private ProjectApisProperties projectApisProperties; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
public void syncOldCost(){ |
||||
|
Long scheduleItemBudgetId = 4896L; |
||||
|
|
||||
|
String centerType = "center"; |
||||
|
String centerId = "71"; |
||||
|
String centerName = "BI历史记录"; |
||||
|
String centerCode = "HIS2022"; |
||||
|
|
||||
|
BmsSubject subject = new BmsSubject(); |
||||
|
subject.setId(79L); |
||||
|
subject.setSubjectName("原BI科目"); |
||||
|
subject.setSubjectCode("10001"); |
||||
|
|
||||
|
TbsScheduleItemBudget itemBudget = scheduleItemBudgetMapper.selectById(scheduleItemBudgetId); |
||||
|
|
||||
|
final BigDecimal OneHundred = new BigDecimal("100"); |
||||
|
|
||||
|
List<OldCost> costList = tranOldCostMapper.listCost(); |
||||
|
|
||||
|
for (OldCost oldCost : costList) { |
||||
|
|
||||
|
String costCode = oldCost.getCostCode(); |
||||
|
|
||||
|
LambdaQueryWrapper<TbsCostApply> costLqwCount = new LambdaQueryWrapper<>(); |
||||
|
costLqwCount.eq(TbsCostApply::getCode,costCode); |
||||
|
|
||||
|
if(costApplyService.count(costLqwCount)>0){ |
||||
|
log.warn("已存:{}",costCode); |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
BmsSupplier supplier = supplierService.getByNameOrCode(oldCost.getSupplierCode()); |
||||
|
|
||||
|
if(supplier==null){ |
||||
|
supplier = new BmsSupplier(); |
||||
|
supplier.setId("0"); |
||||
|
if(oldCost.getSupplierCode()==null){ |
||||
|
supplier.setCode("未指定客户"); |
||||
|
supplier.setName("未指定客户"); |
||||
|
}else { |
||||
|
supplier.setCode(oldCost.getSupplierCode()); |
||||
|
supplier.setName(oldCost.getSupplierName()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
Long supplierId = Long.parseLong(supplier.getId()); |
||||
|
|
||||
|
SysUser user = new SysUser(); |
||||
|
if(oldCost.getCheckUser()!=null&&oldCost.getCheckUser().contains(" - ")){ |
||||
|
String[] users = oldCost.getCheckUser().split(" - "); |
||||
|
user.setId("0"); |
||||
|
user.setCode(users[0]); |
||||
|
user.setName(users[1]); |
||||
|
}else { |
||||
|
user.setId("0"); |
||||
|
user.setCode("系统导入"); |
||||
|
user.setName("系统导入"); |
||||
|
} |
||||
|
|
||||
|
BigDecimal usedAmt = oldCost.getUsedAmount(); |
||||
|
BigDecimal totalAmount = oldCost.getCostPrice(); |
||||
|
|
||||
|
//构建费用申请
|
||||
|
TbsCostApply costApply = new TbsCostApply(); |
||||
|
costApply.setCode(oldCost.getCostCode()); |
||||
|
costApply.setMatchType(-1); |
||||
|
String chargeTheme = StringUtils.tailorLen(oldCost.getCostTitle(),590); |
||||
|
costApply.setChargeTheme(chargeTheme); |
||||
|
costApply.setChargeState(TbsCostApplyState.State_3_finished.getCode()); |
||||
|
costApply.setSupplierId(Long.parseLong(supplier.getId())); |
||||
|
costApply.setSupplierName(supplier.getName()); |
||||
|
costApply.setSupplierCode(supplier.getCode()); |
||||
|
costApply.setUserId(user.getId()); |
||||
|
costApply.setUserCode(user.getCode()); |
||||
|
costApply.setUserName(user.getName()); |
||||
|
costApply.setTotalActivity(1); |
||||
|
costApply.setTotalActivityAmount(totalAmount); |
||||
|
costApply.setTotalActivityUsedAmount(usedAmt); |
||||
|
costApply.setSubmitTime(oldCost.getCreateTime()); |
||||
|
costApply.setCreateTime(oldCost.getCreateTime()); |
||||
|
costApply.setRemark(StringUtils.tailorLen(oldCost.getRemark(),590)); |
||||
|
|
||||
|
//构建活动
|
||||
|
TbsActivity activity = new TbsActivity(); |
||||
|
activity.setActivityCode(oldCost.getCostCode()); |
||||
|
activity.setActivityState(TbsActivityState.STATE_1_Finished); |
||||
|
activity.setCostPassFlag(1); |
||||
|
activity.setCostPassTime(oldCost.getCheckTime()); |
||||
|
activity.setActTitle(chargeTheme); |
||||
|
activity.setSupplierId(supplierId); |
||||
|
activity.setSupplierName(supplier.getName()); |
||||
|
activity.setSupplierCode(supplier.getCode()); |
||||
|
activity.setActStartDate(oldCost.getStartDate()); |
||||
|
activity.setActEndDate(oldCost.getEndDate()); |
||||
|
activity.setPreStartDate(oldCost.getStartDate()); |
||||
|
activity.setPreEndDate(oldCost.getEndDate()); |
||||
|
activity.setPreCheckDate(oldCost.getEndDate()); |
||||
|
activity.setPreActQuantity(oldCost.getCostPrePrice()); |
||||
|
activity.setTotalAmount(totalAmount); |
||||
|
activity.setUsedAmount(usedAmt); |
||||
|
activity.setFinishedFlag(ResultFlag.OK); |
||||
|
activity.setFinishedTime(oldCost.getCreateTime()); |
||||
|
|
||||
|
//活动-科目
|
||||
|
TbsActivitySubject activitySubject = new TbsActivitySubject(); |
||||
|
activitySubject.setSubjectId(subject.getId()); |
||||
|
activitySubject.setSubjectCode(subject.getSubjectCode()); |
||||
|
activitySubject.setSubjectName(subject.getSubjectName()); |
||||
|
activitySubject.setAmount(totalAmount); |
||||
|
activitySubject.setUsedAmount(usedAmt); |
||||
|
activitySubject.setCountSession(0); |
||||
|
activitySubject.setCountPerson(0); |
||||
|
|
||||
|
//活动-成本中心
|
||||
|
TbsActivityCenter activityCenter = new TbsActivityCenter(); |
||||
|
activityCenter.setSubjectId(subject.getId()); |
||||
|
activityCenter.setCenterAmount(totalAmount); |
||||
|
activityCenter.setCenterRate(OneHundred); |
||||
|
activityCenter.setCenterType(centerType); |
||||
|
activityCenter.setCenterId(centerId); |
||||
|
activityCenter.setCenterName(centerName); |
||||
|
activityCenter.setCenterCode(centerCode); |
||||
|
activityCenter.setUsedAmount(totalAmount); |
||||
|
|
||||
|
//品类
|
||||
|
TbsActivityGoods activityGoods = new TbsActivityGoods(); |
||||
|
activityGoods.setTargetType("brand"); |
||||
|
activityGoods.setTargetId(102L); |
||||
|
activityGoods.setTargetCode("B101"); |
||||
|
activityGoods.setTargetName("原BI品牌"); |
||||
|
activityGoods.setTargetLevelPathIds("102"); |
||||
|
activityGoods.setTargetLevelPathNames("原BI品牌"); |
||||
|
|
||||
|
TbsActivityCenterGoods centerGoods = new TbsActivityCenterGoods(); |
||||
|
centerGoods.setActivityCode(activity.getActivityCode()); |
||||
|
centerGoods.setCenterGoodsCode(activity.getActivityCode()); |
||||
|
centerGoods.setSupplierId(supplierId); |
||||
|
centerGoods.setSupplierCode(supplier.getCode()); |
||||
|
centerGoods.setSupplierName(supplier.getName()); |
||||
|
//设置成本中心
|
||||
|
centerGoods.setCenterType(centerType); |
||||
|
centerGoods.setCenterId(centerId); |
||||
|
centerGoods.setCenterName(centerName); |
||||
|
centerGoods.setCenterCode(centerCode); |
||||
|
centerGoods.setCenterRate(OneHundred); |
||||
|
centerGoods.setCenterAmount(totalAmount); |
||||
|
//设置科目
|
||||
|
centerGoods.setSubjectId(subject.getId()); |
||||
|
centerGoods.setSubjectCode(subject.getSubjectCode()); |
||||
|
centerGoods.setSubjectName(subject.getSubjectName()); |
||||
|
//设置活动时间
|
||||
|
centerGoods.setActEndDate(oldCost.getEndDate()); |
||||
|
centerGoods.setActStartDate(oldCost.getStartDate()); |
||||
|
centerGoods.setPreEndDate(oldCost.getEndDate()); |
||||
|
centerGoods.setPreStartDate(oldCost.getStartDate()); |
||||
|
centerGoods.setPreCheckDate(oldCost.getEndDate()); |
||||
|
//设置目标
|
||||
|
centerGoods.setTargetId(activityGoods.getTargetId()); |
||||
|
centerGoods.setTargetType(activityGoods.getTargetType()); |
||||
|
centerGoods.setTargetCode(activityGoods.getTargetCode()); |
||||
|
centerGoods.setTargetName(activityGoods.getTargetName()); |
||||
|
centerGoods.setTargetLevelPathIds(activityGoods.getTargetLevelPathIds()); |
||||
|
centerGoods.setTargetLevelPathNames(activityGoods.getTargetLevelPathNames()); |
||||
|
// 分配金额
|
||||
|
centerGoods.setCenterGoodsAmount(totalAmount); |
||||
|
centerGoods.setCenterGoodsRate(OneHundred); |
||||
|
centerGoods.setUsedAmount(usedAmt); |
||||
|
|
||||
|
|
||||
|
//保存活动有关数据
|
||||
|
costApplyService.save(costApply); |
||||
|
activity.setCostApplyId(costApply.getId()); |
||||
|
activityService.save(activity); |
||||
|
|
||||
|
activitySubject.setCostApplyId(costApply.getId()); |
||||
|
activitySubject.setActivityId(activity.getId()); |
||||
|
activitySubjectService.save(activitySubject); |
||||
|
|
||||
|
activityCenter.setCostApplyId(costApply.getId()); |
||||
|
activityCenter.setActivityId(activity.getId()); |
||||
|
activityCenterService.save(activityCenter); |
||||
|
|
||||
|
activityGoods.setCostApplyId(costApply.getId()); |
||||
|
activityGoods.setActivityId(activity.getId()); |
||||
|
activityGoodsService.save(activityGoods); |
||||
|
|
||||
|
centerGoods.setCostApplyId(costApply.getId()); |
||||
|
centerGoods.setActivityId(activity.getId()); |
||||
|
activityCenterGoodsService.save(centerGoods); |
||||
|
|
||||
|
//匹配的商品,生成预算日志
|
||||
|
TbsBudgetCostItem costItem = new TbsBudgetCostItem(); |
||||
|
costItem.setCenterGoodsCode(centerGoods.getCenterGoodsCode()); |
||||
|
costItem.setCostApplyId(centerGoods.getCostApplyId()); |
||||
|
costItem.setActivityId(centerGoods.getActivityId()); |
||||
|
costItem.setActivityCode(centerGoods.getActivityCode()); |
||||
|
costItem.setSupplierId(centerGoods.getSupplierId()); |
||||
|
costItem.setSupplierCode(centerGoods.getSupplierCode()); |
||||
|
costItem.setSupplierName(centerGoods.getSupplierName()); |
||||
|
costItem.setSubjectId(centerGoods.getSubjectId()); |
||||
|
costItem.setSubjectCode(centerGoods.getSubjectCode()); |
||||
|
costItem.setSubjectName(centerGoods.getSubjectName()); |
||||
|
costItem.setCenterType(centerGoods.getCenterType()); |
||||
|
costItem.setCenterId(centerGoods.getCenterId()); |
||||
|
costItem.setCenterCode(centerGoods.getCenterCode()); |
||||
|
costItem.setCenterName(centerGoods.getCenterName()); |
||||
|
costItem.setCenterAmount(centerGoods.getCenterAmount()); |
||||
|
costItem.setCenterRate(centerGoods.getCenterRate()); |
||||
|
costItem.setCenterGoodsAmount(centerGoods.getCenterGoodsAmount()); |
||||
|
costItem.setCenterGoodsRate(centerGoods.getCenterGoodsRate()); |
||||
|
costItem.setTargetType(centerGoods.getTargetType()); |
||||
|
costItem.setTargetId(centerGoods.getTargetId()); |
||||
|
costItem.setTargetCode(centerGoods.getTargetCode()); |
||||
|
costItem.setTargetName(centerGoods.getTargetName()); |
||||
|
costItem.setTargetLevelPathIds(centerGoods.getTargetLevelPathIds()); |
||||
|
costItem.setTargetLevelPathNames(centerGoods.getTargetLevelPathNames()); |
||||
|
costItem.setActStartDate(centerGoods.getActStartDate()); |
||||
|
costItem.setActEndDate(centerGoods.getActEndDate()); |
||||
|
costItem.setPreStartDate(centerGoods.getPreStartDate()); |
||||
|
costItem.setPreEndDate(centerGoods.getPreEndDate()); |
||||
|
costItem.setPreCheckDate(centerGoods.getPreCheckDate()); |
||||
|
costItem.setCenterGoodItemId(centerGoods.getId()); |
||||
|
|
||||
|
|
||||
|
TbsBudgetLog budgetLog = TbsBudgetLogBuildUtil.buildTbsBudgetLog(BudgetLogOptFlag.State_1,user, costApply, itemBudget, centerGoods,centerGoods.getCenterGoodsAmount(),activity); |
||||
|
costItem.setBudgetId(itemBudget.getBudgetId()); |
||||
|
costItem.setScheduleId(itemBudget.getScheduleId()); |
||||
|
costItem.setScheduleItemId(itemBudget.getScheduleItemId()); |
||||
|
costItem.setScheduleItemName(itemBudget.getItemName()); |
||||
|
costItem.setScheduleItemAmount(itemBudget.getFinalBudgetAmount()); |
||||
|
costItem.setScheduleItemAmountUsed(itemBudget.getUsedBudgetAmount()); |
||||
|
costItem.setScheduleItemAmountApply(itemBudget.getUnUsedBudgetAmount()); |
||||
|
costItem.setScheduleItemBudgetId(itemBudget.getId()); |
||||
|
budgetLogService.save(budgetLog); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public void syncVerify(){ |
||||
|
|
||||
|
BmsSubject subject = new BmsSubject(); |
||||
|
subject.setId(79L); |
||||
|
subject.setSubjectName("原BI科目"); |
||||
|
subject.setSubjectCode("10001"); |
||||
|
|
||||
|
List<OldVerify> oldVerifyList = tranOldCostMapper.listVerifyList(); |
||||
|
|
||||
|
for (OldVerify oldVerify : oldVerifyList) { |
||||
|
TbsCostApply costApply = costApplyService.getByCode(oldVerify.getCostCode()); |
||||
|
//if(oldVerify.getCode())
|
||||
|
long count = verificationService.count(new LambdaQueryWrapper<VtbVerification>() |
||||
|
.eq(VtbVerification::getVerificationCode,oldVerify.getCostCode())); |
||||
|
if(count>0L){ |
||||
|
log.warn("已存"); |
||||
|
continue; |
||||
|
} |
||||
|
if(costApply==null){ |
||||
|
log.warn("费用缺失"); |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
TbsActivity activity = activityService.listByCostApplyId(costApply.getId()).get(0); |
||||
|
|
||||
|
String verifyCode = oldVerify.getCode(); |
||||
|
|
||||
|
BigDecimal totalAmount = oldVerify.getCheckAmt(); |
||||
|
|
||||
|
LocalDateTime nowTime = oldVerify.getSubmitDate(); |
||||
|
|
||||
|
SysUser user = new SysUser(); |
||||
|
if(oldVerify.getCheckUser()!=null&&oldVerify.getCheckUser().contains(" - ")){ |
||||
|
String[] users = oldVerify.getCheckUser().split(" - "); |
||||
|
user.setId("0"); |
||||
|
user.setCode(users[0]); |
||||
|
user.setName(users[1]); |
||||
|
}else { |
||||
|
user.setId("0"); |
||||
|
user.setCode("系统导入"); |
||||
|
user.setName("系统导入"); |
||||
|
} |
||||
|
|
||||
|
//保存核销申请
|
||||
|
VtbVerification verification = new VtbVerification(); |
||||
|
verification.setVerificationCode(verifyCode); |
||||
|
verification.setVerificationMainCode(verification.getVerificationCode()); |
||||
|
verification.setCostApplyId(costApply.getId()); |
||||
|
verification.setFinishedTime(nowTime); |
||||
|
verification.setVerificationState(VtbVerificationState.Finished.getCode()); |
||||
|
verification.setActivityId(activity.getId()); |
||||
|
verification.setSupplierId(activity.getSupplierId()); |
||||
|
verification.setSupplierCode(activity.getSupplierCode()); |
||||
|
verification.setSupplierName(activity.getSupplierName()); |
||||
|
verification.setUserId(user.getId()); |
||||
|
verification.setUserCode(user.getCode()); |
||||
|
verification.setUserName(user.getName()); |
||||
|
verification.setAmount(totalAmount); |
||||
|
verification.setAmountRecord(totalAmount); |
||||
|
verification.setPaymentState(ResultFlag.OK); |
||||
|
String remark = StringUtils.tailorLen("["+oldVerify.getSubjectName()+"]"+oldVerify.getTitle()+"备注:"+oldVerify.getRemark(),580); |
||||
|
verification.setRemark(remark); |
||||
|
verificationService.save(verification); |
||||
|
|
||||
|
//保存核销费用结果
|
||||
|
VtbVerificationSubject verificationSubject = new VtbVerificationSubject(); |
||||
|
verificationSubject.setVerificationId(verification.getId()); |
||||
|
verificationSubject.setVerificationSubCode(verification.getVerificationCode()+"_1"); |
||||
|
verificationSubject.setCostApplyId(costApply.getId()); |
||||
|
verificationSubject.setActivityId(activity.getId()); |
||||
|
verificationSubject.setSubjectId(costApply.getId()); |
||||
|
verificationSubject.setSubjectCode(subject.getSubjectCode()); |
||||
|
verificationSubject.setSubjectName(subject.getSubjectName()); |
||||
|
verificationSubject.setSupplierId(costApply.getSupplierId()); |
||||
|
verificationSubject.setSupplierCode(costApply.getSupplierCode()); |
||||
|
verificationSubject.setSupplierName(costApply.getSupplierName()); |
||||
|
verificationSubject.setPayFinishedFlag(ResultFlag.OK); |
||||
|
verificationSubject.setUsedAmount(totalAmount); |
||||
|
verificationSubject.setUsedAmountRecord(totalAmount); |
||||
|
verificationSubject.setCountPerson(0); |
||||
|
verificationSubject.setCountSession(0); |
||||
|
verificationSubjectService.save(verificationSubject); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue