|
@@ -6,17 +6,24 @@ 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.AuthorizeInstall;
|
|
|
-import com.fdkankan.manage.entity.AuthorizeModeling;
|
|
|
+import com.fdkankan.manage.entity.SysUser;
|
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
|
import com.fdkankan.manage.mapper.IAuthorizeInstallMapper;
|
|
|
import com.fdkankan.manage.service.IAuthorizeInstallService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fdkankan.manage.service.ISysUserService;
|
|
|
import com.fdkankan.manage.vo.request.AuthorizeParam;
|
|
|
import com.fdkankan.reg.RegCodeUtil;
|
|
|
import com.fdkankan.reg.dto.MachineRegDto;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 服务实现类
|
|
@@ -28,6 +35,9 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class AuthorizeInstallServiceImpl extends ServiceImpl<IAuthorizeInstallMapper, AuthorizeInstall> implements IAuthorizeInstallService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ISysUserService sysUserService;
|
|
|
+
|
|
|
@Override
|
|
|
public Object pageList(AuthorizeParam param) {
|
|
|
LambdaQueryWrapper<AuthorizeInstall> wrapper = new LambdaQueryWrapper<>();
|
|
@@ -48,6 +58,13 @@ public class AuthorizeInstallServiceImpl extends ServiceImpl<IAuthorizeInstallMa
|
|
|
}
|
|
|
wrapper.orderByDesc(AuthorizeInstall::getCreateTime);
|
|
|
Page<AuthorizeInstall> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
|
|
|
+ Set<Long> sysIds = page.getRecords().stream().map(AuthorizeInstall::getSysUserId).collect(Collectors.toSet());
|
|
|
+ HashMap<Long, SysUser> userMap = sysUserService.getByIds(sysIds);
|
|
|
+ for (AuthorizeInstall record : page.getRecords()) {
|
|
|
+ if(userMap.get(record.getSysUserId())!=null){
|
|
|
+ record.setSysUserName(userMap.get(record.getSysUserId()).getNickName());
|
|
|
+ }
|
|
|
+ }
|
|
|
return PageInfo.PageInfo(page);
|
|
|
}
|
|
|
|
|
@@ -75,4 +92,26 @@ public class AuthorizeInstallServiceImpl extends ServiceImpl<IAuthorizeInstallMa
|
|
|
this.saveOrUpdate(param);
|
|
|
return param;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AuthorizeInstall checkMachineCode(String machineCode) {
|
|
|
+ LambdaQueryWrapper<AuthorizeInstall> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(AuthorizeInstall::getMachineCode,machineCode);
|
|
|
+ List<AuthorizeInstall> list = this.list(wrapper);
|
|
|
+ if(list!=null && list.size() >0){
|
|
|
+ return list.get(0);
|
|
|
+ }
|
|
|
+ MachineRegDto machineRegDto = RegCodeUtil.ParseMachineCode(machineCode);
|
|
|
+ if(machineRegDto == null){
|
|
|
+ throw new BusinessException(ResultCode.READ_MACHINE_CODE_ERROR);
|
|
|
+ }
|
|
|
+ String uuid = machineRegDto.getUuid();
|
|
|
+ LambdaQueryWrapper<AuthorizeInstall> wrapper2 = new LambdaQueryWrapper<>();
|
|
|
+ wrapper2.eq(AuthorizeInstall::getMachineUuid,uuid);
|
|
|
+ List<AuthorizeInstall> list2 = this.list(wrapper2);
|
|
|
+ if(list2!=null && list2.size() >0){
|
|
|
+ return list2.get(0);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|