Merge remote-tracking branch 'origin/develop' into develop

master
yuan 7 years ago
commit 2b377006cb

@ -24,6 +24,7 @@ public class SendWechatMessage {
private boolean bdleader; private boolean bdleader;
private boolean riskmanager; private boolean riskmanager;
private boolean guest; private boolean guest;
private boolean orgmanager;
public JSONObject insertObject() { public JSONObject insertObject() {
JSONObject res = (JSONObject) JSON.toJSON(this); JSONObject res = (JSONObject) JSON.toJSON(this);
@ -157,4 +158,12 @@ public class SendWechatMessage {
public void setGuest(boolean guest) { public void setGuest(boolean guest) {
this.guest = guest; this.guest = guest;
} }
public boolean isOrgmanager() {
return orgmanager;
}
public void setOrgmanager(boolean orgmanager) {
this.orgmanager = orgmanager;
}
} }

@ -117,6 +117,9 @@ public class WechatMessageServiceImpl implements WechatMessageService {
if(sendWechatMessage.isDirector()){ if(sendWechatMessage.isDirector()){
set = getOpenIdSet(set, ManagerRole.DIRECTOR.getMask()); set = getOpenIdSet(set, ManagerRole.DIRECTOR.getMask());
} }
if(sendWechatMessage.isOrgmanager()){
set = getOpenIdSet(set, ManagerRole.ORG_MANAGER.getMask());
}
for(String open_id : set){ for(String open_id : set){
object.put("open_id",open_id); object.put("open_id",open_id);
sendWecharMessageByOpenId(object); sendWecharMessageByOpenId(object);

@ -37,6 +37,7 @@ public class ManagerInfo {
private boolean bdleader; private boolean bdleader;
private boolean riskmanager; private boolean riskmanager;
private boolean guest; private boolean guest;
private boolean orgmanager;
@JSONField(name = "org_id") @JSONField(name = "org_id")
private Integer orgId; private Integer orgId;
@ -101,6 +102,9 @@ public class ManagerInfo {
if (guest){ if (guest){
role |= ManagerRole.GUEST.getMask(); role |= ManagerRole.GUEST.getMask();
} }
if (orgmanager){
role |= ManagerRole.ORG_MANAGER.getMask();
}
account.put("role", role); account.put("role", role);
if (insert) { if (insert) {
account.put("username", getUsername()); account.put("username", getUsername());
@ -260,4 +264,12 @@ public class ManagerInfo {
public void setGuest(boolean guest) { public void setGuest(boolean guest) {
this.guest = guest; this.guest = guest;
} }
public boolean isOrgmanager() {
return orgmanager;
}
public void setOrgmanager(boolean orgmanager) {
this.orgmanager = orgmanager;
}
} }

@ -51,6 +51,7 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
manager.put("bdleader", ManagerRole.BD_LEADER.hasRole(role)); manager.put("bdleader", ManagerRole.BD_LEADER.hasRole(role));
manager.put("riskmanager", ManagerRole.RISK_MANAGER.hasRole(role)); manager.put("riskmanager", ManagerRole.RISK_MANAGER.hasRole(role));
manager.put("guest", ManagerRole.GUEST.hasRole(role)); manager.put("guest", ManagerRole.GUEST.hasRole(role));
manager.put("orgmanager", ManagerRole.ORG_MANAGER.hasRole(role));
} }
return managers; return managers;
} }

@ -32,7 +32,10 @@ import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine; import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* account service for sign in * account service for sign in
@ -64,14 +67,11 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
@Cacheable(value = ":login:managers:", key = "''+#accountId") @Cacheable(value = ":login:managers:", key = "''+#accountId")
public JSONObject getManager(String accountId) { public JSONObject getManager(String accountId) {
JSONObject manager = managerMapper.findById(accountId); JSONObject manager = managerMapper.findById(accountId);
JSONObject org = null;
if (manager == null) { if (manager == null) {
throw new ForbiddenException("用户不存在或已禁用"); throw new ForbiddenException("用户不存在或已禁用");
} }
if (manager.getInteger("org_id") != null) { if (manager.getInteger("org_id") != null) {
org = orgMapper.findOne(manager.getIntValue("org_id")); manager.put("org", orgMapper.findOne(manager.getIntValue("org_id")));
manager.put("org", org);
manager.put("parent_org_id",org.getIntValue("parent_org_id"));
} }
List<JSONObject> funcs = permissionManager.listUserFunctions(manager.getIntValue("role")); List<JSONObject> funcs = permissionManager.listUserFunctions(manager.getIntValue("role"));
List<String> funcIds = new ArrayList<>(); List<String> funcIds = new ArrayList<>();
@ -90,36 +90,12 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
modules.put(module, mod); modules.put(module, mod);
} }
} }
if(org != null && org.getIntValue("type")==0 && org.getString("parent_org_id") != null){
if(modules.containsKey("org")){
deleteOrgModule(modules,"org");
}
if(modules.containsKey("manager_accounts")){
deleteOrgModule(modules,"manager_accounts");
}
}
if(org != null && org.getIntValue("type")==0 && org.getString("parent_org_id") == null){
if(modules.containsKey("manager_accounts")){
deleteOrgModule(modules,"manager_accounts");
}
}
manager.put("available_func_ids", funcIds); manager.put("available_func_ids", funcIds);
manager.put("available_func_names", funcNames); manager.put("available_func_names", funcNames);
manager.put("modules", modules.values()); manager.put("modules", modules.values());
manager.put("module_names", modules.keySet()); manager.put("module_names", modules.keySet());
return manager; return manager;
} }
private void deleteOrgModule(Map<String, JSONObject> modules,String module){
Iterator iterator = modules.keySet().iterator();
while (iterator.hasNext()) {
String key = (String) iterator.next();
if (module.equals(key)) {
iterator.remove();
modules.remove(key);
}
}
}
@Override @Override
@Cacheable(value = ":login:clients:", key = "''+#accountId") @Cacheable(value = ":login:clients:", key = "''+#accountId")

