10 changed files with 720 additions and 25 deletions
@ -0,0 +1,25 @@ |
|||
package com.qs.serve.modules.vtb.common; |
|||
|
|||
import com.qs.serve.common.util.Assert; |
|||
import com.qs.serve.modules.tbs.common.TbsCostApplyState; |
|||
import com.qs.serve.modules.tbs.entity.TbsCostApply; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2024/6/21 |
|||
*/ |
|||
public class VerificationUtil { |
|||
|
|||
public static void verifyCostState(TbsCostApply costApply) { |
|||
if(costApply.getContractFlag().equals(1)){ |
|||
Assert.throwEx("协议类申请不支持CRM核销"); |
|||
} |
|||
if(costApply.getCancelFlag().equals(1)){ |
|||
Assert.throwEx("异动的费用申请不可核销!!"); |
|||
} |
|||
if(!costApply.getChargeState().equals(TbsCostApplyState.State_2_actioning.getCode())){ |
|||
Assert.throwEx("当前费用状态不支持"); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,81 @@ |
|||
package com.qs.serve.modules.vtb.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import com.qs.serve.modules.seeyon.service.SeeYonRequestService; |
|||
import com.qs.serve.modules.vtb.entity.bo.VtbVerificationBatchBo; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.vtb.entity.VtbVerificationBatch; |
|||
import com.qs.serve.modules.vtb.service.VtbVerificationBatchService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 批量核销 |
|||
* @author YenHex |
|||
* @since 2024-06-14 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("vtb/verificationBatch") |
|||
public class VtbVerificationBatchController { |
|||
|
|||
private SeeYonRequestService seeYonService; |
|||
private VtbVerificationBatchService vtbVerificationBatchService; |
|||
|
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
public R<PageVo<VtbVerificationBatch>> getPage(VtbVerificationBatch param){ |
|||
LambdaQueryWrapper<VtbVerificationBatch> lqw = new LambdaQueryWrapper<>(param); |
|||
PageUtil.startPage(); |
|||
List<VtbVerificationBatch> list = vtbVerificationBatchService.list(lqw); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.Verification, title = "", biz = BizType.QUERY) |
|||
public R<VtbVerificationBatch> getById(@PathVariable("id") String id){ |
|||
VtbVerificationBatch vtbVerificationBatch = vtbVerificationBatchService.getById(id); |
|||
return R.ok(vtbVerificationBatch); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 提交批量 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/submit") |
|||
@SysLog(module = SystemModule.Verification, title = "批量核销", biz = BizType.INSERT) |
|||
public R<?> save(@RequestBody @Valid VtbVerificationBatchBo param){ |
|||
seeYonService.testConnection(); |
|||
vtbVerificationBatchService.submit(param); |
|||
return R.ok(); |
|||
} |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,136 @@ |
|||
package com.qs.serve.modules.vtb.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* @author YenHex |
|||
* @since 2024-06-14 |
|||
*/ |
|||
@Data |
|||
@TableName("vtb_verification_batch") |
|||
public class VtbVerificationBatch implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 批次编码 */ |
|||
@NotBlank(message = "批次编码不能为空") |
|||
@Length(max = 255,message = "批次编码长度不能超过255字") |
|||
private String vtbBatchCode; |
|||
|
|||
/** 状态 */ |
|||
@NotNull(message = "状态不能为空") |
|||
private Integer vtbBatchStatus; |
|||
|
|||
/** 核销通过时间 */ |
|||
@Length(max = 0,message = "核销通过时间长度不能超过0字") |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
private LocalDateTime finishedTime; |
|||
|
|||
/** 费用id */ |
|||
private Long costApplyId; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 600,message = "备注长度不能超过600字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 致远表单ID */ |
|||
@Length(max = 32,message = "致远表单ID长度不能超过32字") |
|||
private String syFormId; |
|||
|
|||
/** 致远流程id */ |
|||
@Length(max = 32,message = "致远流程id长度不能超过32字") |
|||
private String syFlowId; |
|||
|
|||
/** 客户id */ |
|||
@NotNull(message = "客户id不能为空") |
|||
private Long supplierId; |
|||
|
|||
/** 客户编码 */ |
|||
@NotBlank(message = "客户编码不能为空") |
|||
@Length(max = 30,message = "客户编码长度不能超过30字") |
|||
private String supplierCode; |
|||
|
|||
/** 客户名称 */ |
|||
@NotBlank(message = "客户名称不能为空") |
|||
@Length(max = 200,message = "客户名称长度不能超过200字") |
|||
private String supplierName; |
|||
|
|||
/** 申请人 */ |
|||
@NotBlank(message = "申请人不能为空") |
|||
@Length(max = 32,message = "申请人长度不能超过32字") |
|||
private String userId; |
|||
|
|||
/** 申请人 */ |
|||
@NotBlank(message = "申请人不能为空") |
|||
@Length(max = 32,message = "申请人长度不能超过32字") |
|||
private String userCode; |
|||
|
|||
/** 申请人 */ |
|||
@NotBlank(message = "申请人不能为空") |
|||
@Length(max = 32,message = "申请人长度不能超过32字") |
|||
private String userName; |
|||
|
|||
/** 业务继承人ID */ |
|||
@Length(max = 255,message = "业务继承人ID长度不能超过255字") |
|||
private String extUserId; |
|||
|
|||
/** 业务继承人编码 */ |
|||
@Length(max = 255,message = "业务继承人编码长度不能超过255字") |
|||
private String extUserCode; |
|||
|
|||
/** 业务继承人 */ |
|||
@Length(max = 255,message = "业务继承人长度不能超过255字") |
|||
private String extUserName; |
|||
|
|||
} |
|||
|
@ -0,0 +1,26 @@ |
|||
package com.qs.serve.modules.vtb.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2024/6/19 |
|||
*/ |
|||
@Data |
|||
public class VtbVerificationBatchBo { |
|||
|
|||
/** 核销列表 */ |
|||
List<VtbVerificationBo> verificationList; |
|||
|
|||
/** 备注 */ |
|||
private String remark; |
|||
|
|||
/** 支付方式 */ |
|||
private Long payWayId; |
|||
|
|||
/** 费用申请ID */ |
|||
private Long costApplyId; |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.vtb.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.vtb.entity.VtbVerificationBatch; |
|||
|
|||
/** |
|||
* Mapper |
|||
* @author YenHex |
|||
* @date 2024-06-14 |
|||
*/ |
|||
public interface VtbVerificationBatchMapper extends BaseMapper<VtbVerificationBatch> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.vtb.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.vtb.entity.VtbVerificationBatch; |
|||
import com.qs.serve.modules.vtb.entity.bo.VtbVerificationBatchBo; |
|||
|
|||
/** |
|||
* 服务接口 |
|||
* @author YenHex |
|||
* @date 2024-06-14 |
|||
*/ |
|||
public interface VtbVerificationBatchService extends IService<VtbVerificationBatch> { |
|||
|
|||
/** |
|||
* 提交批量核销 |
|||
* @param submitBo |
|||
*/ |
|||
void submit(VtbVerificationBatchBo submitBo); |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,49 @@ |
|||
package com.qs.serve.modules.vtb.service.impl; |
|||
|
|||
import com.qs.serve.modules.seeyon.service.SeeYonOperationService; |
|||
import com.qs.serve.modules.tbs.entity.bo.TbsAffairCommitBo; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2024/6/14 |
|||
*/ |
|||
@Service |
|||
public class VtbVerificationBatchOperationServiceImpl implements SeeYonOperationService { |
|||
|
|||
@Override |
|||
public String getTemplateCode() { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public String getSyFormIdByTargetInfo(TbsAffairCommitBo affairCommit) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public Object doBacked(TbsAffairCommitBo param) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public Object doFinished(TbsAffairCommitBo param) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public Object doRefuse(TbsAffairCommitBo param) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public boolean checkSyFormIdIsNotNull(String targetId) { |
|||
return false; |
|||
} |
|||
|
|||
@Override |
|||
public void doCommitBacked(String targetId) { |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,316 @@ |
|||
package com.qs.serve.modules.vtb.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.qs.serve.common.framework.redis.RedisService; |
|||
import com.qs.serve.common.util.*; |
|||
import com.qs.serve.modules.bms.entity.*; |
|||
import com.qs.serve.modules.bms.mapper.BmsRegion2Mapper; |
|||
import com.qs.serve.modules.bms.mapper.BmsRegionMapper; |
|||
import com.qs.serve.modules.bms.service.BmsChannelPointService; |
|||
import com.qs.serve.modules.bms.service.BmsChannelService; |
|||
import com.qs.serve.modules.bms.service.BmsSubjectService; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|||
import com.qs.serve.modules.pay.entity.PayWay; |
|||
import com.qs.serve.modules.pay.mapper.PayWayMapper; |
|||
import com.qs.serve.modules.sys.entity.SysUser; |
|||
import com.qs.serve.modules.sys.service.SysUserService; |
|||
import com.qs.serve.modules.tbs.common.TbsActivityState; |
|||
import com.qs.serve.modules.tbs.entity.TbsActivity; |
|||
import com.qs.serve.modules.tbs.entity.TbsCostApply; |
|||
import com.qs.serve.modules.tbs.service.TbsActivityService; |
|||
import com.qs.serve.modules.tbs.service.TbsCostApplyService; |
|||
import com.qs.serve.modules.vtb.common.VerificationUtil; |
|||
import com.qs.serve.modules.vtb.common.VtbVerificationState; |
|||
import com.qs.serve.modules.vtb.entity.*; |
|||
import com.qs.serve.modules.vtb.entity.bo.*; |
|||
import com.qs.serve.modules.vtb.service.*; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.vtb.mapper.VtbVerificationBatchMapper; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 服务实现类 |
|||
* @author YenHex |
|||
* @since 2024-06-14 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class VtbVerificationBatchServiceImpl extends ServiceImpl<VtbVerificationBatchMapper,VtbVerificationBatch> implements VtbVerificationBatchService { |
|||
|
|||
private final BmsRegionMapper regionMapper; |
|||
private final BmsRegion2Mapper region2Mapper; |
|||
private final RedisService redisService; |
|||
private final BmsSupplierService bmsSupplierService; |
|||
private final TbsActivityService tbsActivityService; |
|||
private final TbsCostApplyService tbsCostApplyService; |
|||
private final SysUserService sysUserService; |
|||
private final VtbVerificationService vtbVerificationService; |
|||
private final PayWayMapper payWayMapper; |
|||
private final BmsSubjectService subjectService; |
|||
private final BmsChannelService channelService; |
|||
private final BmsChannelPointService channelPointService; |
|||
private final VtbVerificationChannelService verificationChannelService; |
|||
private final VtbVerificationChannelPointService verificationChannelPointService; |
|||
private final VtbVerificationSubjectService verificationSubjectService; |
|||
private final VtbVerificationSubjectCenterService vtbVerificationSubjectCenterService; |
|||
private final VtbFundFlowService vtbFundFlowService; |
|||
|
|||
|
|||
@Override |
|||
public void submit(VtbVerificationBatchBo submitBo) { |
|||
TbsCostApply costApply = tbsCostApplyService.getById(submitBo.getCostApplyId()); |
|||
BmsSupplier supplier = bmsSupplierService.getById(costApply.getSupplierId()); |
|||
List<TbsActivity> activityList = tbsActivityService.listByCostApplyId(costApply.getId()); |
|||
SysUser sysUser = sysUserService.getById(AuthContextUtils.getSysUserId()); |
|||
sysUser.checkSyAccount(); |
|||
redisService.throwResLock(VtbVerificationBatch.class.getSimpleName(),submitBo.getCostApplyId()+""); |
|||
// 校验核销状态
|
|||
VerificationUtil.verifyCostState(costApply); |
|||
|
|||
boolean contractFlag = costApply.getContractFlag()!=null&&costApply.getContractFlag().equals(1); |
|||
if(contractFlag){ |
|||
Assert.throwEx("协议类申请请移至OA核销"); |
|||
} |
|||
|
|||
LambdaQueryWrapper<VtbVerification> vtbVerificationLQW = new LambdaQueryWrapper<>(); |
|||
vtbVerificationLQW.eq(VtbVerification::getCostApplyId,costApply.getId()); |
|||
vtbVerificationLQW.eq(VtbVerification::getVerificationState, VtbVerificationState.Commiting); |
|||
long count = vtbVerificationService.count(vtbVerificationLQW); |
|||
if(count>0){ |
|||
Assert.throwEx("部分活动正在核销中"); |
|||
} |
|||
|
|||
//协议类申请
|
|||
PayWay payWay = new PayWay(); |
|||
if(submitBo.getPayWayId()!=null){ |
|||
payWay = payWayMapper.selectById(submitBo.getPayWayId()); |
|||
} |
|||
|
|||
//加载大区信息
|
|||
String saleRegionId = supplier.handleSaleRegionId(); |
|||
BmsRegion saleRegion = regionMapper.selectById(saleRegionId); |
|||
String saleBizNames = saleRegion!=null?saleRegion.getPathNames():"null_申请时未录入"; |
|||
|
|||
String bizRegionId = supplier.handleBizRegionId(); |
|||
BmsRegion2 bizRegion = region2Mapper.selectById(bizRegionId); |
|||
String bizBizNames = bizRegion!=null?bizRegion.getPathNames():"null_申请时未录入"; |
|||
|
|||
//退回的核销 重新申请后标记为关闭
|
|||
List<Long> orgVerificationIds = new ArrayList<>(); |
|||
|
|||
//新的核销列表
|
|||
List<VtbVerification> newVerificationList = new ArrayList<>(); |
|||
|
|||
List<VtbVerificationChannel> allVerificationChannelList = new ArrayList<>(); |
|||
List<VtbVerificationChannelPoint> allVerificationChannelPointList = new ArrayList<>(); |
|||
|
|||
List<VtbVerificationSubject> allVerificationSubjects = new ArrayList<>(); |
|||
List<VtbVerificationSubjectCenter> allVerificationCenters = new ArrayList<>(); |
|||
|
|||
//校验BO参数
|
|||
for (VtbVerificationBo verificationBo : submitBo.getVerificationList()) { |
|||
for (TbsActivity activity : activityList) { |
|||
if(verificationBo.getActivityId().equals(activity.getId())){ |
|||
//自定义成本中心核销
|
|||
List<VtbVerificationSubjectCenterBo> subjectCenterBoList = verificationBo.getSubjectCenterList(); |
|||
boolean isCenterCheck = CollectionUtil.isNotEmpty(subjectCenterBoList); |
|||
if(activity.getVtbMatchTypeFlag().equals(1) && !isCenterCheck){ |
|||
Assert.throwEx("页面参数异常,请刷新页面重试"); |
|||
} |
|||
VtbVerification orgData = null; |
|||
if(verificationBo.getOrgVerificationId()!=null){ |
|||
orgData = vtbVerificationService.getById(verificationBo.getOrgVerificationId()); |
|||
if(!orgData.getVerificationState().equals(VtbVerificationState.Rollback.getCode())){ |
|||
Assert.throwEx("原来的核销数据非回退状态"); |
|||
} |
|||
orgVerificationIds.add(orgData.getId()); |
|||
} |
|||
|
|||
boolean isCurrentCommit = verificationBo.getId()!=null; |
|||
vtbVerificationService.validActivity(false,activity,true,isCurrentCommit); |
|||
|
|||
//创建 verification
|
|||
VtbVerification verification = new VtbVerification(); |
|||
//临时ID
|
|||
verification.setId(activity.getId()); |
|||
|
|||
verification.setCostApplyCode(costApply.getCode()); |
|||
verification.setActivityCode(activity.getActivityCode()); |
|||
verification.setPayConditionId(verificationBo.getPayConditionId()); |
|||
verification.setVerificationCode("HX"+ CodeGenUtil.generate(CodeGenUtil.SourceKey.Verification)); |
|||
verification.setVerificationMainCode(verification.getVerificationCode()); |
|||
verification.setVerificationState(VtbVerificationState.Commiting.getCode()); |
|||
verification.setCostApplyId(costApply.getId()); |
|||
verification.setActivityId(verificationBo.getActivityId()); |
|||
verification.setAttachIds(verificationBo.getAttachIds()); |
|||
verification.setInputReleaseFlag(verificationBo.getInputReleaseFlag()); |
|||
if(verificationBo.getInputReleaseFlag()!=null&&verificationBo.getInputReleaseFlag().equals(0)){ |
|||
verification.setRegReleaseFlag(1); |
|||
} |
|||
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.setRemark(verificationBo.getRemark()); |
|||
verification.setWayId(payWay.getId()); |
|||
verification.setWayTitle(payWay.getTitle()); |
|||
verification.setSupplierBizRegionFirstName(costApply.getSupplierBizRegionFirstName()); |
|||
verification.setSupplierBizRegionSecondName(costApply.getSupplierBizRegionSecondName()); |
|||
verification.setSupplierBizRegionThirdName(costApply.getSupplierBizRegionThirdName()); |
|||
List<VtbVerificationChannelBo> channelBoList = verificationBo.getChannelList(); |
|||
List<VtbVerificationChannelPointBo> pointBoList = verificationBo.getPointList(); |
|||
if(CollectionUtil.isNotEmpty(channelBoList)){ |
|||
for (VtbVerificationChannelBo channelBo : channelBoList) { |
|||
BmsChannel channel = channelService.getById(channelBo.getChannelId()); |
|||
VtbVerificationChannel verificationChannel = new VtbVerificationChannel(); |
|||
verificationChannel.setActivityId(activity.getId()); |
|||
verificationChannel.setCostApplyId(costApply.getId()); |
|||
verificationChannel.setVerificationId(verification.getId()); |
|||
verificationChannel.setChannelId(channel.getId()); |
|||
verificationChannel.setChannelCode(channel.getChannelCode()); |
|||
verificationChannel.setChannelName(channel.getChannelName()); |
|||
verificationChannel.setChannelRate(channelBo.getChannelRate()); |
|||
verificationChannel.setPreCountPoint(channelBo.getPreCountPoint()); |
|||
verificationChannel.setRemark(channelBo.getRemark()); |
|||
allVerificationChannelList.add(verificationChannel); |
|||
} |
|||
}else if (CollectionUtil.isNotEmpty(pointBoList)){ |
|||
for (VtbVerificationChannelPointBo channelPointBo : pointBoList) { |
|||
BmsChannelPoint channelPoint = channelPointService.getById(channelPointBo.getPointId()); |
|||
BmsChannel channel = channelService.getById(channelPoint.getChannelId()); |
|||
VtbVerificationChannelPoint channelPoint1 = new VtbVerificationChannelPoint(); |
|||
channelPoint1.setCostApplyId(costApply.getId()); |
|||
channelPoint1.setActivityId(activity.getId()); |
|||
channelPoint1.setChannelId(channel.getId()); |
|||
channelPoint1.setVerificationId(verification.getId()); |
|||
channelPoint1.setChannelCode(channel.getChannelCode()); |
|||
channelPoint1.setChannelName(channel.getChannelName()); |
|||
channelPoint1.setPointId(channelPoint.getId()); |
|||
channelPoint1.setPointCode(channelPoint.getPointCode()); |
|||
channelPoint1.setPointName(channelPoint.getPointName()); |
|||
channelPoint1.setPointRate(channelPointBo.getPointRate()); |
|||
channelPoint1.setRemark(channelPointBo.getRemark()); |
|||
allVerificationChannelPointList.add(channelPoint1); |
|||
} |
|||
} |
|||
|
|||
List<VtbVerificationSubject> verificationSubjects = new ArrayList<>(); |
|||
List<VtbVerificationSubjectCenter> verificationCenters = new ArrayList<>(); |
|||
String verificationCode = verification.getVerificationCode(); |
|||
if(isCenterCheck){ |
|||
//建立核销 VtbVerificationSubjectCenter
|
|||
vtbVerificationService.validCreateVeriSubjectAndCenter(activity, subjectCenterBoList, costApply, supplier, verificationSubjects, verificationCenters, verificationCode); |
|||
}else { |
|||
//建立核销 VtbVerificationSubject
|
|||
verificationSubjects = vtbVerificationService.validCreateVeriSubject(verificationCode,verificationBo, activity, costApply, supplier); |
|||
} |
|||
//设置总金额
|
|||
BigDecimal totalAmount = BigDecimal.ZERO; |
|||
for (VtbVerificationSubject verificationSubject : verificationSubjects) { |
|||
totalAmount = totalAmount.add(verificationSubject.getUsedAmount()); |
|||
} |
|||
verification.setAmount(totalAmount); |
|||
verification.setAmountRecord(totalAmount); |
|||
|
|||
//保存
|
|||
newVerificationList.add(verification); |
|||
|
|||
//保存科目费用
|
|||
verificationSubjects.forEach(obj->obj.setVerificationId(verification.getId())); |
|||
verificationCenters.forEach(obj->obj.setVerificationId(verification.getId())); |
|||
|
|||
allVerificationSubjects.addAll(verificationSubjects); |
|||
allVerificationCenters.addAll(verificationCenters); |
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
//TODO 提交审批
|
|||
|
|||
//移除历史提交记录
|
|||
for (Long orgVerificationId : orgVerificationIds) { |
|||
verificationChannelService.removeByVerificationId(orgVerificationId); |
|||
verificationChannelPointService.removeByVerificationId(orgVerificationId); |
|||
verificationSubjectService.removeByVerificationId(orgVerificationId); |
|||
vtbVerificationSubjectCenterService.removeByVerificationId(orgVerificationId); |
|||
vtbFundFlowService.removeByVerificationId(orgVerificationId); |
|||
} |
|||
|
|||
//获取临时ID重新赋值
|
|||
//List<Long> activityIds = newVerificationList.stream().map(VtbVerification::getId).collect(Collectors.toList());
|
|||
|
|||
Map<Long,List<VtbVerificationChannel>> allVerificationChannelListMap = allVerificationChannelList.stream() |
|||
.collect(Collectors.groupingBy(VtbVerificationChannel::getVerificationId)); |
|||
Map<Long,List<VtbVerificationChannelPoint>> allVerificationChannelPointListMap = allVerificationChannelPointList.stream() |
|||
.collect(Collectors.groupingBy(VtbVerificationChannelPoint::getVerificationId)); |
|||
|
|||
Map<Long,List<VtbVerificationSubject>> allVerificationSubjectsMap = allVerificationSubjects.stream() |
|||
.collect(Collectors.groupingBy(VtbVerificationSubject::getVerificationId)); |
|||
Map<Long,List<VtbVerificationSubjectCenter>> allVerificationCentersMap = allVerificationCenters.stream() |
|||
.collect(Collectors.groupingBy(VtbVerificationSubjectCenter::getVerificationId)); |
|||
|
|||
|
|||
for (VtbVerification verification : newVerificationList) { |
|||
//临时ID,实际是活动ID
|
|||
Long tmpId = verification.getId(); |
|||
|
|||
verification.setId(null); |
|||
vtbVerificationService.save(verification); |
|||
Long verificationId = verification.getId(); |
|||
|
|||
List<VtbVerificationChannel> vtbVerificationChannels = allVerificationChannelListMap.get(tmpId); |
|||
if(vtbVerificationChannels!=null){ |
|||
vtbVerificationChannels.forEach(a->a.setVerificationId(verificationId)); |
|||
verificationChannelService.saveBatch(vtbVerificationChannels); |
|||
} |
|||
|
|||
List<VtbVerificationChannelPoint> verificationChannelPointList = allVerificationChannelPointListMap.get(tmpId); |
|||
if(verificationChannelPointList!=null){ |
|||
verificationChannelPointList.forEach(a->a.setVerificationId(verificationId)); |
|||
verificationChannelPointService.saveBatch(verificationChannelPointList); |
|||
} |
|||
|
|||
List<VtbVerificationSubject> verificationSubjects = allVerificationSubjectsMap.get(tmpId); |
|||
if(verificationSubjects!=null){ |
|||
verificationSubjects.forEach(a->a.setVerificationId(verificationId)); |
|||
verificationSubjectService.saveBatch(verificationSubjects); |
|||
} |
|||
|
|||
List<VtbVerificationSubjectCenter> vtbVerificationSubjectCenterList = allVerificationCentersMap.get(tmpId); |
|||
if(vtbVerificationSubjectCenterList!=null){ |
|||
vtbVerificationSubjectCenterList.forEach(a->a.setVerificationId(verificationId)); |
|||
vtbVerificationSubjectCenterService.saveBatch(vtbVerificationSubjectCenterList); |
|||
} |
|||
|
|||
//更新活动状态
|
|||
TbsActivity activityParam = new TbsActivity(); |
|||
activityParam.setId(verification.getActivityId()); |
|||
activityParam.setActivityState(TbsActivityState.STATE_1_Checking); |
|||
activityParam.setCurrVerificationId(verification.getId()+""); |
|||
tbsActivityService.updateById(activityParam); |
|||
|
|||
} |
|||
|
|||
//更变费用申请的活动状态
|
|||
TbsCostApply costApplyParam = new TbsCostApply(); |
|||
costApplyParam.setId(costApply.getId()); |
|||
costApplyParam.setCheckState(1); |
|||
tbsCostApplyService.updateById(costApplyParam); |
|||
|
|||
} |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue