mirror of
https://gitee.com/elegant_wings/dbd-meeting.git
synced 2025-06-21 14:49:37 +08:00
企业管理员增加同时修改用户表中关联id
This commit is contained in:
parent
b7554338cd
commit
9bbf62fd06
@ -6,11 +6,15 @@ import com.ics.admin.service.IIcsCustomerStaffService;
|
|||||||
import com.ics.common.constant.Constants;
|
import com.ics.common.constant.Constants;
|
||||||
import com.ics.common.core.controller.BaseController;
|
import com.ics.common.core.controller.BaseController;
|
||||||
import com.ics.common.core.domain.R;
|
import com.ics.common.core.domain.R;
|
||||||
|
import com.ics.system.domain.User;
|
||||||
|
import com.ics.system.service.IUserService;
|
||||||
|
import org.checkerframework.checker.units.qual.A;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.wf.jwtp.annotation.RequiresPermissions;
|
import org.wf.jwtp.annotation.RequiresPermissions;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企业员工 提供者
|
* 企业员工 提供者
|
||||||
@ -26,6 +30,8 @@ public class CustomerStaffController extends BaseController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IIcsCustomerStaffService icsCustomerStaffService;
|
private IIcsCustomerStaffService icsCustomerStaffService;
|
||||||
|
@Autowired
|
||||||
|
private IUserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询企业员工
|
* 查询企业员工
|
||||||
@ -42,8 +48,8 @@ public class CustomerStaffController extends BaseController {
|
|||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
public R list(IcsCustomerStaff icsCustomerStaff) {
|
public R list(IcsCustomerStaff icsCustomerStaff) {
|
||||||
startPage();
|
startPage();
|
||||||
Integer staffId = getLoginStaffId();
|
Integer customerId = getLoginCustomerId();
|
||||||
icsCustomerStaff.setIcsCustomerId(staffId.longValue());
|
icsCustomerStaff.setIcsCustomerId(customerId.longValue());
|
||||||
icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF);
|
icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF);
|
||||||
return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff));
|
return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff));
|
||||||
}
|
}
|
||||||
@ -55,12 +61,18 @@ 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) {
|
||||||
Integer staffId = getLoginStaffId();
|
Integer customerId = getLoginCustomerId();
|
||||||
icsCustomerStaff.setIcsCustomerId(staffId.longValue());
|
icsCustomerStaff.setIcsCustomerId(customerId.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);
|
||||||
return toAjax(icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff));
|
User user = userService.selectUserByMobile(icsCustomerStaff.getMobile());
|
||||||
|
int i = icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff);
|
||||||
|
if(i>0){
|
||||||
|
user.setStaffId(icsCustomerStaff.getId());
|
||||||
|
userService.updateUser(user);
|
||||||
|
}
|
||||||
|
return toAjax(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,6 +113,10 @@ public class BaseController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Integer getLoginStaffId() {
|
public Integer getLoginStaffId() {
|
||||||
Token token = SubjectUtil.getToken(getRequest());
|
Token token = SubjectUtil.getToken(getRequest());
|
||||||
String value = valueOperations.get(ACCESS_USERID + ":" + token.getUserId());
|
String value = valueOperations.get(ACCESS_USERID + ":" + token.getUserId());
|
||||||
@ -123,6 +127,20 @@ public class BaseController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取企业id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Integer getLoginCustomerId() {
|
||||||
|
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("customerId")) {
|
||||||
|
return (Integer)jo.get("customerId");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 响应返回结果
|
* 响应返回结果
|
||||||
|
@ -81,7 +81,10 @@ public class User extends BaseEntity<User> {
|
|||||||
@NotBlank(message = "登录名称不能为空")
|
@NotBlank(message = "登录名称不能为空")
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
private String customerId;
|
/**
|
||||||
|
* 企业id
|
||||||
|
*/
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户名称
|
* 用户名称
|
||||||
@ -167,7 +170,9 @@ public class User extends BaseEntity<User> {
|
|||||||
*/
|
*/
|
||||||
private Set<String> buttons;
|
private Set<String> buttons;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
private Long staffId;
|
private Long staffId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,8 +77,13 @@ public class CurrentUserVO {
|
|||||||
private Boolean isAdmin;
|
private Boolean isAdmin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
private Long staffId;
|
private Long staffId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业id
|
||||||
|
*/
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,8 @@ public class PublishFactory {
|
|||||||
userOnline.setDeptName(user.getDept().getDeptName());
|
userOnline.setDeptName(user.getDept().getDeptName());
|
||||||
}
|
}
|
||||||
userOnline.setStaffId(user.getStaffId());
|
userOnline.setStaffId(user.getStaffId());
|
||||||
|
userOnline.setCustomerId(user.getCustomerId());
|
||||||
|
|
||||||
// 发布事件
|
// 发布事件
|
||||||
SpringContextHolder.publishEvent(new UserOnlineEvent(userOnline));
|
SpringContextHolder.publishEvent(new UserOnlineEvent(userOnline));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user