Commit c12a27a6 authored by liao_ds's avatar liao_ds

营销-平台活动-报名

parent 95107b54
...@@ -240,11 +240,17 @@ public class PlatformActivitySignUpServiceImpl implements IPlatformActivitySignU ...@@ -240,11 +240,17 @@ public class PlatformActivitySignUpServiceImpl implements IPlatformActivitySignU
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
private List<PlatformActivityGoodsDO> convertPlatformActivityGoodsDOList(PfActivitySignUpAddReq addReq,PlatformActivityDO activityDO){ private List<PlatformActivityGoodsDO> convertPlatformActivityGoodsDOList(PfActivitySignUpAddReq addReq,PlatformActivityDO activityDO,UserLoginCacheDTO sysUser,Long signUpId){
List<PlatformActivityGoodsDO> goodsDOS=new ArrayList<>(); List<PlatformActivityGoodsDO> goodsDOS=new ArrayList<>();
addReq.getProductList().forEach(vo ->{ addReq.getProductList().forEach(vo ->{
PlatformActivityGoodsDO goodsDO=new PlatformActivityGoodsDO(); PlatformActivityGoodsDO goodsDO=new PlatformActivityGoodsDO();
BeanUtils.copyProperties(vo,goodsDO); BeanUtils.copyProperties(vo,goodsDO);
goodsDO.setActivityId(activityDO.getId());
goodsDO.setMemberId(sysUser.getMemberId());
goodsDO.setRoleId(sysUser.getMemberRoleId());
goodsDO.setMemberName(sysUser.getCompany());
goodsDO.setRoleName(sysUser.getUserRoleName());
goodsDO.setSignUpId(signUpId);
//判断是否含附属信息 //判断是否含附属信息
if(ActivityTypeEnum.containSubsidiary(activityDO.getActivityType())){ if(ActivityTypeEnum.containSubsidiary(activityDO.getActivityType())){
//赠送促销 //赠送促销
...@@ -287,6 +293,11 @@ public class PlatformActivitySignUpServiceImpl implements IPlatformActivitySignU ...@@ -287,6 +293,11 @@ public class PlatformActivitySignUpServiceImpl implements IPlatformActivitySignU
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
if(isSave){ if(isSave){
signUpDO=convertSignUpDO(sysUser,addReq); signUpDO=convertSignUpDO(sysUser,addReq);
//校验重复报名
PlatformActivitySignUpDO dbSignUpDO = signUpRepository.findByActivityIdAndMemberIdAndRoleId(addReq.getActivityId(), sysUser.getMemberId(), sysUser.getMemberRoleId());
if(dbSignUpDO!=null){
throw new BusinessException(ResponseCode.MARKETING_PLATFORM_ACTIVITY_SIGN_UP_IS_REPEAT);
}
signUpRepository.saveAndFlush(signUpDO); signUpRepository.saveAndFlush(signUpDO);
}else{ }else{
signUpDO=signUpRepository.findByIdAndMemberIdAndRoleId(addReq.getId(),sysUser.getMemberId(),sysUser.getMemberRoleId()); signUpDO=signUpRepository.findByIdAndMemberIdAndRoleId(addReq.getId(),sysUser.getMemberId(),sysUser.getMemberRoleId());
...@@ -311,7 +322,7 @@ public class PlatformActivitySignUpServiceImpl implements IPlatformActivitySignU ...@@ -311,7 +322,7 @@ public class PlatformActivitySignUpServiceImpl implements IPlatformActivitySignU
//校验15种类型特定参数 //校验15种类型特定参数
checkByActivityType(addReq,activityDO); checkByActivityType(addReq,activityDO);
//保存报名资料 //保存报名资料
List<PlatformActivityGoodsDO> goodsDOS = convertPlatformActivityGoodsDOList(addReq, activityDO); List<PlatformActivityGoodsDO> goodsDOS = convertPlatformActivityGoodsDOList(addReq, activityDO,sysUser,signUpDO.getId());
goodsRepository.saveAll(goodsDOS); goodsRepository.saveAll(goodsDOS);
//附属商品 //附属商品
List<PlatformActivityGoodsSubsidiaryDO> goodsSubsidiaryDOS=new ArrayList<>(); List<PlatformActivityGoodsSubsidiaryDO> goodsSubsidiaryDOS=new ArrayList<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment