You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
2.1 KiB
54 lines
2.1 KiB
3 years ago
|
/*
|
||
|
* Copyright (C), 2018-2021
|
||
|
* Project: starter
|
||
|
* FileName: PositionServiceKit
|
||
|
* Author: Louis
|
||
|
* Date: 2021/8/18 15:38
|
||
|
*/
|
||
|
package com.fr.plugin.hdmu.kit;
|
||
|
|
||
|
import com.fr.decision.authority.AuthorityContext;
|
||
|
import com.fr.decision.authority.base.constant.SoftRoleType;
|
||
|
import com.fr.decision.authority.base.constant.type.operation.ManualOperationType;
|
||
|
import com.fr.decision.authority.data.Post;
|
||
|
import com.fr.decision.record.OperateMessage;
|
||
|
import com.fr.decision.webservice.v10.user.PositionService;
|
||
|
import com.fr.intelli.record.MetricRegistry;
|
||
|
import com.fr.stable.query.QueryFactory;
|
||
|
import com.fr.stable.query.condition.QueryCondition;
|
||
|
import com.fr.stable.query.restriction.Restriction;
|
||
|
import com.fr.stable.query.restriction.RestrictionFactory;
|
||
|
|
||
|
/**
|
||
|
* <Function Description><br>
|
||
|
* <PositionServiceKit>
|
||
|
*
|
||
|
* @author fr.open
|
||
|
* @since 1.0.0
|
||
|
*/
|
||
|
public class PositionServiceKit extends PositionService {
|
||
|
private static volatile PositionServiceKit positionServiceKit = null;
|
||
|
|
||
|
public PositionServiceKit() {
|
||
|
}
|
||
|
|
||
|
public static PositionServiceKit getInstance() {
|
||
|
if (positionServiceKit == null) {
|
||
|
positionServiceKit = new PositionServiceKit();
|
||
|
}
|
||
|
return positionServiceKit;
|
||
|
}
|
||
|
|
||
|
public String addPosition(String id, String name, String desc) throws Exception {
|
||
|
Post post = (new Post()).id(id).name(name).creationType(ManualOperationType.KEY).lastOperationType(ManualOperationType.KEY).enable(true).description(desc);
|
||
|
AuthorityContext.getInstance().getPostController().add(post);
|
||
|
this.deleteSoftData(post.getName());
|
||
|
MetricRegistry.getMetric().submit(OperateMessage.build("Dec-Module-User_Manager", "Dec-Post", name, "Dec-Log_Add"));
|
||
|
return post.getId();
|
||
|
}
|
||
|
|
||
|
private void deleteSoftData(String var1) throws Exception {
|
||
|
QueryCondition var2 = QueryFactory.create().addRestriction(RestrictionFactory.and(new Restriction[]{RestrictionFactory.eq("deletedName", var1), RestrictionFactory.eq("type", SoftRoleType.POST)}));
|
||
|
AuthorityContext.getInstance().getSoftDataController().remove(var2);
|
||
|
}
|
||
|
}
|