|
@@ -62,6 +62,10 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
RedisUtil redisUtil;
|
|
|
@Autowired
|
|
|
IMailTemplateService mailTemplateService;
|
|
|
+ @Autowired
|
|
|
+ IProductOrderService productOrderService;
|
|
|
+ @Autowired
|
|
|
+ IProductCooperationService productCooperationService;
|
|
|
|
|
|
@Override
|
|
|
public Long getCooperationSceneNum(Long userId, List<Integer> sceneSourceList) {
|
|
@@ -205,13 +209,15 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void saveCooperation(SceneCooperationParam param, String username) {
|
|
|
+ public void saveCooperation(SceneCooperationParam param, String loginUserName) {
|
|
|
if(StringUtils.isEmpty(param.getUserName()) || StringUtils.isEmpty(param.getSceneNum())){
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
- if(param.getUserName().equals( username)){
|
|
|
+ if(param.getUserName().equals( loginUserName)){
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3024, LoginConstant.FAILURE_MSG_3024);
|
|
|
}
|
|
|
+ User loginUser = userService.getByUserName(loginUserName);
|
|
|
+
|
|
|
User user = userService.getByUserName(param.getUserName());
|
|
|
if(user == null){
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3021, LoginConstant.FAILURE_MSG_3021);
|
|
@@ -222,11 +228,11 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
|
|
|
this.deleteCooperationList(proList,plusList);
|
|
|
|
|
|
- saveCooperationCommon(param,Arrays.asList(user),proList,plusList);
|
|
|
+ saveCooperationCommon(loginUser,param.getLang(),Arrays.asList(user),proList,plusList);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void saveBatchCooperation(SceneCooperationParam param, String loginUserName) {
|
|
|
+ public ProductOrder saveBatchCooperation(SceneCooperationParam param, String loginUserName) {
|
|
|
if(param.getUserNameList() == null || param.getUserNameList().isEmpty() || StringUtils.isEmpty(param.getSceneNum())){
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
@@ -249,19 +255,24 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
ProductOrder productOrder = checkNeedPay(numList, users, loginUser, param.getPayType(), param.getTimeZone());
|
|
|
|
|
|
if(productOrder == null){
|
|
|
- List<ScenePro> proList = sceneProService.getListByNums(numList);
|
|
|
- List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
|
|
|
- this.deleteCooperationList(proList,plusList);
|
|
|
- saveCooperationCommon(param,users,proList,plusList);
|
|
|
+ successAddCooperation(numList,users,param.getLang(),loginUser);
|
|
|
+ }else {
|
|
|
+ productCooperationService.add(productOrder,users,numList);
|
|
|
}
|
|
|
+ return productOrder;
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public void successAddCooperation(List<String> numList,List<User> users,String lang,User loginUser){
|
|
|
+ List<ScenePro> proList = sceneProService.getListByNums(numList);
|
|
|
+ List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
|
|
|
+ this.deleteCooperationList(proList,plusList);
|
|
|
+ saveCooperationCommon(loginUser,lang,users,proList,plusList);
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- IProductOrderService productOrderService;
|
|
|
+
|
|
|
|
|
|
private ProductOrder checkNeedPay(List<String> numList, List<User> users,User loginUser,Integer payType,Integer timeZone) {
|
|
|
Integer totalCount = 0;
|
|
@@ -282,15 +293,14 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
if(totalCount <=0){
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
- return productOrderService.createOrder(totalCount,"cooperation",loginUser,payType,timeZone);
|
|
|
+ return productOrderService.createOrder(totalCount, "cooperation", loginUser, payType, timeZone);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
LaserService laserService;
|
|
|
|
|
|
- private void saveCooperationCommon(SceneCooperationParam param,List<User> userList,List<ScenePro> proList, List<ScenePlus> plusList){
|
|
|
+ private void saveCooperationCommon(User LoginUser,String lang,List<User> userList,List<ScenePro> proList, List<ScenePlus> plusList){
|
|
|
|
|
|
for (User user : userList) {
|
|
|
if( !proList.isEmpty()){
|
|
@@ -301,7 +311,7 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
}
|
|
|
|
|
|
if("aws".equals(NacosProperty.uploadType)){
|
|
|
- mailTemplateService.sendSceneCooperation(proList,plusList,user.getUserName(),param.getLang());
|
|
|
+ mailTemplateService.sendSceneCooperation(proList,plusList,user.getUserName(),lang);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -310,7 +320,8 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
List<String> numList1 = collect1.stream().map(ScenePro::getNum).collect(Collectors.toList());
|
|
|
List<String> numList2 = collect2.stream().map(ScenePlus::getNum).collect(Collectors.toList());
|
|
|
numList1.addAll(numList2);
|
|
|
- laserService.saveBatchCooperation(numList2,param.getUserName(),param.getUserNameList());
|
|
|
+ List<String> collect = userList.stream().map(User::getUserName).collect(Collectors.toList());
|
|
|
+ laserService.saveBatchCooperation(numList2,LoginUser.getUserName(),collect);
|
|
|
|
|
|
}
|
|
|
|