|
@@ -5,12 +5,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.manage.common.PageInfo;
|
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
|
import com.fdkankan.manage.entity.JyPlatform;
|
|
|
+import com.fdkankan.manage.entity.JyUser;
|
|
|
import com.fdkankan.manage.entity.JyUserPlatform;
|
|
|
+import com.fdkankan.manage.entity.SysUser;
|
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
|
import com.fdkankan.manage.mapper.IJyPlatformMapper;
|
|
|
-import com.fdkankan.manage.service.IJyPlatformService;
|
|
|
+import com.fdkankan.manage.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.fdkankan.manage.service.IJyUserPlatformService;
|
|
|
import com.fdkankan.manage.vo.request.JyPlatformParam;
|
|
|
import com.fdkankan.manage.vo.request.JyPlatformVo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -18,6 +19,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
/**
|
|
@@ -34,18 +36,32 @@ public class JyPlatformServiceImpl extends ServiceImpl<IJyPlatformMapper, JyPlat
|
|
|
|
|
|
@Autowired
|
|
|
IJyUserPlatformService jyUserPlatformService;
|
|
|
+ @Autowired
|
|
|
+ ISysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ IJyUserService jyUserService;
|
|
|
|
|
|
@Override
|
|
|
public Object pageList(JyPlatformParam param) {
|
|
|
- Page<JyPlatformVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
|
|
|
-
|
|
|
+ LambdaQueryWrapper<JyPlatform> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ if(StringUtils.isNotBlank(param.getPlatformName())){
|
|
|
+ wrapper.like(JyPlatform::getPlatformAddress,param.getPlatformName());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(param.getName())){
|
|
|
+ wrapper.like(JyPlatform::getName,param.getName());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(param.getPhone())){
|
|
|
+ wrapper.like(JyPlatform::getPhone,param.getPhone());
|
|
|
+ }
|
|
|
+ wrapper.orderByDesc(JyPlatform::getId);
|
|
|
+ Page<JyPlatform> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
|
|
|
return PageInfo.PageInfo(page);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void addOrUpdate(JyPlatformVo param) {
|
|
|
if(StringUtils.isNotBlank(param.getPlatformName()) || StringUtils.isBlank(param.getName())
|
|
|
- || StringUtils.isBlank(param.getPhone()) || StringUtils.isBlank(param.getIdCard())){
|
|
|
+ || StringUtils.isBlank(param.getIdCard())){
|
|
|
|
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
@@ -61,7 +77,7 @@ public class JyPlatformServiceImpl extends ServiceImpl<IJyPlatformMapper, JyPlat
|
|
|
if(jyPlatform == null){
|
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
- jyUserPlatform = jyUserPlatformService.getByPlatformAdmin(jyPlatform.getId());
|
|
|
+ jyUserPlatform = jyUserPlatformService.getByIdCard(jyPlatform.getIdCard());
|
|
|
}
|
|
|
BeanUtils.copyProperties(param,jyPlatform);
|
|
|
BeanUtils.copyProperties(param,jyUserPlatform);
|
|
@@ -90,11 +106,36 @@ public class JyPlatformServiceImpl extends ServiceImpl<IJyPlatformMapper, JyPlat
|
|
|
|
|
|
@Override
|
|
|
public void enable(JyPlatformVo param) {
|
|
|
+ if(param.getId() == null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ JyPlatform jyPlatform = this.getById(param.getId());
|
|
|
+ if(jyPlatform == null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ //update userRole
|
|
|
+ JyUserPlatform jyUserPlatform = jyUserPlatformService.getByIdCard(jyPlatform.getIdCard());
|
|
|
+ JyUser jyUser = jyUserService.getById(jyUserPlatform.getJyUserId());
|
|
|
+ sysUserService.updateRoleId(jyUser.getSysUserId(),48);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void disable(JyPlatformVo param) {
|
|
|
+ if(param.getId() == null|| param.getToPlatformId() == null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ JyPlatform jyPlatform = this.getById(param.getId());
|
|
|
+ if(jyPlatform == null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ //update userRole
|
|
|
+ JyUserPlatform jyUserPlatform = jyUserPlatformService.getByIdCard(jyPlatform.getIdCard());
|
|
|
+ JyUser jyUser = jyUserService.getById(jyUserPlatform.getJyUserId());
|
|
|
+ sysUserService.updateRoleId(jyUser.getSysUserId(),47);
|
|
|
+
|
|
|
+ jyUserPlatformService.updatePlatformId(param.getId(),param.getToPlatformId());
|
|
|
+
|
|
|
|
|
|
}
|
|
|
}
|