|
@ -1,9 +1,17 @@ |
|
|
package com.qs.serve.modules.vtb.service.impl; |
|
|
package com.qs.serve.modules.vtb.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
|
import com.qs.serve.common.config.properties.ProjectProperties; |
|
|
import com.qs.serve.common.framework.redis.RedisService; |
|
|
import com.qs.serve.common.framework.redis.RedisService; |
|
|
|
|
|
import com.qs.serve.common.model.dto.R; |
|
|
|
|
|
import com.qs.serve.common.model.oa.OaFormMainProcess; |
|
|
|
|
|
import com.qs.serve.common.model.oa.OaUploadFile; |
|
|
import com.qs.serve.common.util.*; |
|
|
import com.qs.serve.common.util.*; |
|
|
|
|
|
import com.qs.serve.common.util.model.DateFormatString; |
|
|
import com.qs.serve.modules.bms.entity.*; |
|
|
import com.qs.serve.modules.bms.entity.*; |
|
|
import com.qs.serve.modules.bms.mapper.BmsRegion2Mapper; |
|
|
import com.qs.serve.modules.bms.mapper.BmsRegion2Mapper; |
|
|
import com.qs.serve.modules.bms.mapper.BmsRegionMapper; |
|
|
import com.qs.serve.modules.bms.mapper.BmsRegionMapper; |
|
@ -13,28 +21,39 @@ import com.qs.serve.modules.bms.service.BmsSubjectService; |
|
|
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|
|
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|
|
import com.qs.serve.modules.pay.entity.PayWay; |
|
|
import com.qs.serve.modules.pay.entity.PayWay; |
|
|
import com.qs.serve.modules.pay.mapper.PayWayMapper; |
|
|
import com.qs.serve.modules.pay.mapper.PayWayMapper; |
|
|
|
|
|
import com.qs.serve.modules.seeyon.entity.BaseCreateCallbackBo; |
|
|
|
|
|
import com.qs.serve.modules.seeyon.service.SeeYonRequestService; |
|
|
|
|
|
import com.qs.serve.modules.sys.entity.SysAttach; |
|
|
import com.qs.serve.modules.sys.entity.SysUser; |
|
|
import com.qs.serve.modules.sys.entity.SysUser; |
|
|
|
|
|
import com.qs.serve.modules.sys.service.SysAttachService; |
|
|
import com.qs.serve.modules.sys.service.SysUserService; |
|
|
import com.qs.serve.modules.sys.service.SysUserService; |
|
|
|
|
|
import com.qs.serve.modules.tag.mapper.TagInfoMapper; |
|
|
import com.qs.serve.modules.tbs.common.TbsActivityState; |
|
|
import com.qs.serve.modules.tbs.common.TbsActivityState; |
|
|
|
|
|
import com.qs.serve.modules.tbs.common.TbsSeeYonConst; |
|
|
import com.qs.serve.modules.tbs.entity.TbsActivity; |
|
|
import com.qs.serve.modules.tbs.entity.TbsActivity; |
|
|
|
|
|
import com.qs.serve.modules.tbs.entity.TbsActivityCenter; |
|
|
|
|
|
import com.qs.serve.modules.tbs.entity.TbsActivitySubject; |
|
|
import com.qs.serve.modules.tbs.entity.TbsCostApply; |
|
|
import com.qs.serve.modules.tbs.entity.TbsCostApply; |
|
|
|
|
|
import com.qs.serve.modules.tbs.entity.dto.TbsCostSubItem; |
|
|
|
|
|
import com.qs.serve.modules.tbs.service.TbsActivityCenterService; |
|
|
import com.qs.serve.modules.tbs.service.TbsActivityService; |
|
|
import com.qs.serve.modules.tbs.service.TbsActivityService; |
|
|
|
|
|
import com.qs.serve.modules.tbs.service.TbsActivitySubjectService; |
|
|
import com.qs.serve.modules.tbs.service.TbsCostApplyService; |
|
|
import com.qs.serve.modules.tbs.service.TbsCostApplyService; |
|
|
import com.qs.serve.modules.vtb.common.VerificationUtil; |
|
|
import com.qs.serve.modules.vtb.common.VerificationUtil; |
|
|
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.*; |
|
|
import com.qs.serve.modules.vtb.entity.bo.*; |
|
|
|
|
|
import com.qs.serve.modules.vtb.entity.dto.VtbSubjectDTO; |
|
|
import com.qs.serve.modules.vtb.service.*; |
|
|
import com.qs.serve.modules.vtb.service.*; |
|
|
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; |
|
|
import com.qs.serve.modules.vtb.mapper.VtbVerificationBatchMapper; |
|
|
import com.qs.serve.modules.vtb.mapper.VtbVerificationBatchMapper; |
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.util.ArrayList; |
|
|
import java.time.LocalDateTime; |
|
|
import java.util.HashMap; |
|
|
import java.util.*; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -53,6 +72,8 @@ public class VtbVerificationBatchServiceImpl extends ServiceImpl<VtbVerification |
|
|
private final BmsSupplierService bmsSupplierService; |
|
|
private final BmsSupplierService bmsSupplierService; |
|
|
private final TbsActivityService tbsActivityService; |
|
|
private final TbsActivityService tbsActivityService; |
|
|
private final TbsCostApplyService tbsCostApplyService; |
|
|
private final TbsCostApplyService tbsCostApplyService; |
|
|
|
|
|
private final TbsActivitySubjectService tbsActivitySubjectService; |
|
|
|
|
|
private final TbsActivityCenterService tbsActivityCenterService; |
|
|
private final SysUserService sysUserService; |
|
|
private final SysUserService sysUserService; |
|
|
private final VtbVerificationService vtbVerificationService; |
|
|
private final VtbVerificationService vtbVerificationService; |
|
|
private final PayWayMapper payWayMapper; |
|
|
private final PayWayMapper payWayMapper; |
|
@ -64,10 +85,15 @@ public class VtbVerificationBatchServiceImpl extends ServiceImpl<VtbVerification |
|
|
private final VtbVerificationSubjectService verificationSubjectService; |
|
|
private final VtbVerificationSubjectService verificationSubjectService; |
|
|
private final VtbVerificationSubjectCenterService vtbVerificationSubjectCenterService; |
|
|
private final VtbVerificationSubjectCenterService vtbVerificationSubjectCenterService; |
|
|
private final VtbFundFlowService vtbFundFlowService; |
|
|
private final VtbFundFlowService vtbFundFlowService; |
|
|
|
|
|
private final ProjectProperties projectProperties; |
|
|
|
|
|
private final TagInfoMapper tagInfoMapper; |
|
|
|
|
|
private SysAttachService sysAttachService; |
|
|
|
|
|
private SeeYonRequestService seeYonService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void submit(VtbVerificationBatchBo submitBo) { |
|
|
public void submit(VtbVerificationBatchBo submitBo) { |
|
|
|
|
|
String templateCode = TbsSeeYonConst.BatchCostCheckConf.Code(); |
|
|
TbsCostApply costApply = tbsCostApplyService.getById(submitBo.getCostApplyId()); |
|
|
TbsCostApply costApply = tbsCostApplyService.getById(submitBo.getCostApplyId()); |
|
|
BmsSupplier supplier = bmsSupplierService.getById(costApply.getSupplierId()); |
|
|
BmsSupplier supplier = bmsSupplierService.getById(costApply.getSupplierId()); |
|
|
List<TbsActivity> activityList = tbsActivityService.listByCostApplyId(costApply.getId()); |
|
|
List<TbsActivity> activityList = tbsActivityService.listByCostApplyId(costApply.getId()); |
|
@ -117,7 +143,210 @@ public class VtbVerificationBatchServiceImpl extends ServiceImpl<VtbVerification |
|
|
List<VtbVerificationSubject> allVerificationSubjects = new ArrayList<>(); |
|
|
List<VtbVerificationSubject> allVerificationSubjects = new ArrayList<>(); |
|
|
List<VtbVerificationSubjectCenter> allVerificationCenters = new ArrayList<>(); |
|
|
List<VtbVerificationSubjectCenter> allVerificationCenters = new ArrayList<>(); |
|
|
|
|
|
|
|
|
//校验BO参数
|
|
|
//主创建方法,校验BO参数和创建数据
|
|
|
|
|
|
this.mainCheckAndCreateBatchItemData(submitBo, costApply, supplier, activityList, sysUser, payWay, |
|
|
|
|
|
orgVerificationIds, newVerificationList, allVerificationChannelList, allVerificationChannelPointList, |
|
|
|
|
|
allVerificationSubjects, allVerificationCenters); |
|
|
|
|
|
|
|
|
|
|
|
VtbVerificationBatch verificationBatch = new VtbVerificationBatch(); |
|
|
|
|
|
verificationBatch.setVtbBatchCode("BHX"+ CodeGenUtil.generate(CodeGenUtil.SourceKey.VerificationBatch)); |
|
|
|
|
|
verificationBatch.setVtbBatchStatus(0); |
|
|
|
|
|
verificationBatch.setCostApplyId(costApply.getId()); |
|
|
|
|
|
//verificationBatch.setRemark();
|
|
|
|
|
|
//verificationBatch.setSyFormId();
|
|
|
|
|
|
//verificationBatch.setSyFlowId();
|
|
|
|
|
|
verificationBatch.setSupplierId(supplier.getId()); |
|
|
|
|
|
verificationBatch.setSupplierCode(supplier.getCode()); |
|
|
|
|
|
verificationBatch.setSupplierName(supplier.getName()); |
|
|
|
|
|
verificationBatch.setUserId(sysUser.getId()); |
|
|
|
|
|
verificationBatch.setUserCode(sysUser.getCode()); |
|
|
|
|
|
verificationBatch.setUserName(sysUser.getName()); |
|
|
|
|
|
this.save(verificationBatch); |
|
|
|
|
|
|
|
|
|
|
|
String batchId = verificationBatch.getId()+""; |
|
|
|
|
|
Map<String, Object> newWayData = new HashMap<>(); |
|
|
|
|
|
Map<String, Object> data = new HashMap<>(); |
|
|
|
|
|
List<OaUploadFile> uploadFileList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
//创建OA参数data
|
|
|
|
|
|
this.buildBatchOAData(submitBo, templateCode, costApply, supplier, sysUser, saleBizNames, bizBizNames, |
|
|
|
|
|
verificationBatch, batchId, newWayData, data, uploadFileList); |
|
|
|
|
|
|
|
|
|
|
|
OaFormMainProcess mainProcess = new OaFormMainProcess(); |
|
|
|
|
|
mainProcess.setTargetId(batchId); |
|
|
|
|
|
mainProcess.setUploadFiles(uploadFileList); |
|
|
|
|
|
newWayData.put("formmain_2178",data); |
|
|
|
|
|
mainProcess.setTableName("formmain_2178"); |
|
|
|
|
|
mainProcess.setData(newWayData); |
|
|
|
|
|
mainProcess.setTemplateCode(templateCode); |
|
|
|
|
|
mainProcess.setUserId(sysUser.getId()); |
|
|
|
|
|
mainProcess.setSenderLoginName(sysUser.getAccount()); |
|
|
|
|
|
R flowIdResult = seeYonService.newCreateProcess(mainProcess); |
|
|
|
|
|
|
|
|
|
|
|
if(flowIdResult==null||flowIdResult.getStatus()!=200){ |
|
|
|
|
|
assert flowIdResult != null; |
|
|
|
|
|
Assert.throwEx("远程服务调用失败:"+flowIdResult.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
if(flowIdResult.getMsg()!=null && flowIdResult.getMsg().length()>45){ |
|
|
|
|
|
log.error(flowIdResult.getMsg()); |
|
|
|
|
|
JSONObject object = JSON.parseObject(flowIdResult.getMsg()); |
|
|
|
|
|
if(!object.get("code").toString().equals("0")){ |
|
|
|
|
|
Assert.throwEx("流程发起被拦截了"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//移除历史提交记录
|
|
|
|
|
|
for (Long orgVerificationId : orgVerificationIds) { |
|
|
|
|
|
verificationChannelService.removeByVerificationId(orgVerificationId); |
|
|
|
|
|
verificationChannelPointService.removeByVerificationId(orgVerificationId); |
|
|
|
|
|
verificationSubjectService.removeByVerificationId(orgVerificationId); |
|
|
|
|
|
vtbVerificationSubjectCenterService.removeByVerificationId(orgVerificationId); |
|
|
|
|
|
vtbFundFlowService.removeByVerificationId(orgVerificationId); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
//关联批量ID
|
|
|
|
|
|
verification.setBatchId(batchId); |
|
|
|
|
|
vtbVerificationService.save(verification); |
|
|
|
|
|
Long verificationId = verification.getId(); |
|
|
|
|
|
|
|
|
|
|
|
this.saveVerificationRelateData(allVerificationChannelListMap, allVerificationChannelPointListMap, allVerificationSubjectsMap, allVerificationCentersMap, tmpId, verificationId); |
|
|
|
|
|
|
|
|
|
|
|
//更新活动状态
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
BaseCreateCallbackBo callbackBo = new BaseCreateCallbackBo(templateCode,batchId); |
|
|
|
|
|
seeYonService.createCallbackStatus(callbackBo); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 创建OA参数data |
|
|
|
|
|
* @param submitBo |
|
|
|
|
|
* @param templateCode |
|
|
|
|
|
* @param costApply |
|
|
|
|
|
* @param supplier |
|
|
|
|
|
* @param sysUser |
|
|
|
|
|
* @param saleBizNames |
|
|
|
|
|
* @param bizBizNames |
|
|
|
|
|
* @param verificationBatch |
|
|
|
|
|
* @param batchId |
|
|
|
|
|
* @param newWayData |
|
|
|
|
|
* @param data |
|
|
|
|
|
* @param uploadFileList |
|
|
|
|
|
*/ |
|
|
|
|
|
private void buildBatchOAData(VtbVerificationBatchBo submitBo, String templateCode, TbsCostApply costApply, |
|
|
|
|
|
BmsSupplier supplier, SysUser sysUser, String saleBizNames, String bizBizNames, |
|
|
|
|
|
VtbVerificationBatch verificationBatch, String batchId, Map<String, Object> newWayData, |
|
|
|
|
|
Map<String, Object> data, List<OaUploadFile> uploadFileList) { |
|
|
|
|
|
data.put("title", verificationBatch.getVtbBatchCode()); |
|
|
|
|
|
data.put("orgId", batchId); |
|
|
|
|
|
data.put("targetId", batchId); |
|
|
|
|
|
data.put("targetCode", verificationBatch.getVtbBatchCode()); |
|
|
|
|
|
data.put("applyUserCode", sysUser.getCode()); |
|
|
|
|
|
data.put("applyUserName", sysUser.getName()); |
|
|
|
|
|
data.put("supplierName", supplier.getName()); |
|
|
|
|
|
data.put("supplierCode", supplier.getCode()); |
|
|
|
|
|
data.put("exsp1", templateCode); |
|
|
|
|
|
data.put("exsp2", saleBizNames); |
|
|
|
|
|
data.put("biz_region", bizBizNames); |
|
|
|
|
|
//添加跳转地址业务
|
|
|
|
|
|
String urlKey = "exsp5"; |
|
|
|
|
|
String baseJumpUrl = JumpToUtil.getJumpUrl(projectProperties.getWebUrl(),TbsSeeYonConst.BatchCostCheckConf.Code(), batchId); |
|
|
|
|
|
data.put("exsp5",urlKey); |
|
|
|
|
|
data.put("cmsLink",baseJumpUrl); |
|
|
|
|
|
data.put("rowDate",DateUtils.format(LocalDateTime.now(), DateFormatString.DATE_TIME)); |
|
|
|
|
|
data.put("rowState","00"); |
|
|
|
|
|
//添加客户标签
|
|
|
|
|
|
List<String> tags = tagInfoMapper.lisTagsBySupplierCode(supplier.getCode()); |
|
|
|
|
|
data.put("tags",tags); |
|
|
|
|
|
|
|
|
|
|
|
List<String> oaAttachmentsIdList = new ArrayList<>(); |
|
|
|
|
|
submitBo.getVerificationList().forEach(obj->{ |
|
|
|
|
|
if(obj.getAttachIds()!=null && obj.getAttachIds().length>0){ |
|
|
|
|
|
oaAttachmentsIdList.addAll(Arrays.asList(obj.getAttachIds())); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//科目
|
|
|
|
|
|
List<TbsActivitySubject> subjectList = tbsActivitySubjectService.listByCostApplyId(costApply.getId()); |
|
|
|
|
|
List<VtbSubjectDTO> subjectDTOList = new ArrayList<>(); |
|
|
|
|
|
for (TbsActivitySubject activitySubject : subjectList) { |
|
|
|
|
|
VtbSubjectDTO subjectDTO = new VtbSubjectDTO(); |
|
|
|
|
|
subjectDTO.setKeMuName(activitySubject.getSubjectName()); |
|
|
|
|
|
subjectDTOList.add(subjectDTO); |
|
|
|
|
|
} |
|
|
|
|
|
newWayData.put("formson_2180",subjectDTOList); |
|
|
|
|
|
|
|
|
|
|
|
//成本中心
|
|
|
|
|
|
List<Object> centerDataList = new ArrayList<>(); |
|
|
|
|
|
List<TbsActivityCenter> activityCenter = tbsActivityCenterService.listByCostApplyId(costApply.getId()); |
|
|
|
|
|
for(TbsActivityCenter center : activityCenter){ |
|
|
|
|
|
TbsCostSubItem.CostCenterTranStr costCenter = new TbsCostSubItem.CostCenterTranStr(); |
|
|
|
|
|
if(costCenter.getChengBenZhongXin()==null){ |
|
|
|
|
|
costCenter.setChengBenZhongXin(center.getCenterName()); |
|
|
|
|
|
costCenter.setChengBenZhongXinId(center.getCenterType()+"-"+center.getId()); |
|
|
|
|
|
} |
|
|
|
|
|
centerDataList.add(costCenter); |
|
|
|
|
|
} |
|
|
|
|
|
newWayData.put("formson_2179",centerDataList); |
|
|
|
|
|
|
|
|
|
|
|
//加载附件
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(oaAttachmentsIdList)){ |
|
|
|
|
|
List<SysAttach> attachList = sysAttachService.listByIds(oaAttachmentsIdList); |
|
|
|
|
|
for (SysAttach sysAttach : attachList) { |
|
|
|
|
|
OaUploadFile uploadFile = new OaUploadFile(); |
|
|
|
|
|
uploadFile.setField("file"); |
|
|
|
|
|
uploadFile.setName("核销附件"+sysAttach.getName()); |
|
|
|
|
|
uploadFile.setUrl("https://qsjslservice.oss-cn-guangzhou.aliyuncs.com/"+sysAttach.getRelativePath()); |
|
|
|
|
|
uploadFileList.add(uploadFile); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 主创建方法,校验BO参数和创建数据 |
|
|
|
|
|
* @param submitBo |
|
|
|
|
|
* @param costApply |
|
|
|
|
|
* @param supplier |
|
|
|
|
|
* @param activityList |
|
|
|
|
|
* @param sysUser |
|
|
|
|
|
* @param payWay |
|
|
|
|
|
* @param orgVerificationIds |
|
|
|
|
|
* @param newVerificationList |
|
|
|
|
|
* @param allVerificationChannelList |
|
|
|
|
|
* @param allVerificationChannelPointList |
|
|
|
|
|
* @param allVerificationSubjects |
|
|
|
|
|
* @param allVerificationCenters |
|
|
|
|
|
*/ |
|
|
|
|
|
private void mainCheckAndCreateBatchItemData(VtbVerificationBatchBo submitBo, TbsCostApply costApply, BmsSupplier supplier, List<TbsActivity> activityList, SysUser sysUser, PayWay payWay, List<Long> orgVerificationIds, List<VtbVerification> newVerificationList, List<VtbVerificationChannel> allVerificationChannelList, List<VtbVerificationChannelPoint> allVerificationChannelPointList, List<VtbVerificationSubject> allVerificationSubjects, List<VtbVerificationSubjectCenter> allVerificationCenters) { |
|
|
for (VtbVerificationBo verificationBo : submitBo.getVerificationList()) { |
|
|
for (VtbVerificationBo verificationBo : submitBo.getVerificationList()) { |
|
|
for (TbsActivity activity : activityList) { |
|
|
for (TbsActivity activity : activityList) { |
|
|
if(verificationBo.getActivityId().equals(activity.getId())){ |
|
|
if(verificationBo.getActivityId().equals(activity.getId())){ |
|
@ -141,70 +370,13 @@ public class VtbVerificationBatchServiceImpl extends ServiceImpl<VtbVerification |
|
|
|
|
|
|
|
|
//创建 verification
|
|
|
//创建 verification
|
|
|
VtbVerification verification = new VtbVerification(); |
|
|
VtbVerification verification = new VtbVerification(); |
|
|
//临时ID
|
|
|
//临时ID 使用活动ID
|
|
|
verification.setId(activity.getId()); |
|
|
verification.setId(activity.getId()); |
|
|
|
|
|
// 给核销赋值
|
|
|
verification.setCostApplyCode(costApply.getCode()); |
|
|
this.verificationSetAssign(costApply, sysUser, payWay, verificationBo, activity, verification); |
|
|
verification.setActivityCode(activity.getActivityCode()); |
|
|
//创建核销相关数据(未存入数据库)
|
|
|
verification.setPayConditionId(verificationBo.getPayConditionId()); |
|
|
this.buildVerificationRelateData(costApply, allVerificationChannelList, allVerificationChannelPointList, |
|
|
verification.setVerificationCode("HX"+ CodeGenUtil.generate(CodeGenUtil.SourceKey.Verification)); |
|
|
verificationBo, activity, 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<VtbVerificationSubject> verificationSubjects = new ArrayList<>(); |
|
|
List<VtbVerificationSubjectCenter> verificationCenters = new ArrayList<>(); |
|
|
List<VtbVerificationSubjectCenter> verificationCenters = new ArrayList<>(); |
|
@ -237,80 +409,138 @@ public class VtbVerificationBatchServiceImpl extends ServiceImpl<VtbVerification |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//TODO 提交审批
|
|
|
/** |
|
|
|
|
|
* 给核销赋值 |
|
|
//移除历史提交记录
|
|
|
* @param costApply |
|
|
for (Long orgVerificationId : orgVerificationIds) { |
|
|
* @param sysUser |
|
|
verificationChannelService.removeByVerificationId(orgVerificationId); |
|
|
* @param payWay |
|
|
verificationChannelPointService.removeByVerificationId(orgVerificationId); |
|
|
* @param verificationBo |
|
|
verificationSubjectService.removeByVerificationId(orgVerificationId); |
|
|
* @param activity |
|
|
vtbVerificationSubjectCenterService.removeByVerificationId(orgVerificationId); |
|
|
* @param verification |
|
|
vtbFundFlowService.removeByVerificationId(orgVerificationId); |
|
|
*/ |
|
|
|
|
|
private void verificationSetAssign(TbsCostApply costApply, SysUser sysUser, PayWay payWay, |
|
|
|
|
|
VtbVerificationBo verificationBo, TbsActivity activity, |
|
|
|
|
|
VtbVerification verification) { |
|
|
|
|
|
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()); |
|
|
|
|
|
verification.setRemark(verificationBo.getRemark()); |
|
|
|
|
|
verification.setWayId(verificationBo.getPayWayId()); |
|
|
|
|
|
verification.setWayTitle(payWay.getTitle()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//获取临时ID重新赋值
|
|
|
/** |
|
|
//List<Long> activityIds = newVerificationList.stream().map(VtbVerification::getId).collect(Collectors.toList());
|
|
|
* 创建核销相关数据(未存入数据库) |
|
|
|
|
|
* @param costApply |
|
|
Map<Long,List<VtbVerificationChannel>> allVerificationChannelListMap = allVerificationChannelList.stream() |
|
|
* @param allVerificationChannelList |
|
|
.collect(Collectors.groupingBy(VtbVerificationChannel::getVerificationId)); |
|
|
* @param allVerificationChannelPointList |
|
|
Map<Long,List<VtbVerificationChannelPoint>> allVerificationChannelPointListMap = allVerificationChannelPointList.stream() |
|
|
* @param verificationBo |
|
|
.collect(Collectors.groupingBy(VtbVerificationChannelPoint::getVerificationId)); |
|
|
* @param activity |
|
|
|
|
|
* @param verification |
|
|
Map<Long,List<VtbVerificationSubject>> allVerificationSubjectsMap = allVerificationSubjects.stream() |
|
|
*/ |
|
|
.collect(Collectors.groupingBy(VtbVerificationSubject::getVerificationId)); |
|
|
private void buildVerificationRelateData(TbsCostApply costApply, List<VtbVerificationChannel> allVerificationChannelList, List<VtbVerificationChannelPoint> allVerificationChannelPointList, VtbVerificationBo verificationBo, TbsActivity activity, VtbVerification verification) { |
|
|
Map<Long,List<VtbVerificationSubjectCenter>> allVerificationCentersMap = allVerificationCenters.stream() |
|
|
List<VtbVerificationChannelBo> channelBoList = verificationBo.getChannelList(); |
|
|
.collect(Collectors.groupingBy(VtbVerificationSubjectCenter::getVerificationId)); |
|
|
List<VtbVerificationChannelPointBo> pointBoList = verificationBo.getPointList(); |
|
|
|
|
|
if(CollectionUtil.isNotEmpty(channelBoList)){ |
|
|
|
|
|
for (VtbVerificationChannelBo channelBo : channelBoList) { |
|
|
for (VtbVerification verification : newVerificationList) { |
|
|
BmsChannel channel = channelService.getById(channelBo.getChannelId()); |
|
|
//临时ID,实际是活动ID
|
|
|
VtbVerificationChannel verificationChannel = new VtbVerificationChannel(); |
|
|
Long tmpId = verification.getId(); |
|
|
verificationChannel.setActivityId(activity.getId()); |
|
|
|
|
|
verificationChannel.setCostApplyId(costApply.getId()); |
|
|
verification.setId(null); |
|
|
verificationChannel.setVerificationId(verification.getId()); |
|
|
vtbVerificationService.save(verification); |
|
|
verificationChannel.setChannelId(channel.getId()); |
|
|
Long verificationId = verification.getId(); |
|
|
verificationChannel.setChannelCode(channel.getChannelCode()); |
|
|
|
|
|
verificationChannel.setChannelName(channel.getChannelName()); |
|
|
List<VtbVerificationChannel> vtbVerificationChannels = allVerificationChannelListMap.get(tmpId); |
|
|
verificationChannel.setChannelRate(channelBo.getChannelRate()); |
|
|
if(vtbVerificationChannels!=null){ |
|
|
verificationChannel.setPreCountPoint(channelBo.getPreCountPoint()); |
|
|
vtbVerificationChannels.forEach(a->a.setVerificationId(verificationId)); |
|
|
verificationChannel.setRemark(channelBo.getRemark()); |
|
|
verificationChannelService.saveBatch(vtbVerificationChannels); |
|
|
allVerificationChannelList.add(verificationChannel); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
}else if (CollectionUtil.isNotEmpty(pointBoList)){ |
|
|
List<VtbVerificationSubjectCenter> vtbVerificationSubjectCenterList = allVerificationCentersMap.get(tmpId); |
|
|
for (VtbVerificationChannelPointBo channelPointBo : pointBoList) { |
|
|
if(vtbVerificationSubjectCenterList!=null){ |
|
|
BmsChannelPoint channelPoint = channelPointService.getById(channelPointBo.getPointId()); |
|
|
vtbVerificationSubjectCenterList.forEach(a->a.setVerificationId(verificationId)); |
|
|
BmsChannel channel = channelService.getById(channelPoint.getChannelId()); |
|
|
vtbVerificationSubjectCenterService.saveBatch(vtbVerificationSubjectCenterList); |
|
|
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); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//更新活动状态
|
|
|
/** |
|
|
TbsActivity activityParam = new TbsActivity(); |
|
|
* 保存核销相关数据 |
|
|
activityParam.setId(verification.getActivityId()); |
|
|
* @param allVerificationChannelListMap |
|
|
activityParam.setActivityState(TbsActivityState.STATE_1_Checking); |
|
|
* @param allVerificationChannelPointListMap |
|
|
activityParam.setCurrVerificationId(verification.getId()+""); |
|
|
* @param allVerificationSubjectsMap |
|
|
tbsActivityService.updateById(activityParam); |
|
|
* @param allVerificationCentersMap |
|
|
|
|
|
* @param tmpId |
|
|
|
|
|
* @param verificationId |
|
|
|
|
|
*/ |
|
|
|
|
|
private void saveVerificationRelateData(Map<Long, List<VtbVerificationChannel>> allVerificationChannelListMap, Map<Long, List<VtbVerificationChannelPoint>> allVerificationChannelPointListMap, Map<Long, List<VtbVerificationSubject>> allVerificationSubjectsMap, Map<Long, List<VtbVerificationSubjectCenter>> allVerificationCentersMap, Long tmpId, Long verificationId) { |
|
|
|
|
|
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); |
|
|
TbsCostApply costApplyParam = new TbsCostApply(); |
|
|
if(verificationSubjects!=null){ |
|
|
costApplyParam.setId(costApply.getId()); |
|
|
verificationSubjects.forEach(a->a.setVerificationId(verificationId)); |
|
|
costApplyParam.setCheckState(1); |
|
|
verificationSubjectService.saveBatch(verificationSubjects); |
|
|
tbsCostApplyService.updateById(costApplyParam); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<VtbVerificationSubjectCenter> vtbVerificationSubjectCenterList = allVerificationCentersMap.get(tmpId); |
|
|
|
|
|
if(vtbVerificationSubjectCenterList!=null){ |
|
|
|
|
|
vtbVerificationSubjectCenterList.forEach(a->a.setVerificationId(verificationId)); |
|
|
|
|
|
vtbVerificationSubjectCenterService.saveBatch(vtbVerificationSubjectCenterList); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public List<VtbVerification> listVerifications(Long batchId) { |
|
|
|
|
|
return vtbVerificationService |
|
|
|
|
|
.list(new LambdaQueryWrapper<VtbVerification>() |
|
|
|
|
|
.eq(VtbVerification::getBatchId,batchId)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|