✨ 组织树独立权限、平台公司回写、合同计费客商角色与查看菜单补齐
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+6
-2
@@ -126,8 +126,11 @@ public class DeptController extends BladeController {
|
||||
|
||||
/**
|
||||
* 获取部门树形结构
|
||||
* <p>
|
||||
* 登录即可调用;数据范围由角色「数据权限」中 {@code dept_tree}(树形结构)单独配置,
|
||||
* 未配置时返回空树(默认不展示)。
|
||||
*/
|
||||
@PreAuth(menu = "dept")
|
||||
@PreAuth(AuthConstant.PERMIT_ALL)
|
||||
@GetMapping("/tree")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "树形结构", description = "树形结构")
|
||||
@@ -139,8 +142,9 @@ public class DeptController extends BladeController {
|
||||
* 懒加载获取部门树形结构
|
||||
* <p>
|
||||
* tenantId 由 Service 层完整决策:超管入参为空表示查全部,非超管强制覆盖为会话租户。
|
||||
* 数据范围与 {@link #tree} 相同,由 {@code dept_tree} 单独配置,未配置时返回空树。
|
||||
*/
|
||||
@PreAuth(menu = "dept")
|
||||
@PreAuth(AuthConstant.PERMIT_ALL)
|
||||
@GetMapping("/lazy-tree")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "懒加载树形结构", description = "树形结构")
|
||||
|
||||
+10
@@ -66,6 +66,16 @@ public interface IRoleMenuDataScopeService extends BaseService<RoleMenuDataScope
|
||||
*/
|
||||
RoleDataScopeVO resolveByMenuCode(List<Long> roleIds, String menuCode, List<Long> userDeptIds);
|
||||
|
||||
/**
|
||||
* 按菜单编码解析角色数据权限;菜单不存在或未配置时返回空权限(不回落为全部组织)
|
||||
*
|
||||
* @param roleIds 角色ID集合
|
||||
* @param menuCode 菜单编码
|
||||
* @param userDeptIds 用户所属组织
|
||||
* @return 解析结果
|
||||
*/
|
||||
RoleDataScopeVO resolveByMenuCodeOrEmpty(List<Long> roleIds, String menuCode, List<Long> userDeptIds);
|
||||
|
||||
/**
|
||||
* 合并用户全部角色菜单配置为最宽数据权限
|
||||
*
|
||||
|
||||
+35
-35
@@ -224,13 +224,18 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 组织树专用数据权限菜单编码(角色「数据权限」中单独配置;未配置时组织树默认不展示)。
|
||||
*/
|
||||
public static final String MENU_DEPT_TREE = "dept_tree";
|
||||
|
||||
/**
|
||||
* 解析当前登录用户的组织树数据权限。
|
||||
* <p>
|
||||
* 超管或角色菜单数据权限最宽合并为「全部组织」时不过滤;
|
||||
* 其余按角色配置的组织并集过滤。仅「本人创建」时按用户所属组织及下级展示组织树。
|
||||
* 仅读取 {@link #MENU_DEPT_TREE}「树形结构」菜单的数据权限配置,不再合并其他业务菜单;
|
||||
* 超管不过滤;未配置该菜单数据权限时返回空树(默认不显示)。
|
||||
*
|
||||
* @return 过滤上下文;无法识别用户时按空权限处理
|
||||
* @return 过滤上下文;无法识别用户或未配置时按空权限处理
|
||||
*/
|
||||
private DeptDataScopeFilter resolveDeptDataScopeFilter() {
|
||||
if (AuthUtil.isAdministrator()) {
|
||||
@@ -246,8 +251,11 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
if (Func.isNotEmpty(user) && Func.isNotEmpty(user.getDeptId())) {
|
||||
userDeptIds = Func.toLongList(user.getDeptId());
|
||||
}
|
||||
RoleDataScopeVO scope = roleMenuDataScopeService.resolveWidest(roleIds, userDeptIds);
|
||||
if (scope == null || scope.isAllDept()) {
|
||||
RoleDataScopeVO scope = roleMenuDataScopeService.resolveByMenuCodeOrEmpty(roleIds, MENU_DEPT_TREE, userDeptIds);
|
||||
if (scope == null) {
|
||||
return DeptDataScopeFilter.empty();
|
||||
}
|
||||
if (scope.isAllDept()) {
|
||||
return DeptDataScopeFilter.all();
|
||||
}
|
||||
LinkedHashSet<Long> allowedDeptIds = new LinkedHashSet<>();
|
||||
@@ -665,12 +673,9 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
dept.setAncestors(parent.getAncestors() + StringPool.COMMA + dept.getParentId());
|
||||
}
|
||||
dept.setIsDeleted(BladeConstant.DB_NOT_DELETED);
|
||||
if (dept.getIsPlatformCompany() == null) {
|
||||
dept.setIsPlatformCompany(0);
|
||||
}
|
||||
if (dept.getIsBusinessDept() == null) {
|
||||
dept.setIsBusinessDept(0);
|
||||
}
|
||||
// 统一规范为 0/1,避免前端传空串、布尔或其它类型导致更新未生效
|
||||
dept.setIsPlatformCompany(normalizeYesNoFlag(dept.getIsPlatformCompany()));
|
||||
dept.setIsBusinessDept(normalizeYesNoFlag(dept.getIsBusinessDept()));
|
||||
// 排序未填时默认 1
|
||||
if (dept.getSort() == null) {
|
||||
dept.setSort(1);
|
||||
@@ -679,9 +684,24 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
throw new ServiceException("租户ID不能为空");
|
||||
}
|
||||
validateDeptCategory(dept);
|
||||
validateDeptCode(dept, parent);
|
||||
validateDeptCode(dept);
|
||||
validateContractInitialSerial(dept);
|
||||
return saveOrUpdate(dept);
|
||||
boolean saved = saveOrUpdate(dept);
|
||||
if (saved && Func.isNotEmpty(dept.getId())) {
|
||||
// 显式回写两个业务标志,避免部分更新路径漏改
|
||||
this.update(Wrappers.<Dept>lambdaUpdate()
|
||||
.set(Dept::getIsPlatformCompany, dept.getIsPlatformCompany())
|
||||
.set(Dept::getIsBusinessDept, dept.getIsBusinessDept())
|
||||
.eq(Dept::getId, dept.getId()));
|
||||
}
|
||||
return saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将是否类标志规范为 0/1;空值按 0 处理。
|
||||
*/
|
||||
private Integer normalizeYesNoFlag(Integer flag) {
|
||||
return Integer.valueOf(1).equals(flag) ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -881,9 +901,9 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
}
|
||||
}
|
||||
|
||||
private void validateDeptCode(Dept dept, Dept parent) {
|
||||
private void validateDeptCode(Dept dept) {
|
||||
String deptCode = dept.getDeptCode();
|
||||
// 组织编码非必填,为空时存 null,避免唯一索引冲突
|
||||
// 组织编码非必填,为空时存 null,避免唯一索引冲突;不再校验 GWWL/上级编码+三位数字格式
|
||||
if (StringUtil.isBlank(deptCode)) {
|
||||
dept.setDeptCode(null);
|
||||
return;
|
||||
@@ -892,26 +912,6 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
if (deptCode.length() > 30) {
|
||||
throw new ServiceException("组织编码不能超过30个字符");
|
||||
}
|
||||
// 顶级组织不依赖上级编码
|
||||
if (parent == null) {
|
||||
this.ensureDeptCodeUnique(dept, deptCode);
|
||||
dept.setDeptCode(deptCode);
|
||||
return;
|
||||
}
|
||||
if (StringUtil.isBlank(parent.getDeptCode())) {
|
||||
throw new ServiceException("请选择已配置组织编码的上级组织");
|
||||
}
|
||||
// 公司:GWWL+三位数字;部门:所属公司编码+三位数字;其他:上级编码+三位数字
|
||||
String expectedParentCode = parent.getDeptCode();
|
||||
if (DeptCategory.COMPANY.getCode().equals(dept.getDeptCategory())) {
|
||||
expectedParentCode = OAConvertConstant.OA_SYNC_ROOT_DEPT_CODE;
|
||||
} else if (DeptCategory.DEPT.getCode().equals(dept.getDeptCategory())
|
||||
&& StringUtil.isNotBlank(dept.getBelongCompanyCode())) {
|
||||
expectedParentCode = dept.getBelongCompanyCode();
|
||||
}
|
||||
if (!org.springblade.system.util.DeptCodeUtil.matchesChildCode(expectedParentCode, deptCode)) {
|
||||
throw new ServiceException("组织编码格式应为:" + expectedParentCode + "三位数字(不足补零,中间不加-)");
|
||||
}
|
||||
this.ensureDeptCodeUnique(dept, deptCode);
|
||||
dept.setDeptCode(deptCode);
|
||||
}
|
||||
|
||||
+32
-8
@@ -184,20 +184,44 @@ public class RoleMenuDataScopeServiceImpl extends BaseServiceImpl<RoleMenuDataSc
|
||||
if (Func.isEmpty(roleIds) || Func.isBlank(menuCode)) {
|
||||
return RoleDataScopeVO.all();
|
||||
}
|
||||
Menu menu = menuMapper.selectOne(Wrappers.<Menu>lambdaQuery()
|
||||
.eq(Menu::getCode, menuCode)
|
||||
.eq(Menu::getIsDeleted, 0)
|
||||
.last("limit 1"));
|
||||
Menu menu = findMenuByCode(menuCode);
|
||||
if (Func.isEmpty(menu)) {
|
||||
return RoleDataScopeVO.all();
|
||||
}
|
||||
List<RoleMenuDataScope> scopeList = list(Wrappers.<RoleMenuDataScope>lambdaQuery()
|
||||
.in(RoleMenuDataScope::getRoleId, roleIds)
|
||||
.eq(RoleMenuDataScope::getMenuId, menu.getId())
|
||||
.eq(RoleMenuDataScope::getIsDeleted, 0));
|
||||
List<RoleMenuDataScope> scopeList = listScopes(roleIds, menu.getId());
|
||||
return mergeScopes(scopeList, userDeptIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleDataScopeVO resolveByMenuCodeOrEmpty(List<Long> roleIds, String menuCode, List<Long> userDeptIds) {
|
||||
if (Func.isEmpty(roleIds) || Func.isBlank(menuCode)) {
|
||||
return RoleDataScopeVO.none();
|
||||
}
|
||||
Menu menu = findMenuByCode(menuCode);
|
||||
if (Func.isEmpty(menu)) {
|
||||
return RoleDataScopeVO.none();
|
||||
}
|
||||
List<RoleMenuDataScope> scopeList = listScopes(roleIds, menu.getId());
|
||||
if (Func.isEmpty(scopeList)) {
|
||||
return RoleDataScopeVO.none();
|
||||
}
|
||||
return mergeScopes(scopeList, userDeptIds);
|
||||
}
|
||||
|
||||
private Menu findMenuByCode(String menuCode) {
|
||||
return menuMapper.selectOne(Wrappers.<Menu>lambdaQuery()
|
||||
.eq(Menu::getCode, menuCode)
|
||||
.eq(Menu::getIsDeleted, 0)
|
||||
.last("limit 1"));
|
||||
}
|
||||
|
||||
private List<RoleMenuDataScope> listScopes(List<Long> roleIds, Long menuId) {
|
||||
return list(Wrappers.<RoleMenuDataScope>lambdaQuery()
|
||||
.in(RoleMenuDataScope::getRoleId, roleIds)
|
||||
.eq(RoleMenuDataScope::getMenuId, menuId)
|
||||
.eq(RoleMenuDataScope::getIsDeleted, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleDataScopeVO resolveWidest(List<Long> roleIds, List<Long> userDeptIds) {
|
||||
if (Func.isEmpty(roleIds)) {
|
||||
|
||||
+1
-1
@@ -310,7 +310,7 @@ public class CommonAddressServiceImpl extends BaseServiceImpl<CommonAddressMappe
|
||||
|
||||
private void fillDisplay(CommonAddressVO address) {
|
||||
address.setSiteCodeDisplay(TYPE_NORMAL.equals(address.getAddressType()) ? NORMAL_SITE_CODE : address.getSiteCode());
|
||||
address.setReadonly(!TransportBusinessSupport.isAdministrator() && !Objects.equals(address.getDeptId(), currentDeptId()));
|
||||
address.setReadonly(TransportBusinessSupport.isDeptReadonly(address.getDeptId(), TransportBusinessSupport.MENU_COMMON_ADDRESS));
|
||||
address.setCreateUserName(UserCache.getUserRealName(address.getCreateUser()));
|
||||
address.setUpdateUserName(UserCache.getUserRealName(address.getUpdateUser()));
|
||||
}
|
||||
|
||||
+15
-19
@@ -60,7 +60,6 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -646,6 +645,7 @@ public class ContractManageServiceImpl extends BaseServiceImpl<ContractManageMap
|
||||
.eq(Func.isNotEmpty(contractManage.getArchiveStatus()), ContractManage::getArchiveStatus, contractManage.getArchiveStatus())
|
||||
.eq(Func.isNotEmpty(contractManage.getContractStage()), ContractManage::getContractStage, contractManage.getContractStage())
|
||||
.orderByDesc(ContractManage::getCreateTime);
|
||||
applyPartyName(queryWrapper, contractManage.getPartyName());
|
||||
applyEffectiveType(queryWrapper, contractManage.getEffectiveType());
|
||||
applyExpireScope(queryWrapper, contractManage.getExpireScope());
|
||||
// 是否同步金蝶(kingdee_id 是否已回填)/ 是否同步合规(hcs_sync_status 是否 synced)
|
||||
@@ -671,6 +671,18 @@ public class ContractManageServiceImpl extends BaseServiceImpl<ContractManageMap
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 客商筛选:匹配合同甲/乙/丙方名称(模糊)
|
||||
*/
|
||||
private void applyPartyName(LambdaQueryWrapper<ContractManage> queryWrapper, String partyName) {
|
||||
if (Func.isEmpty(partyName)) {
|
||||
return;
|
||||
}
|
||||
queryWrapper.and(wrapper -> wrapper.like(ContractManage::getPartyA, partyName)
|
||||
.or().like(ContractManage::getPartyB, partyName)
|
||||
.or().like(ContractManage::getPartyC, partyName));
|
||||
}
|
||||
|
||||
private void applyEffectiveType(LambdaQueryWrapper<ContractManage> queryWrapper, String effectiveType) {
|
||||
if (Func.isEmpty(effectiveType)) {
|
||||
return;
|
||||
@@ -700,7 +712,7 @@ public class ContractManageServiceImpl extends BaseServiceImpl<ContractManageMap
|
||||
.lt(ContractManage::getTemporaryEndDate, today)
|
||||
.or(wrapper2 -> wrapper2.ne(ContractManage::getContractStage, STAGE_TEMPORARY)
|
||||
.lt(ContractManage::getEndDate, today)));
|
||||
default -> throw new ServiceException("无效的生效类型筛选条件");
|
||||
default -> throw new ServiceException("无效的合同状态筛选条件");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1049,18 +1061,11 @@ public class ContractManageServiceImpl extends BaseServiceImpl<ContractManageMap
|
||||
if (!(parsed instanceof List<?> plans)) {
|
||||
throw new ServiceException("计费方案设置格式不正确");
|
||||
}
|
||||
Map<String, Integer> defaultPlanCount = new HashMap<>();
|
||||
for (Object value : plans) {
|
||||
if (!(value instanceof Map<?, ?> plan)) {
|
||||
throw new ServiceException("计费方案设置格式不正确");
|
||||
}
|
||||
String transportMode = trimValue(plan.get("transportMode"));
|
||||
if (isDefaultBillingPlan(plan)) {
|
||||
int count = defaultPlanCount.merge(transportMode, 1, Integer::sum);
|
||||
if (count > 1) {
|
||||
throw new ServiceException("同一运输方式仅支持配置一个默认计费方案");
|
||||
}
|
||||
}
|
||||
// 一个客商对应一个方案,不再校验「默认方案」
|
||||
validateBillingMatchConditions(plan);
|
||||
validateBillingRuleTaxRates(plan);
|
||||
}
|
||||
@@ -1122,15 +1127,6 @@ public class ContractManageServiceImpl extends BaseServiceImpl<ContractManageMap
|
||||
return value != null && !String.valueOf(value).trim().isEmpty();
|
||||
}
|
||||
|
||||
private boolean isDefaultBillingPlan(Map<?, ?> plan) {
|
||||
Object value = plan.get("defaultPlan");
|
||||
return Boolean.TRUE.equals(value) || "true".equalsIgnoreCase(String.valueOf(value)) || "1".equals(String.valueOf(value));
|
||||
}
|
||||
|
||||
private String trimValue(Object value) {
|
||||
return value == null ? null : TransportBusinessSupport.trimToNull(String.valueOf(value));
|
||||
}
|
||||
|
||||
private void validatePaymentRatios(String paymentRatioJson) {
|
||||
if (Func.isEmpty(paymentRatioJson)) return;
|
||||
try {
|
||||
|
||||
+35
-3
@@ -93,7 +93,8 @@ public final class ContractPartySupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验计费方案均已绑定合同明细中的客商
|
||||
* 校验计费方案均已绑定合同明细中的客商。
|
||||
* 客户合同仅允许绑定甲方;承运商合同仅允许绑定乙方/丙方。
|
||||
*/
|
||||
public static void validateBillingPlanBindings(ContractManage contractManage) {
|
||||
String billingPlanJson = contractManage.getBillingPlanJson();
|
||||
@@ -104,7 +105,10 @@ public final class ContractPartySupport {
|
||||
if (!(parsed instanceof List<?> plans) || plans.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Map<String, Map<String, Object>> partyByRowId = indexPartyRows(contractManage);
|
||||
Set<String> allowedRoles = allowedBillingPartyRoles(contractManage.getContractCategory());
|
||||
Map<String, Map<String, Object>> partyByRowId = indexPartyRows(contractManage).entrySet().stream()
|
||||
.filter(entry -> allowedRoles.contains(normalizeRole(String.valueOf(entry.getValue().get("partyRole")))))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (left, right) -> left, LinkedHashMap::new));
|
||||
Set<String> customerKeys = partyByRowId.values().stream()
|
||||
.map(ContractPartySupport::customerMatchKey)
|
||||
.filter(Func::isNotEmpty)
|
||||
@@ -121,6 +125,9 @@ public final class ContractPartySupport {
|
||||
if (Func.isEmpty(partyRowId) && Func.isEmpty(customerId) && Func.isEmpty(customerName)) {
|
||||
throw new ServiceException("计费方案第" + (index + 1) + "个必须选择适用客商");
|
||||
}
|
||||
if (Func.isNotEmpty(partyRole) && !allowedRoles.contains(partyRole)) {
|
||||
throw new ServiceException(billingPartyRoleMessage(contractManage.getContractCategory(), index + 1));
|
||||
}
|
||||
boolean matched = false;
|
||||
if (Func.isNotEmpty(partyRowId) && partyByRowId.containsKey(partyRowId)) {
|
||||
matched = true;
|
||||
@@ -134,11 +141,36 @@ public final class ContractPartySupport {
|
||||
}
|
||||
}
|
||||
if (!matched) {
|
||||
throw new ServiceException("计费方案第" + (index + 1) + "个适用客商不在合同甲/乙/丙明细中");
|
||||
throw new ServiceException(billingPartyRoleMessage(contractManage.getContractCategory(), index + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计费方案可选客商角色:客户合同=甲方;承运商合同=乙方/丙方
|
||||
*/
|
||||
public static Set<String> allowedBillingPartyRoles(String contractCategory) {
|
||||
String category = Func.toStr(contractCategory).trim();
|
||||
if ("承运商合同".equals(category)) {
|
||||
return Set.of(ROLE_B, ROLE_C);
|
||||
}
|
||||
if ("客户合同".equals(category)) {
|
||||
return Set.of(ROLE_A);
|
||||
}
|
||||
return Set.of(ROLE_A, ROLE_B, ROLE_C);
|
||||
}
|
||||
|
||||
private static String billingPartyRoleMessage(String contractCategory, int planIndex) {
|
||||
String category = Func.toStr(contractCategory).trim();
|
||||
if ("承运商合同".equals(category)) {
|
||||
return "计费方案第" + planIndex + "个适用客商只能选择乙方或丙方";
|
||||
}
|
||||
if ("客户合同".equals(category)) {
|
||||
return "计费方案第" + planIndex + "个适用客商只能选择甲方";
|
||||
}
|
||||
return "计费方案第" + planIndex + "个适用客商不在合同甲/乙/丙明细中";
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> parsePartyRows(String partyJson) {
|
||||
if (Func.isEmpty(partyJson)) {
|
||||
return List.of();
|
||||
|
||||
+2
-4
@@ -23,12 +23,11 @@
|
||||
package org.springblade.transport.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.pojo.entity.CommonCargo;
|
||||
import org.springblade.transport.pojo.vo.CommonCargoVO;
|
||||
import org.springblade.transport.support.TransportBusinessSupport;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
@@ -52,8 +51,7 @@ public class CommonCargoWrapper extends BaseEntityWrapper<CommonCargo, CommonCar
|
||||
}
|
||||
commonCargoVO.setCreateUserName(UserCache.getUserRealName(commonCargo.getCreateUser()));
|
||||
commonCargoVO.setUpdateUserName(UserCache.getUserRealName(commonCargo.getUpdateUser()));
|
||||
Long currentDeptId = Func.firstLong(AuthUtil.getDeptId());
|
||||
commonCargoVO.setReadonly(currentDeptId != null && !Objects.equals(commonCargo.getDeptId(), currentDeptId));
|
||||
commonCargoVO.setReadonly(TransportBusinessSupport.isDeptReadonly(commonCargo.getDeptId(), TransportBusinessSupport.MENU_COMMON_CARGO));
|
||||
return commonCargoVO;
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -23,12 +23,11 @@
|
||||
package org.springblade.transport.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.pojo.entity.CommonRoute;
|
||||
import org.springblade.transport.pojo.vo.CommonRouteVO;
|
||||
import org.springblade.transport.support.TransportBusinessSupport;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -48,8 +47,7 @@ public class CommonRouteWrapper extends BaseEntityWrapper<CommonRoute, CommonRou
|
||||
CommonRouteVO commonRouteVO = Objects.requireNonNull(BeanUtil.copyProperties(commonRoute, CommonRouteVO.class));
|
||||
commonRouteVO.setCreateUserName(UserCache.getUserRealName(commonRoute.getCreateUser()));
|
||||
commonRouteVO.setUpdateUserName(UserCache.getUserRealName(commonRoute.getUpdateUser()));
|
||||
Long currentDeptId = Func.firstLong(AuthUtil.getDeptId());
|
||||
commonRouteVO.setReadonly(currentDeptId != null && !Objects.equals(commonRoute.getDeptId(), currentDeptId));
|
||||
commonRouteVO.setReadonly(TransportBusinessSupport.isDeptReadonly(commonRoute.getDeptId(), TransportBusinessSupport.MENU_COMMON_ROUTE));
|
||||
return commonRouteVO;
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -5,12 +5,11 @@
|
||||
package org.springblade.transport.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.pojo.entity.LoadingManage;
|
||||
import org.springblade.transport.pojo.vo.LoadingManageVO;
|
||||
import org.springblade.transport.support.TransportBusinessSupport;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
@@ -31,8 +30,7 @@ public class LoadingManageWrapper extends BaseEntityWrapper<LoadingManage, Loadi
|
||||
LoadingManageVO loadingManageVO = Objects.requireNonNull(BeanUtil.copyProperties(loadingManage, LoadingManageVO.class));
|
||||
loadingManageVO.setCreateUserName(UserCache.getUserRealName(loadingManage.getCreateUser()));
|
||||
loadingManageVO.setUpdateUserName(UserCache.getUserRealName(loadingManage.getUpdateUser()));
|
||||
Long currentDeptId = Func.firstLong(AuthUtil.getDeptId());
|
||||
loadingManageVO.setReadonly(currentDeptId != null && !Objects.equals(loadingManage.getDeptId(), currentDeptId));
|
||||
loadingManageVO.setReadonly(TransportBusinessSupport.isDeptReadonly(loadingManage.getDeptId(), TransportBusinessSupport.MENU_LOADING_MANAGE));
|
||||
loadingManageVO.setBusinessStatusName(businessStatusName(loadingManage.getBusinessStatus()));
|
||||
// 未维护里程的占位值 -1 对外展示为空
|
||||
if (loadingManageVO.getMileage() != null
|
||||
|
||||
+2
-4
@@ -23,12 +23,11 @@
|
||||
package org.springblade.transport.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.pojo.entity.ProcessConfig;
|
||||
import org.springblade.transport.pojo.vo.ProcessConfigVO;
|
||||
import org.springblade.transport.support.TransportBusinessSupport;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -48,8 +47,7 @@ public class ProcessConfigWrapper extends BaseEntityWrapper<ProcessConfig, Proce
|
||||
ProcessConfigVO processConfigVO = Objects.requireNonNull(BeanUtil.copyProperties(processConfig, ProcessConfigVO.class));
|
||||
processConfigVO.setCreateUserName(UserCache.getUserRealName(processConfig.getCreateUser()));
|
||||
processConfigVO.setUpdateUserName(UserCache.getUserRealName(processConfig.getUpdateUser()));
|
||||
Long currentDeptId = Func.firstLong(AuthUtil.getDeptId());
|
||||
processConfigVO.setReadonly(currentDeptId != null && !Objects.equals(processConfig.getDeptId(), currentDeptId));
|
||||
processConfigVO.setReadonly(TransportBusinessSupport.isDeptReadonly(processConfig.getDeptId(), TransportBusinessSupport.MENU_PROCESS_CONFIG));
|
||||
processConfigVO.setStatusName(statusName(processConfig.getStatus()));
|
||||
return processConfigVO;
|
||||
}
|
||||
|
||||
+2
-4
@@ -23,12 +23,11 @@
|
||||
package org.springblade.transport.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.pojo.entity.ShippingTemplate;
|
||||
import org.springblade.transport.pojo.vo.ShippingTemplateVO;
|
||||
import org.springblade.transport.support.TransportBusinessSupport;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -48,8 +47,7 @@ public class ShippingTemplateWrapper extends BaseEntityWrapper<ShippingTemplate,
|
||||
ShippingTemplateVO shippingTemplateVO = Objects.requireNonNull(BeanUtil.copyProperties(shippingTemplate, ShippingTemplateVO.class));
|
||||
shippingTemplateVO.setCreateUserName(UserCache.getUserRealName(shippingTemplate.getCreateUser()));
|
||||
shippingTemplateVO.setUpdateUserName(UserCache.getUserRealName(shippingTemplate.getUpdateUser()));
|
||||
Long currentDeptId = Func.firstLong(AuthUtil.getDeptId());
|
||||
shippingTemplateVO.setReadonly(currentDeptId != null && !Objects.equals(shippingTemplate.getDeptId(), currentDeptId));
|
||||
shippingTemplateVO.setReadonly(TransportBusinessSupport.isDeptReadonly(shippingTemplate.getDeptId(), TransportBusinessSupport.MENU_SHIPPING_TEMPLATE));
|
||||
return shippingTemplateVO;
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -23,9 +23,7 @@
|
||||
package org.springblade.transport.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.pojo.entity.TransportPlan;
|
||||
import org.springblade.transport.pojo.vo.TransportPlanVO;
|
||||
@@ -50,8 +48,7 @@ public class TransportPlanWrapper extends BaseEntityWrapper<TransportPlan, Trans
|
||||
transportPlanVO.setCreateUserName(UserCache.getUserRealName(transportPlan.getCreateUser()));
|
||||
transportPlanVO.setUpdateUserName(UserCache.getUserRealName(transportPlan.getUpdateUser()));
|
||||
transportPlanVO.setDataSource(TransportBusinessSupport.normalizeTransportPlanDataSource(transportPlan.getDataSource()));
|
||||
Long currentDeptId = Func.firstLong(AuthUtil.getDeptId());
|
||||
transportPlanVO.setReadonly(currentDeptId != null && !Objects.equals(transportPlan.getDeptId(), currentDeptId));
|
||||
transportPlanVO.setReadonly(TransportBusinessSupport.isDeptReadonly(transportPlan.getDeptId(), TransportBusinessSupport.MENU_TRANSPORT_PLAN));
|
||||
transportPlanVO.setBusinessStatusName(businessStatusName(transportPlan.getBusinessStatus()));
|
||||
return transportPlanVO;
|
||||
}
|
||||
|
||||
+1
-3
@@ -23,7 +23,6 @@
|
||||
package org.springblade.transport.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.DictBizCache;
|
||||
@@ -54,8 +53,7 @@ public class WaybillWrapper extends BaseEntityWrapper<Waybill, WaybillVO> {
|
||||
waybillVO.setCreateUserName(UserCache.getUserRealName(waybill.getCreateUser()));
|
||||
waybillVO.setUpdateUserName(UserCache.getUserRealName(waybill.getUpdateUser()));
|
||||
waybillVO.setDataSource(TransportBusinessSupport.normalizeWaybillDataSource(waybill.getDataSource()));
|
||||
Long currentDeptId = Func.firstLong(AuthUtil.getDeptId());
|
||||
waybillVO.setReadonly(currentDeptId != null && !Objects.equals(waybill.getDeptId(), currentDeptId));
|
||||
waybillVO.setReadonly(TransportBusinessSupport.isDeptReadonly(waybill.getDeptId(), TransportBusinessSupport.MENU_WAYBILL_MANAGE));
|
||||
String displayStatus = WaybillProcessSupport.normalizeBusinessStatus(
|
||||
waybill.getBusinessStatus(), waybill.getProcessJson(), waybill.getDriverAcceptStatus());
|
||||
waybillVO.setBusinessStatus(displayStatus);
|
||||
|
||||
Reference in New Issue
Block a user