业务线同步
This commit is contained in:
parent
0d7cdeddb0
commit
7f17c2a9b7
|
|
@ -3,6 +3,7 @@ package com.engine.salary.service.auth;
|
|||
import com.engine.salary.entity.auth.dto.AuthRoleDTO;
|
||||
import com.engine.salary.entity.auth.param.AuthRoleListQueryParam;
|
||||
import com.engine.salary.entity.auth.param.AuthRoleSaveParam;
|
||||
import com.engine.salary.entity.auth.po.AuthRolePO;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -34,4 +35,6 @@ public interface AuthRoleService {
|
|||
*/
|
||||
void deleteRole(List<Long> ids);
|
||||
|
||||
List<AuthRolePO> listAll();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,4 +237,9 @@ public class AuthRoleServiceImpl extends Service implements AuthRoleService {
|
|||
SalaryElogConfig.taxAgentLoggerTemplate.write(loggerContext);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AuthRolePO> listAll() {
|
||||
return getAuthRoleMapper().listAll();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.salary.timer;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.wrapper.AuthWrapper;
|
||||
import com.engine.salary.wrapper.TaxAgentWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
|
@ -22,6 +23,11 @@ public class SyncTaxAgentEmpJob extends BaseCronJob {
|
|||
return ServiceUtil.getService(TaxAgentWrapper.class, user);
|
||||
}
|
||||
|
||||
private AuthWrapper getAuthWrapper(User user) {
|
||||
return ServiceUtil.getService(AuthWrapper.class, user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
|
|
@ -37,7 +43,12 @@ public class SyncTaxAgentEmpJob extends BaseCronJob {
|
|||
*/
|
||||
private void start() {
|
||||
try {
|
||||
User user = new User();
|
||||
user.setUid(1);
|
||||
getTaxAgentWrapper(null).syncAllRange();
|
||||
|
||||
//同步业务线
|
||||
getAuthWrapper(user).sync();
|
||||
} catch (Exception e) {
|
||||
log.error("计划任务【SyncTaxAgentEmpJob】执行异常:" + e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,4 +187,16 @@ public class AuthController {
|
|||
return new ResponseResult<AuthTreeQueryParam, AuthTreeDTO>(user).run(getAuthWrapper(user)::tree,param);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步
|
||||
*/
|
||||
@POST
|
||||
@Path("/sync")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String sync(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<AuthSyncParam, String>(user).run(getAuthWrapper(user)::sync);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.engine.salary.entity.auth.dto.*;
|
|||
import com.engine.salary.entity.auth.param.*;
|
||||
import com.engine.salary.entity.auth.po.AuthDataPO;
|
||||
import com.engine.salary.entity.auth.po.AuthMemberPO;
|
||||
import com.engine.salary.entity.auth.po.AuthRolePO;
|
||||
import com.engine.salary.entity.auth.vo.Permission;
|
||||
import com.engine.salary.enums.auth.DataLinkEnum;
|
||||
import com.engine.salary.enums.auth.DataTargetTypeEnum;
|
||||
|
|
@ -158,4 +159,16 @@ public class AuthWrapper extends Service {
|
|||
public AuthTreeDTO tree(AuthTreeQueryParam param) {
|
||||
return getAuthService(user).tree(param);
|
||||
}
|
||||
|
||||
public String sync() {
|
||||
List<AuthRolePO> authRolePOS = getAuthRoleService(user).listAll();
|
||||
authRolePOS.forEach(po -> {
|
||||
AuthSyncParam param = AuthSyncParam.builder()
|
||||
.roleId(po.getId())
|
||||
.build();
|
||||
getAuthMemberService(user).sync(param);
|
||||
getAuthDataService(user).sync(param);
|
||||
});
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue