提交 3e4dde66 authored 作者: lgd's avatar lgd

1.我的权限

2.//TODO erp用户激活,忘记密码测试,产品下单还差附件,bat,mes,消息,我的,刷新token
上级 8ba6672f
......@@ -536,6 +536,15 @@
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.user.UserPermissionActivity"
android:configChanges="keyboardHidden|orientation"
android:label="我的权限"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.wd.workoffice.fileprovider"
......
package com.wd.workoffice.bean;
import java.util.List;
/**
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class PermissionBean {
/**
* createdBy : null
* createdByName : null
* createdTime : null
* updatedBy : null
* updatedByName : null
* updatedTime : null
* roles : [{"createdBy":1,"createdByName":null,"createdTime":"2019-08-27 14:17:33","updatedBy":111,"updatedByName":null,"updatedTime":"2019-11-22 10:39:44","id":3,"code":"SUPER_ADMIN","name":"超级管理员","level":0,"status":"1","dataScope":7,"customizeDataScope":"2,101,1","dataScopeName":"全系统","noticeIds":null,"createdUser":null}]
* deptPermissions : [{"createdBy":null,"createdByName":null,"createdTime":null,"updatedBy":null,"updatedByName":null,"updatedTime":null,"id":1,"code":"ES_BUY","name":"销售下单","processCode":"PROCESS_SALE"},{"createdBy":null,"createdByName":null,"createdTime":null,"updatedBy":null,"updatedByName":null,"updatedTime":null,"id":3,"code":"SUPPLY_BUY","name":"供应下单","processCode":"PROCESS_SUPPLY"},{"createdBy":null,"createdByName":null,"createdTime":null,"updatedBy":null,"updatedByName":null,"updatedTime":null,"id":5,"code":"INSIDE_BUY","name":"内部下单","processCode":"PROCESS_INSIDE"},{"createdBy":null,"createdByName":null,"createdTime":null,"updatedBy":null,"updatedByName":null,"updatedTime":null,"id":6,"code":"INSIDE_SELL","name":"内部接单","processCode":"PROCESS_INSIDE"},{"createdBy":null,"createdByName":null,"createdTime":null,"updatedBy":null,"updatedByName":null,"updatedTime":null,"id":7,"code":"CRUCIBLE_BUY","name":"坩埚下单","processCode":"PROCESS_CRUCIBLE"},{"createdBy":null,"createdByName":null,"createdTime":null,"updatedBy":null,"updatedByName":null,"updatedTime":null,"id":9,"code":"PURCHASE_BUY","name":"外采购下单","processCode":"PROCESS_PURCHASE"}]
* userAllDataScope : {"max_data_scope":7,"max_data_scope_name":"全集团"}
*/
private Object createdBy;
private Object createdByName;
private Object createdTime;
private Object updatedBy;
private Object updatedByName;
private Object updatedTime;
private UserAllDataScopeBean userAllDataScope;
private List<RolesBean> roles;
private List<DeptPermissionsBean> deptPermissions;
public Object getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Object createdBy) {
this.createdBy = createdBy;
}
public Object getCreatedByName() {
return createdByName;
}
public void setCreatedByName(Object createdByName) {
this.createdByName = createdByName;
}
public Object getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Object createdTime) {
this.createdTime = createdTime;
}
public Object getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(Object updatedBy) {
this.updatedBy = updatedBy;
}
public Object getUpdatedByName() {
return updatedByName;
}
public void setUpdatedByName(Object updatedByName) {
this.updatedByName = updatedByName;
}
public Object getUpdatedTime() {
return updatedTime;
}
public void setUpdatedTime(Object updatedTime) {
this.updatedTime = updatedTime;
}
public UserAllDataScopeBean getUserAllDataScope() {
return userAllDataScope;
}
public void setUserAllDataScope(UserAllDataScopeBean userAllDataScope) {
this.userAllDataScope = userAllDataScope;
}
public List<RolesBean> getRoles() {
return roles;
}
public void setRoles(List<RolesBean> roles) {
this.roles = roles;
}
public List<DeptPermissionsBean> getDeptPermissions() {
return deptPermissions;
}
public void setDeptPermissions(List<DeptPermissionsBean> deptPermissions) {
this.deptPermissions = deptPermissions;
}
public static class UserAllDataScopeBean {
/**
* max_data_scope : 7
* max_data_scope_name : 全集团
*/
private int max_data_scope;
private String max_data_scope_name;
public int getMax_data_scope() {
return max_data_scope;
}
public void setMax_data_scope(int max_data_scope) {
this.max_data_scope = max_data_scope;
}
public String getMax_data_scope_name() {
return max_data_scope_name;
}
public void setMax_data_scope_name(String max_data_scope_name) {
this.max_data_scope_name = max_data_scope_name;
}
}
public static class RolesBean {
/**
* createdBy : 1
* createdByName : null
* createdTime : 2019-08-27 14:17:33
* updatedBy : 111
* updatedByName : null
* updatedTime : 2019-11-22 10:39:44
* id : 3
* code : SUPER_ADMIN
* name : 超级管理员
* level : 0
* status : 1
* dataScope : 7
* customizeDataScope : 2,101,1
* dataScopeName : 全系统
* noticeIds : null
* createdUser : null
*/
private int createdBy;
private Object createdByName;
private String createdTime;
private int updatedBy;
private Object updatedByName;
private String updatedTime;
private int id;
private String code;
private String name;
private int level;
private String status;
private int dataScope;
private String customizeDataScope;
private String dataScopeName;
private Object noticeIds;
private Object createdUser;
public int getCreatedBy() {
return createdBy;
}
public void setCreatedBy(int createdBy) {
this.createdBy = createdBy;
}
public Object getCreatedByName() {
return createdByName;
}
public void setCreatedByName(Object createdByName) {
this.createdByName = createdByName;
}
public String getCreatedTime() {
return createdTime;
}
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
public int getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(int updatedBy) {
this.updatedBy = updatedBy;
}
public Object getUpdatedByName() {
return updatedByName;
}
public void setUpdatedByName(Object updatedByName) {
this.updatedByName = updatedByName;
}
public String getUpdatedTime() {
return updatedTime;
}
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public int getDataScope() {
return dataScope;
}
public void setDataScope(int dataScope) {
this.dataScope = dataScope;
}
public String getCustomizeDataScope() {
return customizeDataScope;
}
public void setCustomizeDataScope(String customizeDataScope) {
this.customizeDataScope = customizeDataScope;
}
public String getDataScopeName() {
return dataScopeName;
}
public void setDataScopeName(String dataScopeName) {
this.dataScopeName = dataScopeName;
}
public Object getNoticeIds() {
return noticeIds;
}
public void setNoticeIds(Object noticeIds) {
this.noticeIds = noticeIds;
}
public Object getCreatedUser() {
return createdUser;
}
public void setCreatedUser(Object createdUser) {
this.createdUser = createdUser;
}
}
public static class DeptPermissionsBean {
/**
* createdBy : null
* createdByName : null
* createdTime : null
* updatedBy : null
* updatedByName : null
* updatedTime : null
* id : 1
* code : ES_BUY
* name : 销售下单
* processCode : PROCESS_SALE
*/
private Object createdBy;
private Object createdByName;
private Object createdTime;
private Object updatedBy;
private Object updatedByName;
private Object updatedTime;
private int id;
private String code;
private String name;
private String processCode;
public Object getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Object createdBy) {
this.createdBy = createdBy;
}
public Object getCreatedByName() {
return createdByName;
}
public void setCreatedByName(Object createdByName) {
this.createdByName = createdByName;
}
public Object getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Object createdTime) {
this.createdTime = createdTime;
}
public Object getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(Object updatedBy) {
this.updatedBy = updatedBy;
}
public Object getUpdatedByName() {
return updatedByName;
}
public void setUpdatedByName(Object updatedByName) {
this.updatedByName = updatedByName;
}
public Object getUpdatedTime() {
return updatedTime;
}
public void setUpdatedTime(Object updatedTime) {
this.updatedTime = updatedTime;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getProcessCode() {
return processCode;
}
public void setProcessCode(String processCode) {
this.processCode = processCode;
}
}
}
......@@ -483,7 +483,15 @@ public interface ApiService {
*
* @return
*/
@GET(" /stockQuantity/app/oneOfOrder/{orderId}")
@GET("/stockQuantity/app/oneOfOrder/{orderId}")
Observable<BaseBean> stockDetailFlow(@Path("orderId")String id , @Path("orderType")String orderType);
/**
* 获取当前用户的角色,数据、部门权限列表
*
* @return
*/
@GET("/privilege/detail")
Observable<BaseBean> permissionDetail();
}
package com.wd.workoffice.ui.activity.user;
import android.os.Bundle;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.ContactsBean;
import com.wd.workoffice.bean.PermissionBean;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import flexible.xd.android_base.network.rtfhttp.Transformer;
import io.reactivex.disposables.Disposable;
/**
* 我的 - 权限
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class UserPermissionActivity extends WorkToolBarActivity {
@BindView(R.id.tv_role)
TextView tvRole;
@BindView(R.id.tv_data)
TextView tvData;
@BindView(R.id.tv_dep)
TextView tvDep;
private PermissionBean dataBean;
@Override
protected void initView() {
ButterKnife.bind(this);
}
@Override
protected void initData() {
getData();
}
private void getData() {
RtfUtils.getRtf().permissionDetail().compose(Transformer.schedule()).subscribe(new WorkObserver<BaseBean>() {
@Override
public void doOnSubscribe(Disposable d) {
}
@Override
public void onFail(String errorMsg) {
hideLoading();
toast(errorMsg);
}
@Override
public void onSuccess(BaseBean data) {
hideLoading();
if (data.getCode() != 0) {
toast(data.getMessage());
return;
}
dataBean = JSON.parseObject(data.getData().toString(), PermissionBean.class);
tvRole.setText(getRoleString(dataBean.getRoles()));
tvData.setText(dataBean.getUserAllDataScope().getMax_data_scope_name());
tvDep.setText(getDepString(dataBean.getDeptPermissions()));
}
});
}
protected String getDepString(List<PermissionBean.DeptPermissionsBean> data) {
String returnData = "";
if (data != null && data.size() != 0) {
for (PermissionBean.DeptPermissionsBean process : data) {
returnData = returnData + process.getName() + ",";
}
returnData = returnData.substring(0, returnData.length() - 1);
} else {
returnData = "无";
}
return returnData;
}
protected String getRoleString(List<PermissionBean.RolesBean> data) {
String returnData = "";
if (data != null && data.size() != 0) {
for (PermissionBean.RolesBean process : data) {
returnData = returnData + process.getName() + ",";
}
returnData = returnData.substring(0, returnData.length() - 1);
} else {
returnData = "无";
}
return returnData;
}
@Override
protected void initEvent() {
}
@Override
protected int layoutId() {
return R.layout.activity_user_permission;
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10mm"
android:background="@color/white"
android:orientation="vertical"
android:paddingHorizontal="20mm"
android:paddingVertical="15mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="角色"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_role"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5mm"
android:text="权限:无"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10mm"
android:background="@color/white"
android:orientation="vertical"
android:paddingHorizontal="20mm"
android:paddingVertical="15mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="数据权限"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5mm"
android:text="权限:无"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10mm"
android:background="@color/white"
android:orientation="vertical"
android:paddingHorizontal="20mm"
android:paddingVertical="15mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="部门权限"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_dep"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5mm"
android:text="权限:无"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论