master
kira 6 years ago
parent 1a73f48808
commit dab1dbf73e

@ -59,9 +59,15 @@ public class OpenimController {
}
@ManagerMapping(value = "/servant/{manager_id}/onoff", method = RequestMethod.PUT,role = {ManagerRole.ADMIN})
public void listServants(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager,@PathVariable String manager_id, @RequestBody JSONObject param) {
public void onoff(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager,@PathVariable String manager_id, @RequestBody JSONObject param) {
param.put("manager_id",manager_id);
customerServiceService.onoff(param);
}
@ManagerMapping(value = "/servant/{manager_id}/nick", method = RequestMethod.PUT,role = {ManagerRole.ADMIN})
public void changeNick(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager,@PathVariable String manager_id, @RequestBody JSONObject param) {
param.put("manager_id",manager_id);
customerServiceService.changeNick(param);
}
}

@ -22,6 +22,8 @@ public interface CustomerServiceService {
void onoff(JSONObject param);
void changeNick(JSONObject param);
void addUnreadMsg(JSONObject params);
void sendUnreadWxMsg();

@ -71,6 +71,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
checkRecord.put("nick", userInfo.getString("username") + "_" + client.getString("client_moniker"));
checkRecord.put("user_id", userInfo.getString("username"));
checkRecord.put("password", DigestUtils.md5Hex("uid"));
checkRecord.put("icon_url",client.getString("logo_thumbnail"));
openimApi.addUser(checkRecord);
checkRecord.put("servants", sysCustomerServiceMapper.findOnline());
checkRecord.put("appkey", appkey);
@ -152,10 +153,12 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
@Override
public void onoff(JSONObject manager) {
JSONObject record = new JSONObject();
record.put("manager_id", manager.getString("manager_id"));
record.put("onoff", manager.getBoolean("onoff"));
saveOrUpdate(record,false);
saveOrUpdate(manager,false);
}
@Override
public void changeNick(JSONObject param) {
saveOrUpdate(param,true);
}
@Override

@ -6,6 +6,7 @@ import au.com.royalpay.payment.manage.openim.core.OpenimClient;
import com.alibaba.fastjson.JSONObject;
import com.taobao.api.domain.Userinfos;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -34,6 +35,9 @@ public class OpenimApiImpl implements OpenimApi {
record.setUserid(user.getString("user_id"));
record.setNick(user.getString("nick"));
record.setPassword(user.getString("password"));
if(StringUtils.isNotEmpty(user.getString("icon_url"))){
record.setIconUrl(user.getString("icon_url"));
}
saveList.add(record);
openimClient.addUser(saveList);
}

@ -7,6 +7,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.mappers.system.SysCustomerServiceMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService;
@ -22,6 +23,7 @@ import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PasswordUtils;
import com.alibaba.fastjson.JSONObject;
@ -74,6 +76,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
@Resource
private ClientConfigService clientConfigService;
@Resource
private SysCustomerServiceMapper sysCustomerServiceMapper;
@Resource
private PermissionClientModulesService permissionClientModulesService;
private ApplicationEventPublisher publisher;
private static final List<String> tags = new ArrayList<>();
@ -114,6 +118,10 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
manager.put("available_func_names", funcNames);
manager.put("modules", modules.values());
manager.put("module_names", modules.keySet());
if((manager.getIntValue("role")& ManagerRole.SERVANT.getMask())>0){
JSONObject cs = sysCustomerServiceMapper.findByManagerId(accountId);
manager.put("onoff",cs.getBoolean("onoff"));
}
return manager;
}
@ -429,5 +437,4 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
account.put("is_password_expired", 0);
clientAccountMapper.update(account);
}
}

@ -97,7 +97,7 @@
<select id="listServants" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT m.display_name display_name,m.manager_id manager_id, cs.nick nick
SELECT m.display_name display_name,m.manager_id manager_id, cs.nick nick, cs.password password,cs.onoff onoff
FROM sys_managers m left join sys_customer_service cs on m.manager_id = cs.manager_id
WHERE m.role & #{mask} >0 AND (m.org_id IS NULL or m.org_id=1) AND m.is_valid = 1
]]>

@ -120,7 +120,7 @@ margin-bottom: 10%;"/>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li class="user-menu">
<li class="user-menu" ng-if="currentUser.onoff">
<a role="button" ng-click="customerService()">
<i class="fa fa-wechat"></i> contact service
</a>

@ -67,6 +67,7 @@ define(['angular', 'uiRouter'], function (angular) {
}]);
app.controller('servantsConfigCtrl', ['$scope','$http','commonDialog', function ($scope,$http,commonDialog) {
$scope.ctrl={};
$scope.loadServants = function () {
$http.get('/sys/manager_accounts/roles/servant').then(function (resp) {
$scope.servants = resp.data;
@ -80,6 +81,16 @@ define(['angular', 'uiRouter'], function (angular) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
};
$scope.changeNick = function (servant) {
console.log("servant",servant);
var param = {nick:servant.nick};
$http.put('/sys/openim/servant/'+servant.manager_id+'/nick',param).then(function (resp) {
$scope.ctrl.nick[servant.display_name] = false;
},function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
};
}]);

@ -1,10 +1,10 @@
<section class="content-header">
<h1>Mail Not Subscribe</h1>
<h1>Servants Config</h1>
<ol class="breadcrumb">
<li>
<a ui-sref="^"><i class="fa fa-cog"></i> System Config</a>
</li>
<li>Mail Not Subscribe</li>
<li>Servants Config</li>
</ol>
</section>
<div class="content">
@ -32,12 +32,36 @@
<thead>
<tr>
<th>Display Name</th>
<th>Nick</th>
<th>Password</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="servant in servants">
<td ng-bind="servant.display_name"></td>
<td>
<p class="form-control-static">
{{servant.nick}}
<a role="button" ng-click="ctrl.nick[servant.display_name]=true" ><i class="fa fa-edit"></i></a>
</p>
<div class="input-group" ng-if="ctrl.nick[servant.display_name] || false">
<input type="text" class="form-control" ng-model="servant.nick"
title="Ali Sub Merchant Id">
<div class="input-group-btn">
<button class="btn btn-success" ng-click="changeNick(servant)">
<i class="fa fa-check"></i>
</button>
</div>
<div class="input-group-btn">
<button class="btn btn-danger" ng-click="ctrl.nick[servant.display_name]=false">
<i class="fa fa-remove"></i>
</button>
</div>
</div>
</td>
<td ng-bind="servant.password"></td>
<td>
<input type="checkbox" ng-click="onoff(servant)" ng-model="servant.onoff">
</td>

@ -30,7 +30,7 @@
Partner Permission Config
</a>
<a class="btn btn-app" role="button" ui-sref=".servantsConfig">
<a class="btn btn-app" role="button" ui-sref=".servantsConfig" ng-if="('1'|withRole)">
<i class="fa fa-key"></i>
Servants Config
</a>

Loading…
Cancel
Save