|
|
@@ -100,14 +100,43 @@ public class StaffService extends BaseService<Staff> {
|
|
|
staffQuery.setCpId(staff.getCpId());
|
|
|
staffQuery.setStaffPhone(staff.getStaffPhone());
|
|
|
List<StaffResponse> staffResponses = staffMapper.selectByCond(staffQuery);
|
|
|
- if (staffResponses!=null && staffResponses.size() > 0){
|
|
|
+ if (staffResponses != null && staffResponses.size() > 0) {
|
|
|
return ResponseResultUtil.error(ResponseCodeEnum.ERROR_STAFF_PHONE_EXIST);
|
|
|
}
|
|
|
// 获取编码和主键UuId
|
|
|
Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.STAFF.getName(), true);
|
|
|
staff.setStaffId(codeMap.get("outId").toString());
|
|
|
staff.setStaffCode(codeMap.get("outNote").toString());
|
|
|
- return super.insert(staff);
|
|
|
+ super.insert(staff);
|
|
|
+ return ResponseResultUtil.success(staff);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 保存方法
|
|
|
+ * @author : 姜永辉
|
|
|
+ * @date : 2023/1/9 10:49
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<?> insertFeignStaff(StaffVO staffVO) {
|
|
|
+ // 转化实体
|
|
|
+ Staff staff = staffConvert.convertToPo(staffVO);
|
|
|
+ // 校验同一个公司的电话不能重复
|
|
|
+ StaffQuery staffQuery = new StaffQuery();
|
|
|
+ staffQuery.setCpId(staff.getCpId());
|
|
|
+ staffQuery.setStaffPhone(staff.getStaffPhone());
|
|
|
+ List<StaffResponse> staffResponses = staffMapper.selectByCond(staffQuery);
|
|
|
+ if (staffResponses != null && staffResponses.size() > 0) {
|
|
|
+ return ResponseResultUtil.error(ResponseCodeEnum.ERROR_STAFF_PHONE_EXIST);
|
|
|
+ }
|
|
|
+ // 获取编码和主键UuId
|
|
|
+ Map<String, Object> codeMap = commonService.getUniqueNoteCode(
|
|
|
+ Constant.docNameConstant.STAFF.getName(), staff.getCpId(), true);
|
|
|
+ staff.setStaffId(codeMap.get("outId").toString());
|
|
|
+ staff.setStaffCode(codeMap.get("outNote").toString());
|
|
|
+ super.insert(staff);
|
|
|
+ return ResponseResultUtil.success(staff);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -115,7 +144,7 @@ public class StaffService extends BaseService<Staff> {
|
|
|
* @author : 姜永辉
|
|
|
* @date : 2023/1/9 10:49
|
|
|
*/
|
|
|
- @Transactional( rollbackFor = {Exception.class} )
|
|
|
+ @Transactional(rollbackFor = {Exception.class})
|
|
|
public ResponseResultVO<?> insertRequestStaff(StaffVO staffVO) {
|
|
|
// 转化实体
|
|
|
Staff staff = staffConvert.convertToPo(staffVO);
|
|
|
@@ -124,7 +153,7 @@ public class StaffService extends BaseService<Staff> {
|
|
|
staffQuery.setCpId(staff.getCpId());
|
|
|
staffQuery.setStaffPhone(staff.getStaffPhone());
|
|
|
List<StaffResponse> staffResponses = staffMapper.selectByCond(staffQuery);
|
|
|
- if (staffResponses!=null && staffResponses.size() > 0){
|
|
|
+ if (staffResponses != null && staffResponses.size() > 0) {
|
|
|
return ResponseResultUtil.error(ResponseCodeEnum.ERROR_STAFF_PHONE_EXIST);
|
|
|
}
|
|
|
// 获取编码和主键UuId
|
|
|
@@ -132,7 +161,7 @@ public class StaffService extends BaseService<Staff> {
|
|
|
staff.setStaffId(codeMap.get("outId").toString());
|
|
|
staff.setStaffCode(codeMap.get("outNote").toString());
|
|
|
// 更新 被邀人员的cpid
|
|
|
- if (staff.getWxUserId()!=null){
|
|
|
+ if (staff.getWxUserId() != null) {
|
|
|
// 更新 被邀请人员的微信用户的cpid 加入公司
|
|
|
Map<String, Object> collectQuery = new HashMap<>();
|
|
|
collectQuery.put("cpId", staff.getCpId());
|
|
|
@@ -140,7 +169,8 @@ public class StaffService extends BaseService<Staff> {
|
|
|
companyFeign.updateWxUserCompany(collectQuery);
|
|
|
}
|
|
|
// 插入员工
|
|
|
- return super.insert(staff);
|
|
|
+ super.insert(staff);
|
|
|
+ return ResponseResultUtil.success(staff);
|
|
|
}
|
|
|
|
|
|
/**
|