|
|
@@ -535,9 +535,26 @@ public class StaffService extends BaseService<Staff> {
|
|
|
// 查询原来的getFlgCanLogin
|
|
|
StaffResponse staffResponseOld = staffMapper.selectById(staffVO.getStaffId());
|
|
|
|
|
|
- super.updateByUuid(staff);
|
|
|
// 获取当前公司的cpId
|
|
|
Integer cpId = authUtils.getStaff().getCpId();
|
|
|
+ // 校验同一个公司的电话不能重复
|
|
|
+ StaffQuery staffQuery = new StaffQuery();
|
|
|
+ staffQuery.setStaffPhone(staff.getStaffPhone());
|
|
|
+ staffQuery.setCpId(cpId);
|
|
|
+ List<StaffResponse> staffResponses = staffMapper.selectByCond(staffQuery);
|
|
|
+ if (staffResponses != null && staffResponses.size() > 0 && !staffVO.getStaffId().equals(staffResponses.get(0).getStaffId())) {
|
|
|
+ return ResponseResultUtil.error(ResponseCodeEnum.ERROR_STAFF_PHONE_EXIST);
|
|
|
+ }
|
|
|
+
|
|
|
+ staffQuery.setStaffPhone(null);
|
|
|
+ staffQuery.setStaffCode(staff.getStaffCode());
|
|
|
+ staffResponses = staffMapper.selectByCondByCode(staffQuery);
|
|
|
+ if (staffResponses != null && staffResponses.size() > 0 && !staffVO.getStaffId().equals(staffResponses.get(0).getStaffId())) {
|
|
|
+ return ResponseResultUtil.error(ResponseCodeEnum.ERROR_STAFF_CODE_EXIST);
|
|
|
+ }
|
|
|
+
|
|
|
+ super.updateByUuid(staff);
|
|
|
+
|
|
|
//可以绑定微信的员工人数 人数上限
|
|
|
if (staffVO.getFlgCanLogin()) {
|
|
|
ResponseResultVO<?> resultMaxnum = companyFeign.getCompanyMaxStaffNum(cpId);
|
|
|
@@ -550,10 +567,10 @@ public class StaffService extends BaseService<Staff> {
|
|
|
Map<String, Object> mp = (Map<String, Object>) resultMaxnum.getData();
|
|
|
int intWebMaxnum = Integer.parseInt(mp.get("web_max_num") + "");
|
|
|
int intWxMaxnum = Integer.parseInt(mp.get("wx_max_num") + "");
|
|
|
- StaffQuery staffQuery = new StaffQuery();
|
|
|
- staffQuery.setFlgCanLogin(true);
|
|
|
- staffQuery.setCpId(cpId);
|
|
|
- List<StaffResponse> staffResponsesFlgCanLogin = staffMapper.selectByCond(staffQuery);
|
|
|
+ StaffQuery staffQueryf = new StaffQuery();
|
|
|
+ staffQueryf.setFlgCanLogin(true);
|
|
|
+ staffQueryf.setCpId(cpId);
|
|
|
+ List<StaffResponse> staffResponsesFlgCanLogin = staffMapper.selectByCond(staffQueryf);
|
|
|
if (staffResponsesFlgCanLogin != null && staffResponsesFlgCanLogin.size() > 0 ) {
|
|
|
List<StaffResponse> collectPc = staffResponsesFlgCanLogin.stream().filter(it -> it.getLoginType() == 1 || it.getLoginType() == 3).collect(Collectors.toList());
|
|
|
List<StaffResponse> collectWx = staffResponsesFlgCanLogin.stream().filter(it -> it.getLoginType() == 2 || it.getLoginType() == 3).collect(Collectors.toList());
|