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

This commit is contained in:
chendaze 2024-03-02 17:03:23 +08:00
commit 095f33b5f1
4 changed files with 21 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package com.ics.admin.controller; package com.ics.admin.controller;
import com.alibaba.fastjson.JSONObject;
import com.ics.admin.domain.IcsCustomerStaff; import com.ics.admin.domain.IcsCustomerStaff;
import com.ics.admin.service.IIcsCustomerStaffService; import com.ics.admin.service.IIcsCustomerStaffService;
import com.ics.common.constant.Constants; import com.ics.common.constant.Constants;
@ -41,7 +42,8 @@ public class CustomerStaffController extends BaseController {
@GetMapping("list") @GetMapping("list")
public R list(IcsCustomerStaff icsCustomerStaff) { public R list(IcsCustomerStaff icsCustomerStaff) {
startPage(); startPage();
icsCustomerStaff.setIcsCustomerId(1L);//临时设置,需要从用户信息中获取 Integer staffId = getLoginStaffId();
icsCustomerStaff.setIcsCustomerId(staffId.longValue());
icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF); icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF);
return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff)); return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff));
} }
@ -53,7 +55,8 @@ public class CustomerStaffController extends BaseController {
@RequiresPermissions("admin:staff:add") @RequiresPermissions("admin:staff:add")
@PostMapping("save") @PostMapping("save")
public R addSave(@RequestBody IcsCustomerStaff icsCustomerStaff) { public R addSave(@RequestBody IcsCustomerStaff icsCustomerStaff) {
icsCustomerStaff.setIcsCustomerId(1L); Integer staffId = getLoginStaffId();
icsCustomerStaff.setIcsCustomerId(staffId.longValue());
icsCustomerStaff.setCreateTime(new Date()); icsCustomerStaff.setCreateTime(new Date());
icsCustomerStaff.setCreateBy(getLoginName()); icsCustomerStaff.setCreateBy(getLoginName());
icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF); icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF);

View File

@ -113,6 +113,16 @@ public class BaseController {
return null; return null;
} }
public Integer getLoginStaffId() {
Token token = SubjectUtil.getToken(getRequest());
String value = valueOperations.get(ACCESS_USERID + ":" + token.getUserId());
JSONObject jo = StringUtils.isEmpty(value) ? null : JSON.parseObject(value, JSONObject.class);
if (jo != null && jo.containsKey("staffId")) {
return (Integer)jo.get("staffId");
}
return null;
}
/** /**
* 响应返回结果 * 响应返回结果

View File

@ -76,4 +76,9 @@ public class CurrentUserVO {
*/ */
private Boolean isAdmin; private Boolean isAdmin;
/**
* 客户id
*/
private Long staffId;
} }

View File

@ -89,6 +89,7 @@ public class PublishFactory {
userOnline.setDeptId(user.getDept().getId()); userOnline.setDeptId(user.getDept().getId());
userOnline.setDeptName(user.getDept().getDeptName()); userOnline.setDeptName(user.getDept().getDeptName());
} }
userOnline.setStaffId(user.getStaffId());
// 发布事件 // 发布事件
SpringContextHolder.publishEvent(new UserOnlineEvent(userOnline)); SpringContextHolder.publishEvent(new UserOnlineEvent(userOnline));
} }