Commit 8928c8a8 by 刘宇峰

新增车辆-车型管理

1 parent e221d409
...@@ -47,7 +47,7 @@ public class ApprovalService { ...@@ -47,7 +47,7 @@ public class ApprovalService {
private ApprovalHistoryService approvalHistoryService; private ApprovalHistoryService approvalHistoryService;
@Autowired @Autowired
private OrganizaService organizaService; private OrganizationApiService organizationApiService;
@Autowired @Autowired
private ElectricFenceService electricFenceService; private ElectricFenceService electricFenceService;
...@@ -155,7 +155,7 @@ public class ApprovalService { ...@@ -155,7 +155,7 @@ public class ApprovalService {
public PageInfo<VehicleApproDto> searchVehiclelicApp(VehicleApproSearch vehicleApproSearch) { public PageInfo<VehicleApproDto> searchVehiclelicApp(VehicleApproSearch vehicleApproSearch) {
PageHelper.startPage(vehicleApproSearch.getPageNumber(), vehicleApproSearch.getPageSize()); PageHelper.startPage(vehicleApproSearch.getPageNumber(), vehicleApproSearch.getPageSize());
List<VehicleApproDto> vehicleDtoPageInfo=approvalMapper.searchVehiclelicApp(vehicleApproSearch); List<VehicleApproDto> vehicleDtoPageInfo=approvalMapper.searchVehiclelicApp(vehicleApproSearch);
organizaService.drawOrganization(vehicleDtoPageInfo); organizationApiService.drawOrganization(vehicleDtoPageInfo);
return new PageInfo<>(vehicleDtoPageInfo); return new PageInfo<>(vehicleDtoPageInfo);
} }
...@@ -168,7 +168,7 @@ public class ApprovalService { ...@@ -168,7 +168,7 @@ public class ApprovalService {
public PageInfo<FenceApproDto> searchFenceApp(FenceApproSearch fenceApproSearch) { public PageInfo<FenceApproDto> searchFenceApp(FenceApproSearch fenceApproSearch) {
PageHelper.startPage(fenceApproSearch.getPageNumber(), fenceApproSearch.getPageSize()); PageHelper.startPage(fenceApproSearch.getPageNumber(), fenceApproSearch.getPageSize());
List<FenceApproDto> fenceApproDtoList=approvalMapper.searchFenceApp(fenceApproSearch); List<FenceApproDto> fenceApproDtoList=approvalMapper.searchFenceApp(fenceApproSearch);
organizaService.drawOrganization(fenceApproDtoList); organizationApiService.drawOrganization(fenceApproDtoList);
if(CollectionUtils.isNotEmpty(fenceApproDtoList)) { if(CollectionUtils.isNotEmpty(fenceApproDtoList)) {
fenceApproDtoList.forEach(index -> { fenceApproDtoList.forEach(index -> {
index.setFenceType(BizFenceTypeEnum.getNameByCode(index.getFenceTypeId())); index.setFenceType(BizFenceTypeEnum.getNameByCode(index.getFenceTypeId()));
...@@ -184,7 +184,7 @@ public class ApprovalService { ...@@ -184,7 +184,7 @@ public class ApprovalService {
*/ */
public List<VehicleApproExport> export(VehicleApproSearch vehicleApproSearch) { public List<VehicleApproExport> export(VehicleApproSearch vehicleApproSearch) {
List<VehicleApproDto> vehicleDtoPageInfo=approvalMapper.searchVehiclelicApp(vehicleApproSearch); List<VehicleApproDto> vehicleDtoPageInfo=approvalMapper.searchVehiclelicApp(vehicleApproSearch);
organizaService.drawOrganization(vehicleDtoPageInfo); organizationApiService.drawOrganization(vehicleDtoPageInfo);
List<VehicleApproExport> vehicleDocList = vehicleDtoPageInfo.stream().map(index -> { List<VehicleApproExport> vehicleDocList = vehicleDtoPageInfo.stream().map(index -> {
VehicleApproExport vehicleApproExport = new VehicleApproExport(); VehicleApproExport vehicleApproExport = new VehicleApproExport();
BeanUtils.copyProperties(index, vehicleApproExport); BeanUtils.copyProperties(index, vehicleApproExport);
......
...@@ -16,13 +16,11 @@ import cn.com.glsx.admin.modules.model.param.ElectricFenceBO; ...@@ -16,13 +16,11 @@ import cn.com.glsx.admin.modules.model.param.ElectricFenceBO;
import cn.com.glsx.admin.modules.model.param.ElectricFenceSearch; import cn.com.glsx.admin.modules.model.param.ElectricFenceSearch;
import cn.com.glsx.auth.utils.ShieldContextHolder; import cn.com.glsx.auth.utils.ShieldContextHolder;
import cn.com.glsx.usercenter.api.dto.response.User; import cn.com.glsx.usercenter.api.dto.response.User;
import cn.com.glsx.usercenter.api.feign.UserService;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.plat.core.web.R;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -59,24 +57,21 @@ public class ElectricFenceService { ...@@ -59,24 +57,21 @@ public class ElectricFenceService {
private VehicleMapper vehicleMapper; private VehicleMapper vehicleMapper;
@Autowired @Autowired
private VehicleDeviceMapper vehicleDeviceMapper;
@Autowired
private ApprovalService approvalService; private ApprovalService approvalService;
@Autowired @Autowired
private UserService userService; private TrialDriveShopService trialDriveShopService;
@Autowired @Autowired
private TrialDriveShopService trialDriveShopService; private UserApiService userApiService;
@Autowired @Autowired
private OrganizaService organizaService; private OrganizationApiService organizationApiService;
public PageInfo<ElectricFenceDTO> search(ElectricFenceSearch search) { public PageInfo<ElectricFenceDTO> search(ElectricFenceSearch search) {
Page page = PageHelper.startPage(search.getPageNumber(), search.getPageSize()); Page page = PageHelper.startPage(search.getPageNumber(), search.getPageSize());
List<ElectricFenceDTO> list = electricFenceMapper.search(search); List<ElectricFenceDTO> list = electricFenceMapper.search(search);
organizaService.drawOrganization(list); organizationApiService.drawOrganization(list);
list.forEach(index -> { list.forEach(index -> {
index.setBizFenceType(BizFenceTypeEnum.getNameByCode(Integer.valueOf(index.getBizFenceType()))); index.setBizFenceType(BizFenceTypeEnum.getNameByCode(Integer.valueOf(index.getBizFenceType())));
index.setApprovalResult(ApprovalStatusEnum.getValueByCode(index.getApprovalStatus())); index.setApprovalResult(ApprovalStatusEnum.getValueByCode(index.getApprovalStatus()));
...@@ -86,7 +81,7 @@ public class ElectricFenceService { ...@@ -86,7 +81,7 @@ public class ElectricFenceService {
public List<ElectricFenceExport> export(ElectricFenceSearch search) { public List<ElectricFenceExport> export(ElectricFenceSearch search) {
List<ElectricFenceExport> list = electricFenceMapper.export(search); List<ElectricFenceExport> list = electricFenceMapper.export(search);
organizaService.drawOrganization(list); organizationApiService.drawOrganization(list);
list.forEach(index -> { list.forEach(index -> {
index.setBizFenceType(BizFenceTypeEnum.getNameByCode(Integer.valueOf(index.getBizFenceType()))); index.setBizFenceType(BizFenceTypeEnum.getNameByCode(Integer.valueOf(index.getBizFenceType())));
index.setApprovalResult(ApprovalStatusEnum.getValueByCode(index.getApprovalStatus())); index.setApprovalResult(ApprovalStatusEnum.getValueByCode(index.getApprovalStatus()));
...@@ -521,8 +516,7 @@ public class ElectricFenceService { ...@@ -521,8 +516,7 @@ public class ElectricFenceService {
}); });
detailsDTO.setSnList(snsList); detailsDTO.setSnList(snsList);
R<User> userR = userService.getById(electricFence.getCreatedBy()); User user = userApiService.getUserById(electricFence.getCreatedBy());
User user = userR.getData(User.class);
if (user != null) { if (user != null) {
detailsDTO.setShopId(user.getId()); detailsDTO.setShopId(user.getId());
detailsDTO.setShopName(user.getUsername()); detailsDTO.setShopName(user.getUsername());
...@@ -551,8 +545,7 @@ public class ElectricFenceService { ...@@ -551,8 +545,7 @@ public class ElectricFenceService {
}); });
detailsDTO.setSnList(snsList); detailsDTO.setSnList(snsList);
R<User> userR = userService.getById(fenceCopy.getCreatedBy()); User user = userApiService.getUserById(fenceCopy.getCreatedBy());
User user = userR.getData(User.class);
if (user != null) { if (user != null) {
detailsDTO.setShopId(user.getId()); detailsDTO.setShopId(user.getId());
detailsDTO.setShopName(user.getUsername()); detailsDTO.setShopName(user.getUsername());
......
...@@ -10,11 +10,12 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,11 +10,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
public class OrganizaService { public class OrganizationApiService {
@Autowired @Autowired
private OrganizationService organizationService; private OrganizationService organizationService;
...@@ -46,4 +47,36 @@ public class OrganizaService { ...@@ -46,4 +47,36 @@ public class OrganizaService {
} }
} }
public List<Organization> getRootOrganizations() {
R<List<Organization>> listR = organizationService.getRootOrganizations();
List<Organization> orgList = listR.getDataList(new TypeToken<List<Organization>>() {
}.getType());
return orgList;
}
public List<Organization> getSubOrganizations(Long orgId) {
R<List<Organization>> listR = organizationService.getSubOrganizations(orgId);
List<Organization> orgList = listR.getDataList(new TypeToken<List<Organization>>() {
}.getType());
return orgList;
}
public List<Organization> getSpecialLevelOrganizations(Integer level) {
R<List<Organization>> orgListR = organizationService.getSpecialLevelOrganizations(level);
List<Organization> orgList = orgListR.getDataList(new TypeToken<List<Organization>>() {
}.getType());
return orgList;
}
public Organization getOrganizationInfo(Long orgId) {
return null;
}
public List<Organization> getBatchOrganizationInfo(Collection<Long> orgIds) {
R<List<Organization>> listR = organizationService.getOrgsByUserIds(orgIds);
List<Organization> orgList = listR.getDataList(new TypeToken<List<Organization>>() {
}.getType());
return orgList;
}
} }
...@@ -37,7 +37,7 @@ public class TearDownAlarmSevice { ...@@ -37,7 +37,7 @@ public class TearDownAlarmSevice {
private VehicleMapper vehicleMapper; private VehicleMapper vehicleMapper;
@Autowired @Autowired
private OrganizaService organizaService; private OrganizationApiService organizationApiService;
/** /**
* 查询拆除报警数据 * 查询拆除报警数据
...@@ -85,7 +85,7 @@ public class TearDownAlarmSevice { ...@@ -85,7 +85,7 @@ public class TearDownAlarmSevice {
} }
} }
} }
organizaService.drawOrganization(modelExportList); organizationApiService.drawOrganization(modelExportList);
alarmDataPage.setList(modelExportList); alarmDataPage.setList(modelExportList);
return alarmDataPage; return alarmDataPage;
} }
...@@ -99,7 +99,7 @@ public class TearDownAlarmSevice { ...@@ -99,7 +99,7 @@ public class TearDownAlarmSevice {
public List<TearDownModelExport> export(TearDownQueryBo tearDownQueryBo) { public List<TearDownModelExport> export(TearDownQueryBo tearDownQueryBo) {
// 在数据库查询车辆和特约店车辆信息 // 在数据库查询车辆和特约店车辆信息
List<TearDownModelExport> tearDownModelExportList = vehicleMapper.searchTearDownAlarmList(tearDownQueryBo.getKeywords()); List<TearDownModelExport> tearDownModelExportList = vehicleMapper.searchTearDownAlarmList(tearDownQueryBo.getKeywords());
organizaService.drawOrganization(tearDownModelExportList); organizationApiService.drawOrganization(tearDownModelExportList);
String alarmsnStr = StringUtils.join(tearDownModelExportList.stream().map(TearDownModelExport::getSn).toArray(), ","); String alarmsnStr = StringUtils.join(tearDownModelExportList.stream().map(TearDownModelExport::getSn).toArray(), ",");
AlarmBo alarmBo = new AlarmBo(); AlarmBo alarmBo = new AlarmBo();
alarmBo.setSnList(alarmsnStr); alarmBo.setSnList(alarmsnStr);
......
...@@ -17,17 +17,12 @@ import cn.com.glsx.admin.modules.model.param.ElectricFenceBO; ...@@ -17,17 +17,12 @@ import cn.com.glsx.admin.modules.model.param.ElectricFenceBO;
import cn.com.glsx.admin.modules.model.param.TrialDriveShopBO; import cn.com.glsx.admin.modules.model.param.TrialDriveShopBO;
import cn.com.glsx.admin.modules.model.param.TrialDriveShopSearch; import cn.com.glsx.admin.modules.model.param.TrialDriveShopSearch;
import cn.com.glsx.auth.utils.ShieldContextHolder; import cn.com.glsx.auth.utils.ShieldContextHolder;
import cn.com.glsx.usercenter.api.dto.request.FindUserRequest;
import cn.com.glsx.usercenter.api.dto.response.Organization; import cn.com.glsx.usercenter.api.dto.response.Organization;
import cn.com.glsx.usercenter.api.dto.response.User; import cn.com.glsx.usercenter.api.dto.response.User;
import cn.com.glsx.usercenter.api.feign.OrganizationService;
import cn.com.glsx.usercenter.api.feign.UserService;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.plat.core.web.R;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.gson.reflect.TypeToken;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -59,13 +54,10 @@ public class TrialDriveShopService { ...@@ -59,13 +54,10 @@ public class TrialDriveShopService {
private ElectricFenceService electricFenceService; private ElectricFenceService electricFenceService;
@Autowired @Autowired
private UserService userService; private UserApiService userApiService;
@Autowired @Autowired
private OrganizaService organizaService; private OrganizationApiService organizationApiService;
@Autowired
private OrganizationService organizationService;
@Autowired @Autowired
private EFenceComponent eFenceComponent; private EFenceComponent eFenceComponent;
...@@ -86,20 +78,18 @@ public class TrialDriveShopService { ...@@ -86,20 +78,18 @@ public class TrialDriveShopService {
// search.setUserIds(StringUtils.join(userList.stream().map(User::getId).toArray(), ",")); // search.setUserIds(StringUtils.join(userList.stream().map(User::getId).toArray(), ","));
// } // }
if (search.getCity() != null) { if (search.getCity() != null) {
R<List<User>> byOrg = userService.findAllByOrg(new FindUserRequest().setOrgIds(Lists.newArrayList(search.getCity()))); List<User> userList = userApiService.findAllByOrg(Lists.newArrayList(search.getCity()));
List<User> userList = byOrg.getDataList(new TypeToken<List<User>>() {
}.getType());
search.setUserIds(StringUtils.join(userList.stream().map(User::getId).toArray(), ",")); search.setUserIds(StringUtils.join(userList.stream().map(User::getId).toArray(), ","));
} }
List<TrialDriveShopDTO> list = trialDriveShopMapper.search(search); List<TrialDriveShopDTO> list = trialDriveShopMapper.search(search);
organizaService.drawOrganization(list); organizationApiService.drawOrganization(list);
return new PageInfo<>(list); return new PageInfo<>(list);
} }
public List<TrialDriveShopExport> export(TrialDriveShopSearch search) { public List<TrialDriveShopExport> export(TrialDriveShopSearch search) {
List<TrialDriveShopExport> list = trialDriveShopMapper.export(search); List<TrialDriveShopExport> list = trialDriveShopMapper.export(search);
organizaService.drawOrganization(list); organizationApiService.drawOrganization(list);
return list; return list;
} }
...@@ -264,8 +254,7 @@ public class TrialDriveShopService { ...@@ -264,8 +254,7 @@ public class TrialDriveShopService {
} }
detailsDTO.setRadius(fence.getRadius()); detailsDTO.setRadius(fence.getRadius());
R<User> userR = userService.getById(shop.getCreatedBy()); User user = userApiService.getUserById(shop.getCreatedBy());
User user = userR.getData(User.class);
if (user != null) { if (user != null) {
detailsDTO.setSpecialShopId(user.getId()); detailsDTO.setSpecialShopId(user.getId());
detailsDTO.setShopName(user.getUsername()); detailsDTO.setShopName(user.getUsername());
...@@ -291,27 +280,18 @@ public class TrialDriveShopService { ...@@ -291,27 +280,18 @@ public class TrialDriveShopService {
electricFenceService.deleteById(shop.getFenceId()); electricFenceService.deleteById(shop.getFenceId());
} }
public List<Organization> getShopOrgs() {
R<List<Organization>> orgListR = organizationService.getSpecialLevelOrganizations(shopUserLevel);
List<Organization> orgList = orgListR.getDataList(new TypeToken<List<Organization>>() {
}.getType());
return orgList;
}
public List<Long> getShopOrgIds() { public List<Long> getShopOrgIds() {
List<Organization> orgList = getShopOrgs(); List<Organization> orgList = organizationApiService.getSpecialLevelOrganizations(shopUserLevel);
List<Long> orgIds = orgList.stream().map(Organization::getId).collect(Collectors.toList()); List<Long> orgIds = orgList.stream().map(Organization::getId).collect(Collectors.toList());
return orgIds; return orgIds;
} }
public List<SimpleTreeModel> getShopWithUserTree() { public List<SimpleTreeModel> getShopWithUserTree() {
List<Organization> orgList = getShopOrgs(); List<Organization> orgList = organizationApiService.getSpecialLevelOrganizations(shopUserLevel);
List<SimpleTreeModel> treeModelList = Lists.newArrayList(); List<SimpleTreeModel> treeModelList = Lists.newArrayList();
if (CollectionUtils.isNotEmpty(orgList)) { if (CollectionUtils.isNotEmpty(orgList)) {
List<Long> longList = orgList.stream().map(Organization::getId).collect(Collectors.toList()); List<Long> orgIds = orgList.stream().map(Organization::getId).collect(Collectors.toList());
R<List<User>> byOrg = userService.findByOrg(new FindUserRequest().setOrgIds(longList)); List<User> list = userApiService.findByOrg(orgIds);
List<User> list = byOrg.getDataList(new TypeToken<List<User>>() {
}.getType());
orgList.forEach(o -> { orgList.forEach(o -> {
SimpleTreeModel treeModel = new SimpleTreeModel(); SimpleTreeModel treeModel = new SimpleTreeModel();
treeModel.setId(o.getId()); treeModel.setId(o.getId());
......
...@@ -3,33 +3,41 @@ package cn.com.glsx.admin.modules.service; ...@@ -3,33 +3,41 @@ package cn.com.glsx.admin.modules.service;
import cn.com.glsx.usercenter.api.dto.request.FindUserRequest; import cn.com.glsx.usercenter.api.dto.request.FindUserRequest;
import cn.com.glsx.usercenter.api.dto.response.User; import cn.com.glsx.usercenter.api.dto.response.User;
import cn.com.glsx.usercenter.api.feign.ApiUserService; import cn.com.glsx.usercenter.api.feign.ApiUserService;
import com.glsx.plat.common.utils.StringUtils;
import com.glsx.plat.context.utils.PropertiesUtils;
import com.glsx.plat.core.web.R; import com.glsx.plat.core.web.R;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 用户服务 * 用户服务
*/ */
@Service @Service
public class UserApiService { public class UserApiService {
@Autowired @Autowired
private cn.com.glsx.usercenter.api.feign.UserService userService; private cn.com.glsx.usercenter.api.feign.UserService userService;
/**
* 不需要登录得开放用户服务
*/
@Autowired @Autowired
private ApiUserService apiUserService; private ApiUserService apiUserService;
/** /**
* 根据创建人id查找用户信息 * 根据用户id查找用户信息
* @param createdBy *
* @param userId
* @return * @return
*/ */
public User getUserByCreatedBy(Long createdBy) { public User getUserById(Long userId) {
R<User> userR = userService.getById(createdBy); R<User> userR = userService.getById(userId);
if (userR == null) { if (userR == null) {
return null; return null;
} }
...@@ -38,41 +46,77 @@ public class UserApiService { ...@@ -38,41 +46,77 @@ public class UserApiService {
} }
/** /**
* 查找特约店(账户)是否存在 * 根据用户名称查找用户id
* @param userRequest *
* @param username
* @return * @return
*/ */
public List<User> findByUser(FindUserRequest userRequest) { public Long getUserIdByUsername(String username) {
R<List<User>> userR = userService.findByUser(userRequest); R<List<User>> userR = apiUserService.findByUsername(username);
if (userR == null || !userR.isSuccess()) { if (userR == null) {
return null; return null;
} }
Long userId = null;
List<User> userList = userR.getDataList(new TypeToken<List<User>>() { List<User> userList = userR.getDataList(new TypeToken<List<User>>() {
}.getType()); }.getType());
return userList; if (CollectionUtils.isNotEmpty(userList) && userList.size() == 1) {
userId = userList.get(0).getId();
}
return userId;
} }
/** /**
* 根据店面名称查找用户id * 根据用户id获取用户列表
* @param shopName *
* @param userIds
* @return * @return
*/ */
public Long getUserIdByShopName(String shopName) { public List<User> findByUser(List<Long> userIds) {
R<List<User>> userR = apiUserService.findByUsername(shopName); R<List<User>> userR = userService.findByUser(new FindUserRequest().setUserIds(userIds));
if (userR == null) { if (userR == null || !userR.isSuccess()) {
return null; return null;
} }
Long userId = null;
List<User> userList = userR.getDataList(new TypeToken<List<User>>() { List<User> userList = userR.getDataList(new TypeToken<List<User>>() {
}.getType()); }.getType());
if (CollectionUtils.isNotEmpty(userList) && userList.size() == 1) { return userList;
userId = userList.get(0).getId();
} }
return userId;
// @Cacheable(value = "user", key = "#userId")
// public User getUser(Long userId) {
// List<User> userList = this.findAllUser();
// Map<Long, User> userMap = userList.stream().collect(Collectors.toMap(User::getId, t -> t));
// return userMap.get(userId);
// }
/**
* 根据组织id获取用户列表
*
* @param orgIds
* @return
*/
public List<User> findAllByOrg(List<Long> orgIds) {
R<List<User>> byOrg = userService.findAllByOrg(new FindUserRequest().setOrgIds(orgIds));
List<User> userList = byOrg.getDataList(new TypeToken<List<User>>() {
}.getType());
return userList;
}
/**
* 根据组织id获取用户列表-用户权限内
*
* @param orgIds
* @return
*/
public List<User> findByOrg(List<Long> orgIds) {
R<List<User>> byOrg = userService.findByOrg(new FindUserRequest().setOrgIds(orgIds));
List<User> userList = byOrg.getDataList(new TypeToken<List<User>>() {
}.getType());
return userList;
} }
/** /**
* 查找所有用户信息 * 查找所有用户信息
*
* @return * @return
*/ */
public List<User> findAllUser() { public List<User> findAllUser() {
...@@ -84,4 +128,22 @@ public class UserApiService { ...@@ -84,4 +128,22 @@ public class UserApiService {
}.getType()); }.getType());
return userList; return userList;
} }
/**
* 封装用户信息 key:门店编码 value:id
*
* @return
*/
public Map<String, Long> findUserIdMapByAccount() {
Map<String, Long> userMap = new HashedMap();
List<User> userList = this.findAllUser();
if (userList == null) {
return userMap;
}
for (User user : userList) {
userMap.put(user.getAccount(), user.getId());
}
return userMap;
}
} }
...@@ -11,6 +11,7 @@ import cn.com.glsx.admin.modules.model.VehicleApproDto; ...@@ -11,6 +11,7 @@ import cn.com.glsx.admin.modules.model.VehicleApproDto;
import cn.com.glsx.admin.modules.model.VehicleDocDto; import cn.com.glsx.admin.modules.model.VehicleDocDto;
import cn.com.glsx.admin.modules.model.param.*; import cn.com.glsx.admin.modules.model.param.*;
import cn.com.glsx.auth.utils.ShieldContextHolder; import cn.com.glsx.auth.utils.ShieldContextHolder;
import cn.com.glsx.usercenter.api.feign.OrganizationService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -42,7 +43,7 @@ public class VehicleDocService { ...@@ -42,7 +43,7 @@ public class VehicleDocService {
private ApprovalService approvalService; private ApprovalService approvalService;
@Autowired @Autowired
private OrganizaService organizaService; private OrganizationApiService organizationApiService;
/** /**
* 批量新增或者修改车辆资料 * 批量新增或者修改车辆资料
...@@ -131,7 +132,7 @@ public class VehicleDocService { ...@@ -131,7 +132,7 @@ public class VehicleDocService {
index.setSubmitStatus("1"); index.setSubmitStatus("1");
} }
}); });
organizaService.drawOrganization(vehicleDtoPageInfo); organizationApiService.drawOrganization(vehicleDtoPageInfo);
return new PageInfo<>(vehicleDtoPageInfo); return new PageInfo<>(vehicleDtoPageInfo);
} }
......
...@@ -24,13 +24,11 @@ import cn.com.glsx.alarm.services.model.AlarmDto; ...@@ -24,13 +24,11 @@ import cn.com.glsx.alarm.services.model.AlarmDto;
import cn.com.glsx.devicemonitor.api.dto.response.GpsBsData; import cn.com.glsx.devicemonitor.api.dto.response.GpsBsData;
import cn.com.glsx.devicemonitor.api.dto.response.GpsLocation; import cn.com.glsx.devicemonitor.api.dto.response.GpsLocation;
import cn.com.glsx.usercenter.api.dto.response.Organization; import cn.com.glsx.usercenter.api.dto.response.Organization;
import cn.com.glsx.usercenter.api.feign.OrganizationService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.glsx.plat.context.utils.PropertiesUtils; import com.glsx.plat.context.utils.PropertiesUtils;
import com.glsx.plat.core.web.R; import com.glsx.plat.core.web.R;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.gson.reflect.TypeToken;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -58,6 +56,7 @@ public class VehicleMonitorSevice { ...@@ -58,6 +56,7 @@ public class VehicleMonitorSevice {
@Autowired @Autowired
private VehicleMapper vehicleMapper; private VehicleMapper vehicleMapper;
@Autowired @Autowired
private DeviceMapper deviceMapper; private DeviceMapper deviceMapper;
...@@ -65,7 +64,7 @@ public class VehicleMonitorSevice { ...@@ -65,7 +64,7 @@ public class VehicleMonitorSevice {
private AlarmFeignClient alarmFeignClient; private AlarmFeignClient alarmFeignClient;
@Autowired @Autowired
private OrganizationService organizationService; private OrganizationApiService organizationApiService;
public List<OrgVehicleTreeModel> vTree(VehicleTreeSearch search) { public List<OrgVehicleTreeModel> vTree(VehicleTreeSearch search) {
List<Organization> orgList = Lists.newArrayList(); List<Organization> orgList = Lists.newArrayList();
...@@ -81,13 +80,9 @@ public class VehicleMonitorSevice { ...@@ -81,13 +80,9 @@ public class VehicleMonitorSevice {
} else { } else {
if (search.getOrgId() == null) { if (search.getOrgId() == null) {
R<List<Organization>> listR = organizationService.getRootOrganizations(); orgList = organizationApiService.getRootOrganizations();
orgList = listR.getDataList(new TypeToken<List<Organization>>() {
}.getType());
} else { } else {
R<List<Organization>> listR = organizationService.getSubOrganizations(search.getOrgId()); orgList = organizationApiService.getSubOrganizations(search.getOrgId());
orgList = listR.getDataList(new TypeToken<List<Organization>>() {
}.getType());
} }
} }
......
...@@ -22,7 +22,6 @@ import cn.com.glsx.admin.modules.utils.DateUtil; ...@@ -22,7 +22,6 @@ import cn.com.glsx.admin.modules.utils.DateUtil;
import cn.com.glsx.admin.modules.utils.FileIOUtil; import cn.com.glsx.admin.modules.utils.FileIOUtil;
import cn.com.glsx.auth.utils.ShieldContextHolder; import cn.com.glsx.auth.utils.ShieldContextHolder;
import cn.com.glsx.publiccenter.api.dto.response.SysDictDataResponse; import cn.com.glsx.publiccenter.api.dto.response.SysDictDataResponse;
import cn.com.glsx.usercenter.api.dto.request.FindUserRequest;
import cn.com.glsx.usercenter.api.dto.response.User; import cn.com.glsx.usercenter.api.dto.response.User;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
...@@ -48,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -48,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.InputStream; import java.io.InputStream;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @Desc:试驾车辆service * @Desc:试驾车辆service
...@@ -65,13 +65,13 @@ public class VehicleService { ...@@ -65,13 +65,13 @@ public class VehicleService {
private VehicleDeviceService vehicleDeviceService; private VehicleDeviceService vehicleDeviceService;
@Autowired @Autowired
private UserApiService userApiService; private DeviceService deviceService;
@Autowired @Autowired
private DeviceService deviceService; private UserApiService userApiService;
@Autowired @Autowired
private OrganizaService organizaService; private OrganizationApiService organizationApiService;
@Autowired @Autowired
private DictService dictService; private DictService dictService;
...@@ -125,7 +125,7 @@ public class VehicleService { ...@@ -125,7 +125,7 @@ public class VehicleService {
public PageInfo<TrialDriveVehiclePageDTO> searchTrialDrive(VehicleManageSearch search) { public PageInfo<TrialDriveVehiclePageDTO> searchTrialDrive(VehicleManageSearch search) {
PageHelper.startPage(search.getPageNumber(), search.getPageSize()); PageHelper.startPage(search.getPageNumber(), search.getPageSize());
List<TrialDriveVehiclePageDTO> listDriveVehicle = vehicleMapper.searchTrialDrive(search); List<TrialDriveVehiclePageDTO> listDriveVehicle = vehicleMapper.searchTrialDrive(search);
organizaService.drawOrganization(listDriveVehicle); organizationApiService.drawOrganization(listDriveVehicle);
return new PageInfo<>(listDriveVehicle); return new PageInfo<>(listDriveVehicle);
} }
...@@ -364,7 +364,7 @@ public class VehicleService { ...@@ -364,7 +364,7 @@ public class VehicleService {
return null; return null;
} }
BeanUtils.copyProperties(vehicle, editDTO); BeanUtils.copyProperties(vehicle, editDTO);
User user = userApiService.getUserByCreatedBy(vehicle.getCreatedBy()); User user = userApiService.getUserById(vehicle.getCreatedBy());
if (user != null) { if (user != null) {
editDTO.setShopNameId(user.getId()); editDTO.setShopNameId(user.getId());
editDTO.setShopName(user.getUsername()); editDTO.setShopName(user.getUsername());
...@@ -540,7 +540,7 @@ public class VehicleService { ...@@ -540,7 +540,7 @@ public class VehicleService {
} }
//2.分类的为空再用门店的匹配 //2.分类的为空再用门店的匹配
if (createId == null) { if (createId == null) {
createId = userApiService.getUserIdByShopName(shopName); createId = userApiService.getUserIdByUsername(shopName);
} }
//3.如果门店的仍然找不到 使用配置文件中默认的 //3.如果门店的仍然找不到 使用配置文件中默认的
if (createId == null || createId == 0L) { if (createId == null || createId == 0L) {
...@@ -568,7 +568,7 @@ public class VehicleService { ...@@ -568,7 +568,7 @@ public class VehicleService {
} }
//从用户表中查找后 存在更新后返回 //从用户表中查找后 存在更新后返回
String userRemark = accountData.getUserremark(); String userRemark = accountData.getUserremark();
Long userId = userApiService.getUserIdByShopName(userRemark); Long userId = userApiService.getUserIdByUsername(userRemark);
if (userId == null) { if (userId == null) {
return null; return null;
} }
...@@ -687,20 +687,6 @@ public class VehicleService { ...@@ -687,20 +687,6 @@ public class VehicleService {
} }
/** /**
* 根据门店名和编码查找用户
*
* @param shopName
* @param shopCode
* @return
*/
public List<User> findByNameAndCode(String shopName, String shopCode) {
FindUserRequest userRequest = new FindUserRequest();
userRequest.setUsername(shopName);
userRequest.setAccount(shopCode);
return userApiService.findByUser(userRequest);
}
/**
* 批量插入数据 * 批量插入数据
* *
* @param driveList * @param driveList
...@@ -746,6 +732,14 @@ public class VehicleService { ...@@ -746,6 +732,14 @@ public class VehicleService {
public PageInfo<TenantTypesDTO> tenantTypesSearch(TenantTypesSearch search) { public PageInfo<TenantTypesDTO> tenantTypesSearch(TenantTypesSearch search) {
Page page = PageHelper.startPage(search.getPageNumber(), search.getPageSize()); Page page = PageHelper.startPage(search.getPageNumber(), search.getPageSize());
List<TenantTypesDTO> list = tenantVehicleTypeMapper.search(search); List<TenantTypesDTO> list = tenantVehicleTypeMapper.search(search);
List<Long> userIds = list.stream().map(TenantTypesDTO::getCreatedBy).collect(Collectors.toList());
List<User> userList = userApiService.findByUser(userIds);
list.forEach(ttd -> {
});
return new PageInfo<>(list); return new PageInfo<>(list);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!