|
|
@@ -864,4 +864,69 @@ public class StaffService extends BaseService<Staff> {
|
|
|
// this.updateByUuid(new Staff().setStaffId(param.get("staffId").toString()).setFlgCanLogin(false));
|
|
|
return ResponseResultUtil.success(true);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 生成幽灵标识的数据
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/6/19 10:53
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<?> insertGhostStaff(StaffVO staffVO) {
|
|
|
+ // 转化实体
|
|
|
+ Staff staff = staffConvert.convertToPo(staffVO);
|
|
|
+ StaffQuery staffQuery = new StaffQuery();
|
|
|
+ staffQuery.setStaffCode(staff.getStaffCode());
|
|
|
+ staffQuery.setCpId(staff.getCpId());
|
|
|
+ List<StaffResponse> staffResponses = staffMapper.selectByCond(staffQuery);
|
|
|
+ if (staffResponses == null || staffResponses.size() == 0) {
|
|
|
+ return ResponseResultUtil.error("绑定员工不存在");
|
|
|
+ }else {
|
|
|
+ for (StaffResponse staffResponse:staffResponses){
|
|
|
+ // 获取编码和主键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());
|
|
|
+ staff.setStaffName(staff.getStaffName());
|
|
|
+ staff.setStaffPhone(staff.getStaffPhone());
|
|
|
+ staff.setOrgId(staffResponse.getOrgId());
|
|
|
+ staff.setRoleIds(staffResponse.getRoleIds());
|
|
|
+ staff.setHrStatus(staffResponse.getHrStatus());
|
|
|
+ staff.setFlgCanLogin(staffResponse.getFlgCanLogin());
|
|
|
+ staff.setWxUserId(staff.getWxUserId());
|
|
|
+ staff.setLoginType(staffResponse.getLoginType());
|
|
|
+ staff.setFlgInit(false);
|
|
|
+ staff.setFlgGhost(true);
|
|
|
+ super.insert(staff);
|
|
|
+ }
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 删除幽灵标识数据
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/6/19 10:53
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<?> deleteGhostStaff(StaffVO staffVO) {
|
|
|
+ // 转化实体
|
|
|
+ Staff staff = staffConvert.convertToPo(staffVO);
|
|
|
+ StaffQuery staffQuery = new StaffQuery();
|
|
|
+ staffQuery.setStaffName(staff.getStaffName());
|
|
|
+ staffQuery.setStaffPhone(staff.getStaffPhone());
|
|
|
+ staffQuery.setCpId(staff.getCpId());
|
|
|
+ int a = staffMapper.deleteGhostStaff(staffQuery);
|
|
|
+ if (a > 0){
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ return ResponseResultUtil.error("绑定员工不存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|