@ -83,6 +83,9 @@
<div class="checkbox-inline"> <div class="checkbox-inline">
<label><input type="checkbox" ng-model="params.guest" name="params.guest">GUEST:观察员</label> <label><input type="checkbox" ng-model="params.guest" name="params.guest">GUEST:观察员</label>
</div> </div>
<div class="checkbox-inline">
<label><input type="checkbox" ng-model="params.orgmanager" name="params.orgmanager">ORG_MANAGER:代理商管理</label>
</div>
<div class="form-group"> <div class="form-group">
<label>Title</label> <label>Title</label>
<input ng-model="params.r_title" class="form-control" type="text" required/> <input ng-model="params.r_title" class="form-control" type="text" required/>

@ -95,6 +95,7 @@
<i class="fa fa-male" title="BD Leader" ng-class="{'text-green':manager.bdleader,'text-gray':!manager.bdleader}"></i> <i class="fa fa-male" title="BD Leader" ng-class="{'text-green':manager.bdleader,'text-gray':!manager.bdleader}"></i>
<i class="fa fa-user" title="Risk Manager" ng-class="{'text-green':manager.riskmanager,'text-gray':!manager.riskmanager}"></i> <i class="fa fa-user" title="Risk Manager" ng-class="{'text-green':manager.riskmanager,'text-gray':!manager.riskmanager}"></i>
<i class="fa fa-tripadvisor" title="GUEST" ng-class="{'text-green':manager.guest,'text-gray':!manager.guest}"></i> <i class="fa fa-tripadvisor" title="GUEST" ng-class="{'text-green':manager.guest,'text-gray':!manager.guest}"></i>
<i class="fa fa-user-plus" title="Org Manager" ng-class="{'text-green':manager.orgmanager,'text-gray':!manager.orgmanager}"></i>
</td> </td>
<td> <td>
<a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a> <a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a>

@ -81,6 +81,9 @@
<label ng-if="('00001'|withRole)"> <label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.riskmanager" name="riskmanager">Risk Manager <input type="checkbox" ng-model="manager.riskmanager" name="riskmanager">Risk Manager
</label> </label>
<label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.orgmanager" name="orgmanager">Org Manager
</label>
</p> </p>
</div> </div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && !manager.sitemanager && orgs!=null"> <div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && !manager.sitemanager && orgs!=null">

@ -90,6 +90,9 @@
<label ng-if="('00001'|withRole)"> <label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.guest" name="guest">Guest <input type="checkbox" ng-model="manager.guest" name="guest">Guest
</label> </label>
<label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.orgmanager" name="guest">Org Manager
</label>
</p> </p>
</div> </div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && orgs != null"> <div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && orgs != null">

Loading…
Cancel
Save