Commit 79380bc7 by levphon

根据组织id获取权限用户

1 parent b462d761
......@@ -8,9 +8,9 @@ import java.util.List;
@Data
public class BasicSearch extends Page {
private String checkedUserIdsStr;
private List<Long> checkedOrgIds;
private List<Long> checkedUserIds;
private String userIdsStr;
}
......@@ -13,7 +13,7 @@ import lombok.Data;
*/
@Data
@ApiModel("设备激活查询参数")
public class DeviceActiveSearch extends Page {
public class DeviceActiveSearch extends BasicSearch {
/**
* 激活开始时间
......@@ -37,7 +37,7 @@ public class DeviceActiveSearch extends Page {
* 车辆归属组织Id
*/
@ApiModelProperty(value = "车辆归属组织Id")
private Integer orgId;
private Long orgId;
/**
* 设备号|工单号|车架号|姓名
......
package cn.com.glsx.admin.modules.model.param;
import cn.hutool.db.Page;
import lombok.Data;
@Data
public class TrialDriveShopSearch extends Page {
public class TrialDriveShopSearch extends BasicSearch {
private String term;
private Long area;
private Long province;
private Long city;
private String userIds;
}
......@@ -7,6 +7,7 @@ import cn.com.glsx.admin.modules.model.param.DeviceActiveSearch;
import cn.com.glsx.admin.modules.multithread.AsyncTasks;
import cn.com.glsx.admin.modules.multithread.ListSplitIterator;
import cn.com.glsx.admin.modules.remote.RemoteGpsBsService;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -34,14 +35,22 @@ public class DeviceActiveService {
@Autowired
private AsyncTasks asyncTasks;
@Autowired
private UserApiService userApiService;
/**
* 查询设备激活列表
*
* @param deviceActiveSearch 查询实体
* @param search 查询实体
* @return
*/
public List<DeviceActiveExprot> findDeviceActiveList(DeviceActiveSearch deviceActiveSearch) {
List<DeviceActiveExprot> deviceActiveList = vehicleMapper.getBaseDeviceActiveListWithAuth(deviceActiveSearch);
public List<DeviceActiveExprot> findDeviceActiveList(DeviceActiveSearch search) {
if (search.getOrgId() != null) {
search.setCheckedOrgIds(Lists.newArrayList(search.getOrgId()));
userApiService.setCheckedOrgUsers(search);
}
List<DeviceActiveExprot> deviceActiveList = vehicleMapper.getBaseDeviceActiveListWithAuth(search);
// 数字类型转换为字符串类型
deviceActiveList.forEach(deviceActiveExprot -> {
deviceActiveExprot.setDeviceTypeStr(TypeConverseEunm.DeviceTypeEnum.getStrByDeviceType(deviceActiveExprot.getDeviceType()));
......
......@@ -77,16 +77,15 @@ public class TrialDriveShopService {
// }
List<TrialDriveShopDTO> list = Lists.newArrayList();
if (search.getCity() != null) {
List<User> userList = userApiService.findAllByOrg(Lists.newArrayList(search.getCity()));
search.setUserIds(StringUtils.join(userList.stream().map(User::getId).toArray(), ","));
if (CollectionUtils.isEmpty(userList)) {
return new PageInfo<>(list);
}
search.setCheckedOrgIds(Lists.newArrayList(search.getCity()));
userApiService.setCheckedOrgUsers(search);
}
Page page = PageHelper.startPage(search.getPageNumber(), search.getPageSize());
list = trialDriveShopMapper.search(search);
organizationApiService.drawOrganization(list);
return new PageInfo<>(list);
}
......
......@@ -196,10 +196,13 @@ public class UserApiService {
}
public void setCheckedOrgUsers(BasicSearch search) {
if (CollectionUtils.isEmpty(search.getCheckedOrgIds())) {
return;
}
List<User> userList = this.findAllByOrg(Lists.newArrayList(search.getCheckedOrgIds()));
search.setUserIdsStr(org.apache.commons.lang.StringUtils.join(userList.stream().map(User::getId).toArray(), ","));
search.setCheckedUserIdsStr(StringUtils.join(userList.stream().map(User::getId).toArray(), ","));
if (CollectionUtils.isEmpty(userList)) {
search.setUserIdsStr("0");
search.setCheckedUserIdsStr("0");
}
}
......
......@@ -51,8 +51,8 @@
tu.account like CONCAT('%',#{term},'%')
)
</if>
<if test="userIds != null and userIds !=''">
and find_in_set(ttds.created_by,#{userIds})
<if test="checkedUserIdsStr != null and checkedUserIdsStr !=''">
and find_in_set(ttds.created_by,#{checkedUserIdsStr})
</if>
order by ttds.id desc
</select>
......@@ -82,8 +82,8 @@
tu.account like CONCAT('%',#{term},'%')
)
</if>
<if test="userIds != null and userIds !=''">
and find_in_set(ttds.created_by,#{userIds})
<if test="checkedUserIdsStr != null and checkedUserIdsStr !=''">
and find_in_set(ttds.created_by,#{checkedUserIdsStr})
</if>
order by ttds.id desc
</select>
......
......@@ -519,6 +519,9 @@
where tv.del_flag = 0
and tvd.bind_status = 1
and tvd.del_flag = 0
<if test="checkedUserIdsStr != null and checkedUserIdsStr !=''">
and find_in_set(tv.created_by,#{checkedUserIdsStr})
</if>
<if test="isOnLine != null">
<choose>
<when test="isOnLine == 2">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!