1、移除无用post岗位代码;2、发票管理单元测试完善,优惠活动单测覆盖率异常修复;

This commit is contained in:
gaoqr
2025-12-16 16:27:25 +08:00
parent bdeb0366f9
commit 010678724d
19 changed files with 1310 additions and 274 deletions
@@ -21,4 +21,6 @@ public @interface WithMockLoginUser {
long deptId() default 0L;
boolean isSuperAdmin() default false;
long organId() default 0L;
}
@@ -2,6 +2,7 @@ package com.cf.imes.framework.security.test;
import cn.hutool.core.util.RandomUtil;
import com.cf.imes.framework.security.core.LoginUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
@@ -23,10 +24,13 @@ public class WithMockLoginUserSecurityContextFactory implements WithSecurityCont
LoginUser loginUser = new LoginUser();
long annotationUserId = annotation.userId();
long annotationOrganId = annotation.organId();
String username = annotation.username();
loginUser.setId(annotationUserId == 0L ? RandomUtil.randomLong() : annotationUserId);
loginUser.setNickname(RandomUtil.randomString(10));
loginUser.setNickname(StringUtils.isNotEmpty(username) ? username : RandomUtil.randomString(10));
loginUser.setDeptId(RandomUtil.randomLong());
loginUser.setOrganId(RandomUtil.randomLong());
loginUser.setOrganId(annotationOrganId == 0L ? RandomUtil.randomLong() : annotationOrganId);
loginUser.setIsSupAdmin(annotation.isSuperAdmin());
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(