Compare commits

..

No commits in common. "5bf26c76d5aacfa487c15d110dcb9014ef981547" and "591d9cd5185163f3f04e48af0cd0a816f21f6115" have entirely different histories.

7 changed files with 46 additions and 96 deletions

View File

@ -373,7 +373,7 @@ public class AdminUserController extends ControllerBase {
} }
/** /**
* 搜索账号 * 搜索账号
* @param request 请求参数 * @param request 请求参数
*/ */
@PostMapping("searchAccountNew") @PostMapping("searchAccountNew")

View File

@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -98,10 +99,10 @@ public class AdminCustomerService {
*/ */
public void syncFromCrm(SyncFromCrmDTO dateParam) { 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)) { // for (LocalDate date = stDate; !date.isAfter(edDate); date = date.plusDays(1)) {
@ -109,19 +110,12 @@ public class AdminCustomerService {
if (CollUtil.isEmpty(agentList)) { if (CollUtil.isEmpty(agentList)) {
return; return;
} }
List<TBaseCustomer> result = new ArrayList<>(); Set<String> crmComanyCodes = agentList.stream().map(u -> u.getId()).collect(Collectors.toSet());
// Set<String> crmComanyCodes = agentList.stream().map(u -> u.getId()).collect(Collectors.toSet()); List<TBaseCustomer> crmCompanyList = baseCustomerService.lambdaQuery().in(TBaseCustomer::getAgencyCompanyCode, crmComanyCodes).list();
// List<TBaseCustomer> crmCompanyList = baseCustomerService.lambdaQuery().in(TBaseCustomer::getAgencyCompanyCode, crmComanyCodes).list(); Map<String, TBaseCustomer> crmCompanyMap = crmCompanyList.stream().collect(Collectors.toMap(TBaseCustomer::getAgencyCompanyCode, cm -> cm));
// Map<String, TBaseCustomer> crmCompanyMap = crmCompanyList.stream().collect(Collectors.toMap(TBaseCustomer::getAgencyCompanyCode, cm -> cm));
List<TBaseCustomer> customers = baseCustomerService.list();
agentList.forEach(u -> { 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)) { if (Objects.nonNull(ent)) {
ent.setDataModifyTime(LocalDateTime.now()); ent.setDataModifyTime(LocalDateTime.now());
@ -156,7 +150,5 @@ public class AdminCustomerService {
} }
private String convertName(String name) {
return name.replaceAll("\\s+", "");
}
} }

View File

@ -20,9 +20,4 @@ public class TTest {
public void test2() { public void test2() {
System.out.println(StrUtil.toCamelCase("user_name")); System.out.println(StrUtil.toCamelCase("user_name"));
} }
}
@Test
public void test3() {
System.out.println("" + " 打 撒sfc dffd发多少分多少 分多少分的d f ".replaceAll("\\s+", "") + "");
}
}

View File

@ -5,7 +5,6 @@ import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -84,5 +83,5 @@ public class AdminUserVO {
@JsonProperty("isGongfu") @JsonProperty("isGongfu")
private boolean isGongfu; private boolean isGongfu;
private List<AdminUserVO> children = new ArrayList<>(); private List<AdminUserVO> children;
} }

View File

