1、修复审批人 创建人bug
2、容器内时间和宿主机器一致-v /etc/localtime:/etc/localtime 3、loginserver解决
This commit is contained in:
@@ -37,10 +37,11 @@ public class DynamicRuleController implements DynamicRuleControllerApi {
|
||||
HttpSession session = request.getSession();
|
||||
UserFull user = (UserFull) session.getAttribute("user");
|
||||
if (user != null) {
|
||||
dynamicRuleObject.setAuditUserName(user.name);
|
||||
dynamicRuleObject.setAuditUserId(user.uid);
|
||||
dynamicRuleObject.setAuditUserDepart(user.getOrgName());
|
||||
dynamicRuleObject.setDynamicRuleCreateUsername(user.name);
|
||||
dynamicRuleObject.setDynamicRuleCreateUserId(Integer.valueOf(user.uid));
|
||||
dynamicRuleObject.setDynamicRuleCreateDepart(user.getOrgName());
|
||||
}
|
||||
|
||||
//调用service新增
|
||||
Integer dynamicRuleObjectId = dynamicRuleService.newDynamicRuleObject(dynamicRuleObject);
|
||||
return ResponseResult.ok().
|
||||
|
||||
@@ -66,7 +66,7 @@ public class StaticRuleService {
|
||||
@Transactional
|
||||
public Integer newStaticRuleObject(StaticRuleObject object) {
|
||||
|
||||
object.setStaticRuleCreateTime(LocalDateTime.now());
|
||||
// object.setStaticRuleCreateTime(LocalDateTime.now());
|
||||
object.setAuditStatus(0);
|
||||
|
||||
if (!isIpMaskValid(object.getStaticRuleSip(),object.getStaticRuleMsip()) ||
|
||||
|
||||
@@ -51,7 +51,8 @@ public class LoginService {
|
||||
String accessToken = "";
|
||||
// 获取 ACCESS_TOKEN
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
// OkHttpClient client = new OkHttpClient();
|
||||
|
||||
// OkHttpClient client = new OkHttpClient();
|
||||
|
||||
//不做证书验证的OkHttpClient
|
||||
OkHttpClient client = new OkHttpClient.Builder()
|
||||
@@ -61,14 +62,17 @@ public class LoginService {
|
||||
|
||||
Request request = new Request.Builder()
|
||||
// .url("https://114.243.134.122:10217/passport/accessToken?grant_type=client_credentials")
|
||||
.url("https://passport.iam.pub/passport/accessToken?grant_type=client_credentials")
|
||||
// .url("https://passport.iam.pub/passport/accessToken?grant_type=client_credentials")
|
||||
.url("http://10.60.15.14:8080/passport/accessToken?grant_type=client_credentials")
|
||||
// .header("Authorization", "Basic TlNBRERAWlguT1JHOk14a1hHZ1ltOUNROUE3TCRSOCNLRW02R1pSeEhwd1c2")
|
||||
.header("Authorization", "Basic TlNBREQ6bkhRbE5zN3lLeVd5bzJOc2JmNk5oRmFhYmlWWUlBU1NsdWJRZ3pUaDhOU2xOUkE1V2xQUTF3PT0=")
|
||||
// .header("Authorization", "Basic TlNBREQ6bkhRbE5zN3lLeVd5bzJOc2JmNk5oRmFhYmlWWUlBU1NsdWJRZ3pUaDhOU2xOUkE1V2xQUTF3PT0=")
|
||||
.header("Authorization", "Basic TlNBRERAWlguT1JHOm5IUWxOczd5S3lXeW8yTnNiZjZOaEZhYWJpVllJQVNTbHViUWd6VGg4TlNsTlJBNVdsUFExdz09")
|
||||
.post(okhttp3.internal.Util.EMPTY_REQUEST)
|
||||
.build();
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
String rsp = response.body().string();
|
||||
System.out.println("rsp:" + rsp);
|
||||
try {
|
||||
AccessTokenResponse atr = objectMapper.readValue(rsp, AccessTokenResponse.class);
|
||||
accessToken = atr.getAccess_token();
|
||||
@@ -87,8 +91,9 @@ public class LoginService {
|
||||
.addFormDataPart("sessionData", sessionData).build();
|
||||
request = new Request.Builder()
|
||||
// .url("https://passport.zx.com:10217/passport/accessApplication")
|
||||
.url("https://114.243.134.122:10217/passport/accessApplication")
|
||||
// .url("https://114.243.134.122:10217/passport/accessApplication")
|
||||
// .url("https://passport.iam.pub/passport/accessApplication")
|
||||
.url("http://10.60.15.14:8080/passport/accessApplication")
|
||||
.header("Authorization", "Bearer " + accessToken)
|
||||
.header("Content-Type", "application/x-www-form-urlencoded")
|
||||
.post(body)
|
||||
|
||||
@@ -39,7 +39,7 @@ public class WhiteListController implements WhiteListControllerApi {
|
||||
UserFull user = (UserFull) session.getAttribute("user");
|
||||
if (user != null) {
|
||||
object.setCreateUserName(user.name);
|
||||
object.setAuditUserId(user.uid);
|
||||
object.setCreateUserId(user.uid);
|
||||
object.setCreateUserDepartment(user.getOrgName());
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ public class WhiteListController implements WhiteListControllerApi {
|
||||
@PathVariable Integer auditStatus,
|
||||
@Autowired HttpServletRequest request) {
|
||||
if (id <= 0 || auditStatus < 0 || auditStatus > 2) {
|
||||
return new ResponseResult(400, "id or status is invalid")
|
||||
return new ResponseResult(400, "id或状态无效")
|
||||
.setData("whiteobj_id", id)
|
||||
.setData("success", false);
|
||||
}
|
||||
|
||||
@@ -143,10 +143,10 @@
|
||||
|
||||
<result column="protect_object_create_username" property="protectObjectCreateUsername"/>
|
||||
<result column="protect_object_create_user_id" property="protectObjectCreateUserId"/>
|
||||
<result column="protect_object_create_user_depart" property="protectObjectCreateDepart"/>
|
||||
<result column="protect_object_create_depart" property="protectObjectCreateDepart"/>
|
||||
<result column="audit_user_name" property="auditUserName"/>
|
||||
<result column="audit_user_id" property="auditUserId"/>
|
||||
<result column="audit_user_depart" property="auditUserDepart"/>
|
||||
<result column="audit_user_deaprt" property="auditUserDepart"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="modify_time" property="modifyTime"/>
|
||||
|
||||
@@ -157,10 +157,9 @@
|
||||
|
||||
<select id="queryProtectObjects" resultMap="protectObjectMap">
|
||||
SELECT
|
||||
protect_object_id, protect_object_name, protect_object_system_name,
|
||||
INET_NTOA(protect_object_ip) as protect_object_ip,
|
||||
protect_object_port, protect_object_url, protect_object_protocol, protect_object_audit_status
|
||||
,protect_object_display_id
|
||||
*,
|
||||
INET_NTOA(protect_object_ip) as protect_object_ip
|
||||
|
||||
FROM t_protect_object
|
||||
<where>
|
||||
<if test="proobj_name != null and proobj_name != '' ">AND protect_object_name LIKE CONCAT('%', #{proobj_name}, '%')</if>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
static_rule_url, static_rule_priority,
|
||||
static_rule_frequency, static_rule_audit_status,
|
||||
static_rule_display_id,event_type,static_rule_modify_time)
|
||||
values (#{object.staticRuleName}, #{object.staticRuleCreateTime}, #{object.staticRuleCreateUsername},
|
||||
values (#{object.staticRuleName}, NOW(), #{object.staticRuleCreateUsername},
|
||||
#{object.staticRuleCreateDepart}, #{object.staticRuleCreateUserId}, INET_ATON(#{object.staticRuleSip}),
|
||||
INET_ATON(#{object.staticRuleMsip}), #{object.staticRuleSport}, #{object.staticRuleMsport},
|
||||
INET_ATON(#{object.staticRuleDip}), INET_ATON(#{object.staticRuleMdip}), #{object.staticRuleDport},
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
audit_user_name,
|
||||
audit_user_id,
|
||||
audit_user_depart
|
||||
)
|
||||
|
||||
from t_strategy_template_new
|
||||
where strategy_template_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
|
||||
@@ -165,16 +165,19 @@ class ProtectObjectServiceTest extends ProtectionApplicationTests {
|
||||
|
||||
@Test
|
||||
void changeProtectObjectAuditStatus() {
|
||||
int testNum = 0;
|
||||
for (int i = 300; i < 100000; i++) {
|
||||
if (protectObjectService.queryProtectObject(i) != null) {
|
||||
testNum = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue((Boolean) protectObjectService.changeProtectObjectAuditStatus(testNum, 1).get("success"));
|
||||
int finalTestNum = testNum;
|
||||
assertThrows(IllegalArgumentException.class, () -> protectObjectService.changeProtectObjectAuditStatus(finalTestNum, 2));
|
||||
// int testNum = 0;
|
||||
// for (int i = 300; i < 100000; i++) {
|
||||
// if (protectObjectService.queryProtectObject(i) != null) {
|
||||
// testNum = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// assertTrue((Boolean) protectObjectService.changeProtectObjectAuditStatus(testNum, 1).get("success"));
|
||||
// int finalTestNum = testNum;
|
||||
// assertThrows(IllegalArgumentException.class, () -> protectObjectService.changeProtectObjectAuditStatus(finalTestNum, 2));
|
||||
|
||||
assertTrue((Boolean) protectObjectService.changeProtectObjectAuditStatus(70330, 1,"sss",111,"ssssss").get("success"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -78,6 +78,6 @@ public class NewTemplateServiceTest {
|
||||
List<TemplateNew> templates = templateService.queryTemplates(
|
||||
null, null, null, null, null,null, null,1,3);
|
||||
TemplateNew testTemplate = templates.get(0);
|
||||
templateService.updateAuditStatus(testTemplate.getTemplateId(), 2, null,null,null);
|
||||
templateService.updateAuditStatus(testTemplate.getTemplateId(), 2, "sss",1111,"depart");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class DynamicRuleServiceTest extends ProtectionApplicationTests {
|
||||
// null,null, 1, 1);
|
||||
// List<Template> templates = templateService.queryTemplates(
|
||||
// null, null, null, null, null,1, 1);
|
||||
for (int i = 0;i<30; i++) {
|
||||
for (int i = 0;i<2; i++) {
|
||||
DynamicRuleObject object = new DynamicRuleObject();
|
||||
object.setDynamicRuleName("动态规则"+i);
|
||||
object.setDescription("动态规则新建测试");
|
||||
|
||||
@@ -48,7 +48,7 @@ class WhiteListServiceTest extends ProtectionApplicationTests {
|
||||
WhiteListObject object = new WhiteListObject();
|
||||
object.setWhiteListName("test");
|
||||
object.setWhiteListSystemName("china");
|
||||
object.setWhiteListIP("1.1.1.1");
|
||||
object.setWhiteListIP("1.1.9.1");
|
||||
object.setWhiteListPort(80);
|
||||
object.setWhiteListUrl("www.baidu.com");
|
||||
object.setWhiteListProtocol("TCP");
|
||||
@@ -86,7 +86,7 @@ class WhiteListServiceTest extends ProtectionApplicationTests {
|
||||
|
||||
@Test
|
||||
void testUpdateWhiteListAuditStatus() {
|
||||
whiteListService.updateWhiteListObjectAuditStatus(7222, 2, "mh", 1, "mmeess");
|
||||
whiteListService.updateWhiteListObjectAuditStatus(7229, 2, "mh2222", 1, "mmee ess");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user