Compare commits
4 Commits
591d9cd518
...
5bf26c76d5
| Author | SHA1 | Date |
|---|---|---|
|
|
5bf26c76d5 | |
|
|
142b47f91f | |
|
|
5ea168155f | |
|
|
d0d78d54c6 |
|
|
@ -373,7 +373,7 @@ public class AdminUserController extends ControllerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* 搜索账号
|
||||
* 搜索账号(新)
|
||||
* @param request 请求参数
|
||||
*/
|
||||
@PostMapping("searchAccountNew")
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -99,10 +98,10 @@ public class AdminCustomerService {
|
|||
*/
|
||||
public void syncFromCrm(SyncFromCrmDTO dateParam) {
|
||||
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
// DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
// 循环从起始日期到结束日期,每次增加一天
|
||||
List<TBaseCustomer> result = new ArrayList<>();
|
||||
// List<TBaseCustomer> result = new ArrayList<>();
|
||||
// for (LocalDate date = stDate; !date.isAfter(edDate); date = date.plusDays(1)) {
|
||||
|
||||
|
||||
|
|
@ -110,12 +109,19 @@ public class AdminCustomerService {
|
|||
if (CollUtil.isEmpty(agentList)) {
|
||||
return;
|
||||
}
|
||||
Set<String> crmComanyCodes = agentList.stream().map(u -> u.getId()).collect(Collectors.toSet());
|
||||
List<TBaseCustomer> crmCompanyList = baseCustomerService.lambdaQuery().in(TBaseCustomer::getAgencyCompanyCode, crmComanyCodes).list();
|
||||
Map<String, TBaseCustomer> crmCompanyMap = crmCompanyList.stream().collect(Collectors.toMap(TBaseCustomer::getAgencyCompanyCode, cm -> cm));
|
||||
List<TBaseCustomer> result = new ArrayList<>();
|
||||
// Set<String> crmComanyCodes = agentList.stream().map(u -> u.getId()).collect(Collectors.toSet());
|
||||
// List<TBaseCustomer> crmCompanyList = baseCustomerService.lambdaQuery().in(TBaseCustomer::getAgencyCompanyCode, crmComanyCodes).list();
|
||||
// Map<String, TBaseCustomer> crmCompanyMap = crmCompanyList.stream().collect(Collectors.toMap(TBaseCustomer::getAgencyCompanyCode, cm -> cm));
|
||||
List<TBaseCustomer> customers = baseCustomerService.list();
|
||||
|
||||
agentList.forEach(u -> {
|
||||
TBaseCustomer ent = crmCompanyMap.get(u.getId());
|
||||
// TBaseCustomer ent = crmCompanyMap.get(u.getId());
|
||||
TBaseCustomer ent = customers.stream()
|
||||
.filter(c -> Objects.equals(c.getAgencyCompanyCode(), u.getId())
|
||||
|| StrUtil.equals(convertName(c.getAgencyCompanyName()), convertName(u.getName())))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (Objects.nonNull(ent)) {
|
||||
ent.setDataModifyTime(LocalDateTime.now());
|
||||
|
|
@ -150,5 +156,7 @@ public class AdminCustomerService {
|
|||
|
||||
}
|
||||
|
||||
|
||||
private String convertName(String name) {
|
||||
return name.replaceAll("\\s+", "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,4 +20,9 @@ public class TTest {
|
|||
public void test2() {
|
||||
System.out.println(StrUtil.toCamelCase("user_name"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test3() {
|
||||
System.out.println("【" + " 打 撒sfc dffd发多少分多少 分多少分的d f ".replaceAll("\\s+", "") + "】");
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -83,5 +84,5 @@ public class AdminUserVO {
|
|||
@JsonProperty("isGongfu")
|
||||
private boolean isGongfu;
|
||||
|
||||
private List<AdminUserVO> children;
|
||||
private List<AdminUserVO> children = new ArrayList<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import javax.validation.Valid;
|
|||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -58,8 +59,9 @@ public class DeviceTypeController extends ControllerBase {
|
|||
.eq(GongfuDeviceType::getParentId, 0)
|
||||
.orderByDesc(GongfuDeviceType::getId)
|
||||
.page(new Page<>(query.getPage(), query.getPageSize()));
|
||||
Set<Long> ids = result.getRecords().stream().map(GongfuDeviceType::getId).collect(Collectors.toSet());
|
||||
List<GongfuDeviceType> children = deviceTypeService.lambdaQuery()
|
||||
.in(GongfuDeviceType::getParentId, result.getRecords().stream().map(GongfuDeviceType::getId).collect(Collectors.toList()))
|
||||
.in(CollectionUtil.isNotEmpty(ids), GongfuDeviceType::getParentId, ids)
|
||||
.list();
|
||||
return ApiResult.success(convert(query, result, children));
|
||||
} else {
|
||||
|
|
@ -70,8 +72,9 @@ public class DeviceTypeController extends ControllerBase {
|
|||
if (CollectionUtil.isEmpty(children)) {
|
||||
return ApiResult.success(new PageData<>());
|
||||
}
|
||||
Set<Long> ids = children.stream().map(GongfuDeviceType::getParentId).collect(Collectors.toSet());
|
||||
Page<GongfuDeviceType> result = deviceTypeService.lambdaQuery()
|
||||
.in(GongfuDeviceType::getId, children.stream().map(GongfuDeviceType::getParentId).collect(Collectors.toSet()))
|
||||
.in(CollectionUtil.isNotEmpty(ids), GongfuDeviceType::getId, ids)
|
||||
.orderByDesc(GongfuDeviceType::getId)
|
||||
.page(new Page<>(query.getPage(), query.getPageSize()));
|
||||
return ApiResult.success(convert(query, result, children));
|
||||
|
|
|
|||
|
|
@ -443,34 +443,66 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
|||
if (CollectionUtil.isEmpty(adminUsers)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<AdminUserVO> userVOS = convert(roots, department, positions, roleMaps, roles);
|
||||
getChildren(userVOS.get(0), departments, adminUsers, positions, roleMaps, roles);
|
||||
for (int index = 1, size = userVOS.size(); index < size; index++) {
|
||||
userVOS.get(index).setChildren(userVOS.get(0).getChildren());
|
||||
List<AdminUserVO> rootUserVOS = convert(roots, department, positions, roleMaps, roles);
|
||||
getChildren(rootUserVOS.get(0), departments, adminUsers, positions, roleMaps, roles);
|
||||
for (int index = 1, size = rootUserVOS.size(); index < size; index++) {
|
||||
rootUserVOS.get(index).setChildren(rootUserVOS.get(0).getChildren());
|
||||
}
|
||||
return userVOS;
|
||||
return rootUserVOS;
|
||||
} else {
|
||||
List<AdminUser> adminUsers = lambdaQuery()
|
||||
.eq(AdminUser::getIsDel, false)
|
||||
.like(StrUtil.isNotBlank(request.getLoginName()), AdminUser::getLoginName, request.getLoginName())
|
||||
.like(StrUtil.isNotBlank(request.getUserName()), AdminUser::getUserName, request.getUserName())
|
||||
.eq(request.getState() != null, AdminUser::getState, request.getState())
|
||||
.list();
|
||||
if (CollectionUtil.isEmpty(adminUsers)) {
|
||||
List<AdminUser> searchUsers = adminUsers.stream()
|
||||
.filter(u -> (StrUtil.isBlank(request.getLoginName()) || StrUtil.contains(u.getLoginName(), request.getLoginName()))
|
||||
&& (StrUtil.isBlank(request.getUserName()) || StrUtil.contains(u.getUserName(), request.getUserName()))
|
||||
&& (request.getState() == null || Objects.equals(u.getState(), request.getState()))
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(searchUsers)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<AdminUserVO> userVOS = convert1(adminUsers, departments, positions, roleMaps, roles);
|
||||
Set<TBaseDepartment> departmentVOS = departments.stream()
|
||||
.filter(d -> userVOS.stream().map(AdminUserVO::getDepartmentId).anyMatch(dt -> Objects.equals(d.getId(), dt)))
|
||||
Set<TBaseDepartment> searchDepartments = departments.stream()
|
||||
.filter(d -> searchUsers.stream().map(AdminUser::getDepartmentId).anyMatch(dt -> Objects.equals(d.getId(), dt)))
|
||||
.collect(Collectors.toSet());
|
||||
departmentVOS.forEach(d -> bindParent(d, departmentVOS, departments));
|
||||
List<TBaseDepartment> rootDepartments = departmentVOS.stream()
|
||||
searchDepartments.forEach(d -> bindParent(d, searchDepartments, departments));
|
||||
List<TBaseDepartment> rootDepartments = searchDepartments.stream()
|
||||
.filter(d -> d.getDeptParentId() == 0)
|
||||
.collect(Collectors.toList());
|
||||
// List<AdminUserVO>
|
||||
// rootDepartments.forEach(d -> getChildren1(d, departmentVOS, adminUsers, positions, roleMaps, roles));
|
||||
//TODO 绑定树形结构
|
||||
return userVOS;
|
||||
List<AdminUser> rootUsers = adminUsers.stream()
|
||||
.filter(u -> rootDepartments.stream()
|
||||
.map(TBaseDepartment::getId).anyMatch(dt -> Objects.equals(u.getDepartmentId(), dt))
|
||||
).collect(Collectors.toList());
|
||||
List<AdminUserVO> rootUserVOS = convert1(rootUsers, departments, positions, roleMaps, roles);
|
||||
rootUserVOS.forEach(uvo -> getChildren1(uvo, departments, adminUsers, searchUsers, positions, roleMaps, roles));
|
||||
return rootUserVOS;
|
||||
}
|
||||
}
|
||||
|
||||
private void getChildren1(AdminUserVO user, List<TBaseDepartment> departments, List<AdminUser> users, List<AdminUser> searchUsers
|
||||
, List<TBasePosition> positions, List<AdminUserRoleMap> roleMaps, List<AdminRole> roles) {
|
||||
List<TBaseDepartment> cdepartments = departments.stream()
|
||||
.filter(d -> Objects.equals(d.getDeptParentId(), user.getDepartmentId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(cdepartments)) {
|
||||
cdepartments.forEach(department -> {
|
||||
List<AdminUser> csers = searchUsers.stream()
|
||||
.filter(u -> Objects.equals(u.getDepartmentId(), department.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(csers)) {
|
||||
csers = users.stream()
|
||||
.filter(u -> Objects.equals(u.getDepartmentId(), department.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(csers)) {
|
||||
List<AdminUserVO> cuserVOS = convert(csers, department, positions, roleMaps, roles);
|
||||
user.getChildren().addAll(cuserVOS);
|
||||
getChildren(cuserVOS.get(0), departments, users, positions, roleMaps, roles);
|
||||
for (int index = 1, size = cuserVOS.size(); index < size; index++) {
|
||||
cuserVOS.get(index).setChildren(cuserVOS.get(0).getChildren());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -540,22 +572,23 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
|||
|
||||
private void getChildren(AdminUserVO user, List<TBaseDepartment> departments, List<AdminUser> users
|
||||
, List<TBasePosition> positions, List<AdminUserRoleMap> roleMaps, List<AdminRole> roles) {
|
||||
TBaseDepartment department = departments.stream()
|
||||
List<TBaseDepartment> cdepartments = departments.stream()
|
||||
.filter(d -> Objects.equals(d.getDeptParentId(), user.getDepartmentId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(department)) {
|
||||
List<AdminUser> csers = users.stream()
|
||||
.filter(u -> Objects.equals(u.getDepartmentId(), department.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(csers)) {
|
||||
List<AdminUserVO> cuserVOS = convert(csers, department, positions, roleMaps, roles);
|
||||
user.setChildren(cuserVOS);
|
||||
getChildren(cuserVOS.get(0), departments, users, positions, roleMaps, roles);
|
||||
for (int index = 1, size = cuserVOS.size(); index < size; index++) {
|
||||
cuserVOS.get(index).setChildren(cuserVOS.get(0).getChildren());
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(cdepartments)) {
|
||||
cdepartments.forEach(department -> {
|
||||
List<AdminUser> csers = users.stream()
|
||||
.filter(u -> Objects.equals(u.getDepartmentId(), department.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(csers)) {
|
||||
List<AdminUserVO> cuserVOS = convert(csers, department, positions, roleMaps, roles);
|
||||
user.getChildren().addAll(cuserVOS);
|
||||
getChildren(cuserVOS.get(0), departments, users, positions, roleMaps, roles);
|
||||
for (int index = 1, size = cuserVOS.size(); index < size; index++) {
|
||||
cuserVOS.get(index).setChildren(cuserVOS.get(0).getChildren());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ public class AppVersionFilter extends OncePerRequestFilter {
|
|||
/**
|
||||
* 因前端部分接口遗漏App-Version参数,ios打包重新审核需要很久,所以需要排除掉,否则会导致接口无法访问
|
||||
*/
|
||||
private static final Set<String> WHITE_LIST = Set.of("getTicket", "uploadSingleFile", "getInfoById");
|
||||
private static final Set<String> WHITE_LIST = Set.of("getTicket", "uploadSingleFile", "getInfoById", "hangUp", "exportPdf");
|
||||
|
||||
private static final String MIN_SUPPER_VERSION = "1.0.9";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue