|
@@ -0,0 +1,128 @@
|
|
|
+package com.fdkankan.manage.service.impl;
|
|
|
+
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+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.JyUserPlatform;
|
|
|
+import com.fdkankan.manage.exception.BusinessException;
|
|
|
+import com.fdkankan.manage.mapper.IJyUserPlatformMapper;
|
|
|
+import com.fdkankan.manage.service.IJyUserPlatformService;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fdkankan.manage.vo.request.JyPlatformVo;
|
|
|
+import com.fdkankan.manage.vo.request.JyUserPlatformAddParam;
|
|
|
+import com.fdkankan.manage.vo.request.JyUserPlatformParam;
|
|
|
+import com.fdkankan.manage.vo.request.JyUserPlatformVo;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author
|
|
|
+ * @since 2024-11-15
|
|
|
+ */
|
|
|
+@Service
|
|
|
+@Slf4j
|
|
|
+public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper, JyUserPlatform> implements IJyUserPlatformService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public JyUserPlatform getByIdCard(String idCard) {
|
|
|
+ LambdaQueryWrapper<JyUserPlatform> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(JyUserPlatform::getIdCard,idCard);
|
|
|
+ return this.getOne(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void bindJyUserId(Integer id, Integer jyUserId) {
|
|
|
+ LambdaUpdateWrapper<JyUserPlatform> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ wrapper.eq(JyUserPlatform::getId,id);
|
|
|
+ wrapper.set(JyUserPlatform::getJyUserId,jyUserId);
|
|
|
+ this.update(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void bindPlatform(Integer id, Integer platformId) {
|
|
|
+ LambdaUpdateWrapper<JyUserPlatform> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ wrapper.eq(JyUserPlatform::getId,id);
|
|
|
+ wrapper.set(JyUserPlatform::getPlatformId,platformId);
|
|
|
+ this.update(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public JyUserPlatform getByPlatformAdmin(Integer platformId) {
|
|
|
+ LambdaQueryWrapper<JyUserPlatform> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(JyUserPlatform::getPlatformId,platformId);
|
|
|
+ wrapper.eq(JyUserPlatform::getRoleType,0);
|
|
|
+ return this.getOne(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void addByParam(JyUserPlatformAddParam param) {
|
|
|
+ if(param.getId() == null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ Integer loginPlatformId = this.getLoginPlatformId();
|
|
|
+ if(loginPlatformId == null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ this.bindPlatform(param.getId(),loginPlatformId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateByParam(JyUserPlatformAddParam param) {
|
|
|
+ if(param.getId() == null || param.getPlatformId() == null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ this.bindPlatform(param.getId(),param.getPlatformId());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void del(JyUserPlatformAddParam param) {
|
|
|
+ if(param.getId() == null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<JyUserPlatform> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(JyUserPlatform::getId,param.getId());
|
|
|
+ this.removeById(wrapper);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object pageList(JyUserPlatformParam param) {
|
|
|
+ param.setPlatformId(getLoginPlatformId());
|
|
|
+ Page<JyUserPlatformVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
|
|
|
+ return PageInfo.PageInfo(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object queryByKey(JyUserPlatformParam param) {
|
|
|
+ if(StringUtils.isBlank(param.getQueryKey())){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ return this.getBaseMapper().queryByKey(param.getQueryKey());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public JyUserPlatform getByJyUserId(Integer jyUserId) {
|
|
|
+ LambdaQueryWrapper<JyUserPlatform> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(JyUserPlatform::getJyUserId,jyUserId);
|
|
|
+ return this.getOne(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Integer getLoginPlatformId(){
|
|
|
+ try {
|
|
|
+ return Integer.valueOf(StpUtil.getExtra("platformId").toString());
|
|
|
+ }catch (Exception e){
|
|
|
+ log.info("StpUtil.getExtra -- platformId-error:{}",e);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|