@ -30,7 +30,6 @@ import javax.validation.Valid;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -59,9 +58,8 @@ public class DeviceTypeController extends ControllerBase {
.eq(GongfuDeviceType::getParentId, 0) .eq(GongfuDeviceType::getParentId, 0)
.orderByDesc(GongfuDeviceType::getId) .orderByDesc(GongfuDeviceType::getId)
.page(new Page<>(query.getPage(), query.getPageSize())); .page(new Page<>(query.getPage(), query.getPageSize()));
Set<Long> ids = result.getRecords().stream().map(GongfuDeviceType::getId).collect(Collectors.toSet());
List<GongfuDeviceType> children = deviceTypeService.lambdaQuery() List<GongfuDeviceType> children = deviceTypeService.lambdaQuery()
.in(CollectionUtil.isNotEmpty(ids), GongfuDeviceType::getParentId, ids) .in(GongfuDeviceType::getParentId, result.getRecords().stream().map(GongfuDeviceType::getId).collect(Collectors.toList()))
.list(); .list();
return ApiResult.success(convert(query, result, children)); return ApiResult.success(convert(query, result, children));
} else { } else {
@ -72,9 +70,8 @@ public class DeviceTypeController extends ControllerBase {
if (CollectionUtil.isEmpty(children)) { if (CollectionUtil.isEmpty(children)) {
return ApiResult.success(new PageData<>()); return ApiResult.success(new PageData<>());
} }
Set<Long> ids = children.stream().map(GongfuDeviceType::getParentId).collect(Collectors.toSet());
Page<GongfuDeviceType> result = deviceTypeService.lambdaQuery() Page<GongfuDeviceType> result = deviceTypeService.lambdaQuery()
.in(CollectionUtil.isNotEmpty(ids), GongfuDeviceType::getId, ids) .in(GongfuDeviceType::getId, children.stream().map(GongfuDeviceType::getParentId).collect(Collectors.toSet()))
.orderByDesc(GongfuDeviceType::getId) .orderByDesc(GongfuDeviceType::getId)
.page(new Page<>(query.getPage(), query.getPageSize())); .page(new Page<>(query.getPage(), query.getPageSize()));
return ApiResult.success(convert(query, result, children)); return ApiResult.success(convert(query, result, children));

View File

@ -443,66 +443,34 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
if (CollectionUtil.isEmpty(adminUsers)) { if (CollectionUtil.isEmpty(adminUsers)) {
return Collections.emptyList(); return Collections.emptyList();
} }
List<AdminUserVO> rootUserVOS = convert(roots, department, positions, roleMaps, roles); List<AdminUserVO> userVOS = convert(roots, department, positions, roleMaps, roles);
getChildren(rootUserVOS.get(0), departments, adminUsers, positions, roleMaps, roles); getChildren(userVOS.get(0), departments, adminUsers, positions, roleMaps, roles);
for (int index = 1, size = rootUserVOS.size(); index < size; index++) { for (int index = 1, size = userVOS.size(); index < size; index++) {
rootUserVOS.get(index).setChildren(rootUserVOS.get(0).getChildren()); userVOS.get(index).setChildren(userVOS.get(0).getChildren());
} }
return rootUserVOS; return userVOS;
} else { } else {
List<AdminUser> adminUsers = lambdaQuery() List<AdminUser> adminUsers = lambdaQuery()
.eq(AdminUser::getIsDel, false) .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(); .list();
List<AdminUser> searchUsers = adminUsers.stream() if (CollectionUtil.isEmpty(adminUsers)) {
.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(); return Collections.emptyList();
} }
Set<TBaseDepartment> searchDepartments = departments.stream() List<AdminUserVO> userVOS = convert1(adminUsers, departments, positions, roleMaps, roles);
.filter(d -> searchUsers.stream().map(AdminUser::getDepartmentId).anyMatch(dt -> Objects.equals(d.getId(), dt))) Set<TBaseDepartment> departmentVOS = departments.stream()
.filter(d -> userVOS.stream().map(AdminUserVO::getDepartmentId).anyMatch(dt -> Objects.equals(d.getId(), dt)))
.collect(Collectors.toSet()); .collect(Collectors.toSet());
searchDepartments.forEach(d -> bindParent(d, searchDepartments, departments)); departmentVOS.forEach(d -> bindParent(d, departmentVOS, departments));
List<TBaseDepartment> rootDepartments = searchDepartments.stream() List<TBaseDepartment> rootDepartments = departmentVOS.stream()
.filter(d -> d.getDeptParentId() == 0) .filter(d -> d.getDeptParentId() == 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<AdminUser> rootUsers = adminUsers.stream() // List<AdminUserVO>
.filter(u -> rootDepartments.stream() // rootDepartments.forEach(d -> getChildren1(d, departmentVOS, adminUsers, positions, roleMaps, roles));
.map(TBaseDepartment::getId).anyMatch(dt -> Objects.equals(u.getDepartmentId(), dt)) //TODO 绑定树形结构
).collect(Collectors.toList()); return userVOS;
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());
}
}
});
} }
} }
@ -572,23 +540,22 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
private void getChildren(AdminUserVO user, List<TBaseDepartment> departments, List<AdminUser> users private void getChildren(AdminUserVO user, List<TBaseDepartment> departments, List<AdminUser> users
, List<TBasePosition> positions, List<AdminUserRoleMap> roleMaps, List<AdminRole> roles) { , List<TBasePosition> positions, List<AdminUserRoleMap> roleMaps, List<AdminRole> roles) {
List<TBaseDepartment> cdepartments = departments.stream() TBaseDepartment department = departments.stream()
.filter(d -> Objects.equals(d.getDeptParentId(), user.getDepartmentId())) .filter(d -> Objects.equals(d.getDeptParentId(), user.getDepartmentId()))
.collect(Collectors.toList()); .findFirst()
if (CollectionUtil.isNotEmpty(cdepartments)) { .orElse(null);
cdepartments.forEach(department -> { if (Objects.nonNull(department)) {
List<AdminUser> csers = users.stream() List<AdminUser> csers = users.stream()
.filter(u -> Objects.equals(u.getDepartmentId(), department.getId())) .filter(u -> Objects.equals(u.getDepartmentId(), department.getId()))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(csers)) { if (CollectionUtil.isNotEmpty(csers)) {
List<AdminUserVO> cuserVOS = convert(csers, department, positions, roleMaps, roles); List<AdminUserVO> cuserVOS = convert(csers, department, positions, roleMaps, roles);
user.getChildren().addAll(cuserVOS); user.setChildren(cuserVOS);
getChildren(cuserVOS.get(0), departments, users, positions, roleMaps, roles); getChildren(cuserVOS.get(0), departments, users, positions, roleMaps, roles);
for (int index = 1, size = cuserVOS.size(); index < size; index++) { for (int index = 1, size = cuserVOS.size(); index < size; index++) {
cuserVOS.get(index).setChildren(cuserVOS.get(0).getChildren()); cuserVOS.get(index).setChildren(cuserVOS.get(0).getChildren());
}
} }
}); }
} }
} }
} }

View File

@ -30,7 +30,7 @@ public class AppVersionFilter extends OncePerRequestFilter {
/** /**
* 因前端部分接口遗漏App-Version参数ios打包重新审核需要很久所以需要排除掉否则会导致接口无法访问 * 因前端部分接口遗漏App-Version参数ios打包重新审核需要很久所以需要排除掉否则会导致接口无法访问
*/ */
private static final Set<String> WHITE_LIST = Set.of("getTicket", "uploadSingleFile", "getInfoById", "hangUp", "exportPdf"); private static final Set<String> WHITE_LIST = Set.of("getTicket", "uploadSingleFile", "getInfoById");
private static final String MIN_SUPPER_VERSION = "1.0.9"; private static final String MIN_SUPPER_VERSION = "1.0.9";