我是Java编码的新手,我有某些代码,这些代码在详细信息之下重复



服务类详细信息

public ViewRoleInfo viewRoles(String roleDescription,Authentication authentication) {
    logger.info(Utility.ENTERED + new Object() {}.getClass().getEnclosingMethod().getName());
    viewRoleInfo = new ArrayList<>();
    veiwRoleDetials = new ViewRoleInfo();
    viewAllServices = new ArrayList<>();
    viewAllRoles = new ArrayList<>();

    List<Jmrrole> jmrrole = roleRepo.findViewRoles(roleDescription);

            jmrrole.stream().forEach(viewRoles ->{
            viewAllServices.add(new ViewAllTransactions(viewRoles.getJmrtransactionm().getDescrption(),viewRoles.getAllowAuthorization(),viewRoles.getAllowInitiation(),viewRoles.getAllowView()));
            viewAllRoles.add(new ViewAllRoles( viewRoles.getJmrservicem().getDescription(),viewAllServices));
            viewRoleInfo.add(new ViewRoleInfo( viewRoles.getDescription(),viewRoles.getJmrdevicem().getNamdevice(),viewRoles.getCreatedby(),viewRoles.getDatcreated(),viewAllRoles));
            System.out.println(viewRoles.getDescription()+viewRoles.getJmrdevicem().getNamdevice()+viewRoles.getCreatedby()+viewRoles.getDatcreated()+viewAllRoles);
            veiwRoleDetials.setRoleDescription(viewRoles.getDescription());
            veiwRoleDetials.setChannel(viewRoles.getJmrdevicem().getNamdevice());
            veiwRoleDetials.setCreatedBy(viewRoles.getCreatedby());
            veiwRoleDetials.setCreatedOn(viewRoles.getDatcreated());

        });
        veiwRoleDetials.setViewAllRoles(viewAllRoles);
        return veiwRoleDetials;

}}

以下是执行时正在启动的JSON输出

http://path/path1/MCXcorpRole11
{
"errorStatus": false,
"errorMsgs": [],
"roleDescription": "MCXcorpRole11",
"channel": "Mobile Browser",
"createdBy": "superadmin",
"createdOn": "2017-04-17",
"viewAllRoles": [
{
"seriveName": "Transfer ",
"viewAllTransactions": [
{
"transactionName": "Own Accoount Transfer",
"allowAuthorization": "N",
"allowInitiation": "Y",
"allowView": "Y"
},
{
"transactionName": "Vendor Payments",
"allowAuthorization": "N",
"allowInitiation": "Y",
"allowView": "Y"
},
{
"transactionName": "Bulk Registration",
"allowAuthorization": "N",
"allowInitiation": "Y",
"allowView": "Y"
},
{
"transactionName": "Mobile payment",
"allowAuthorization": "Y",
"allowInitiation": "N",
"allowView": "N"
}
]
}    

但是在DB中,我们的映射如下所示

"seriveName": "Transfer "
is only mapped with 
"transactionName": "Own Accoount Transfer"

所以我期望像这样的输出

"roleDescription": "MCXcorpRole11",
"channel": "Mobile Browser",
"createdBy": "superadmin",
"createdOn": "2017-04-17",
"viewAllRoles": [
{
"seriveName": "Transfer ",
"viewAllTransactions": [
{
"transactionName": "Own Accoount Transfer",
"allowAuthorization": "N",
"allowInitiation": "Y",
"allowView": "Y"
}]

有人可以在这里弄清楚我在哪里错误的地方,谢谢

我看不到您将ViewAllServices或将ViewAllServices连接到ViewRoledetails。

相关内容

最新更新