|
@@ -59,7 +59,7 @@ public class JyPlatformServiceImpl extends ServiceImpl<IJyPlatformMapper, JyPlat
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void addOrUpdate(JyPlatformVo param) {
|
|
|
+ public JyPlatform addOrUpdate(JyPlatformVo param) {
|
|
|
if(StringUtils.isBlank(param.getPlatformName()) || StringUtils.isBlank(param.getName())
|
|
|
|| StringUtils.isBlank(param.getIdCard())){
|
|
|
|
|
@@ -70,13 +70,22 @@ public class JyPlatformServiceImpl extends ServiceImpl<IJyPlatformMapper, JyPlat
|
|
|
if(param.getId() == null){ //创建平台自动生成平台访问地址
|
|
|
String uuid = UUID.randomUUID().toString().substring(0, 18).replace("-", "");
|
|
|
param.setPlatformAddress(uuid);
|
|
|
+ jyPlatform = this.getByIdCard(param.getIdCard());
|
|
|
+ if(jyPlatform != null){
|
|
|
+ throw new BusinessException(ResultCode.ID_CARD_EXIT);
|
|
|
+ }
|
|
|
jyPlatform = new JyPlatform();
|
|
|
jyUserPlatform = new JyUserPlatform();
|
|
|
+
|
|
|
}else {
|
|
|
jyPlatform = this.getById(param.getId());
|
|
|
if(jyPlatform == null){
|
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
+ JyPlatform jyPlatform2 = this.getByIdCard(param.getIdCard());
|
|
|
+ if(jyPlatform2 != null && !jyPlatform2.getId().equals(jyPlatform.getId())){
|
|
|
+ throw new BusinessException(ResultCode.ID_CARD_EXIT);
|
|
|
+ }
|
|
|
jyUserPlatform = jyUserPlatformService.getByIdCard(jyPlatform.getIdCard());
|
|
|
}
|
|
|
BeanUtils.copyProperties(param,jyPlatform);
|
|
@@ -85,7 +94,13 @@ public class JyPlatformServiceImpl extends ServiceImpl<IJyPlatformMapper, JyPlat
|
|
|
jyUserPlatform.setPlatformId(jyPlatform.getId());
|
|
|
jyUserPlatformService.saveOrUpdate(jyUserPlatform);
|
|
|
|
|
|
+ return jyPlatform;
|
|
|
+ }
|
|
|
|
|
|
+ private JyPlatform getByIdCard(String idCard) {
|
|
|
+ LambdaQueryWrapper<JyPlatform> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(JyPlatform::getIdCard,idCard);
|
|
|
+ return this.getOne(wrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|