Commit d3f6089d authored by tianyiming's avatar tianyiming

设备赋码弹窗仅使用单位弹窗

parent 7202f54f
package com.yeejoin.amos.boot.module.tzs.api.service; package com.yeejoin.amos.boot.module.tzs.api.service;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.tzs.api.entity.UserCheckStatus; import com.yeejoin.amos.boot.module.tzs.api.entity.UserCheckStatus;
/** /**
...@@ -8,7 +9,7 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.UserCheckStatus; ...@@ -8,7 +9,7 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.UserCheckStatus;
*/ */
public interface IUserCheckStatusService { public interface IUserCheckStatusService {
UserCheckStatus getUserCheckStatus(String useName); UserCheckStatus getUserCheckStatus(ReginParams reginParams);
UserCheckStatus updateUserCheckStatus(String useName, String status); UserCheckStatus updateUserCheckStatus(String useName, String status);
} }
...@@ -46,8 +46,7 @@ public class UserCheckStatusController extends BaseController { ...@@ -46,8 +46,7 @@ public class UserCheckStatusController extends BaseController {
if (ObjectUtils.isEmpty(reginParams)) { if (ObjectUtils.isEmpty(reginParams)) {
return null; return null;
} }
String useName = reginParams.getUserModel().getUserName(); return ResponseHelper.buildResponse(userCheckStatusService.getUserCheckStatus(reginParams));
return ResponseHelper.buildResponse(userCheckStatusService.getUserCheckStatus(useName));
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......
package com.yeejoin.amos.boot.module.tzs.biz.service.impl; package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.tzs.api.dto.UserCheckStatusDto; import com.yeejoin.amos.boot.module.tzs.api.dto.UserCheckStatusDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.UserCheckStatus; import com.yeejoin.amos.boot.module.tzs.api.entity.UserCheckStatus;
import com.yeejoin.amos.boot.module.tzs.api.mapper.UserCheckStatusMapper; import com.yeejoin.amos.boot.module.tzs.api.mapper.UserCheckStatusMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IUserCheckStatusService; import com.yeejoin.amos.boot.module.tzs.api.service.IUserCheckStatusService;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
import java.util.Map;
import java.util.Set;
/** /**
* 装备分类服务实现类 * 装备分类服务实现类
* *
...@@ -24,18 +30,34 @@ public class UserCheckStatusServiceImpl extends BaseService<UserCheckStatusDto, ...@@ -24,18 +30,34 @@ public class UserCheckStatusServiceImpl extends BaseService<UserCheckStatusDto,
@Autowired @Autowired
UserCheckStatusMapper userCheckStatusMapper; UserCheckStatusMapper userCheckStatusMapper;
//使用单位sequence_nbr
private final Long USEUNITID = 1460532889249755137L;
@Override @Override
public UserCheckStatus getUserCheckStatus(String useName) { public UserCheckStatus getUserCheckStatus(ReginParams reginParams) {
UserCheckStatus userCheckStatus = userCheckStatusMapper.selectOne(new QueryWrapper<UserCheckStatus>().eq("use_name", useName)); UserCheckStatus userCheckStatus = new UserCheckStatus();
if (ObjectUtils.isEmpty(userCheckStatus)) { userCheckStatus.setStatus("1");
UserCheckStatus checkStatus = new UserCheckStatus(); Map<Long, List<RoleModel>> orgRoles = reginParams.getUserModel().getOrgRoles();
checkStatus.setUseName(useName); if(!ObjectUtils.isEmpty(orgRoles)){
checkStatus.setStatus("0"); Set<Long> longs = orgRoles.keySet();
int result = userCheckStatusMapper.insert(checkStatus); for (Long aLong : longs) {
if (result == 1) { for (RoleModel roleModel : orgRoles.get(aLong)) {
return userCheckStatus; if(USEUNITID.equals(roleModel.getSequenceNbr())){
} else { String useName = reginParams.getUserModel().getUserName();
return null; userCheckStatus = userCheckStatusMapper.selectOne(new QueryWrapper<UserCheckStatus>().eq("use_name", useName));
if (ObjectUtils.isEmpty(userCheckStatus)) {
UserCheckStatus checkStatus = new UserCheckStatus();
checkStatus.setUseName(useName);
checkStatus.setStatus("0");
int result = userCheckStatusMapper.insert(checkStatus);
if (result == 1) {
return userCheckStatus;
} else {
return null;
}
}
}
}
} }
} }
return userCheckStatus; return userCheckStatus;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment