|
|
@@ -1,5 +1,6 @@
|
|
|
package com.dk.mdm.service.mst;
|
|
|
|
|
|
+import com.dk.common.exception.BaseBusinessException;
|
|
|
import com.dk.common.infrastructure.annotaiton.Pagination;
|
|
|
import com.dk.common.infrastructure.constant.Constant;
|
|
|
import com.dk.common.infrastructure.enums.ErrorCodeEnum;
|
|
|
@@ -118,16 +119,25 @@ public class StaffService extends BaseService<Staff> {
|
|
|
Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.STAFF.getName(), true);
|
|
|
staff.setStaffId(codeMap.get("outId").toString());
|
|
|
staff.setStaffCode(codeMap.get("outNote").toString());
|
|
|
- super.insert(staff);
|
|
|
- // 讲电话和名称插入微信用户表里
|
|
|
|
|
|
- // 更新 被邀请人员的微信用户的cpid 加入公司
|
|
|
+ // 讲电话和名称插入微信用户表里
|
|
|
Map<String, Object> collectQuery = new HashMap<>();
|
|
|
collectQuery.put("currentCp", staff.getCpId());
|
|
|
collectQuery.put("userName", staff.getStaffName());
|
|
|
collectQuery.put("userPhone", staff.getStaffPhone());
|
|
|
- userFeign.registerFeign(collectQuery);
|
|
|
+ ResponseResultVO<?> resultVO = userFeign.registerFeign(collectQuery);
|
|
|
+ Map<String, Object> m = new HashMap<>();
|
|
|
|
|
|
+ // 如果没有成功返回,状态设置为待审
|
|
|
+ if (resultVO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
|
|
|
+ // 无用户
|
|
|
+ throw new BaseBusinessException(ErrorCodeEnum.USER_REGISTER_ERROR.getCode(),
|
|
|
+ ErrorCodeEnum.USER_REGISTER_ERROR.getMessage());
|
|
|
+ } else {
|
|
|
+ m = (Map<String, Object>) resultVO.getData();
|
|
|
+ }
|
|
|
+ staff.setWxUserId(m.get("userId").toString());
|
|
|
+ super.insert(staff);
|
|
|
return ResponseResultUtil.success(staff);
|
|
|
}
|
|
|
|
|
|
@@ -286,7 +296,7 @@ public class StaffService extends BaseService<Staff> {
|
|
|
@Transactional(
|
|
|
rollbackFor = {Exception.class}
|
|
|
)
|
|
|
- public ResponseResultVO<Dictionary<String,Object>> getInfoAfterLogin(Map<String, Object> param) {
|
|
|
+ public ResponseResultVO<Dictionary<String, Object>> getInfoAfterLogin(Map<String, Object> param) {
|
|
|
// 先根据userId查询当前企业的员工信息
|
|
|
StaffResponse staff = staffMapper.selectByUserId(param.get("userId").toString());
|
|
|
if (staff != null) {
|
|
|
@@ -299,7 +309,7 @@ public class StaffService extends BaseService<Staff> {
|
|
|
.setAppCode(param.get("appCode").toString()));
|
|
|
// 更新员工登录状态
|
|
|
this.updateByUuid(new Staff().setStaffId(staff.getStaffId()).setFlgCanLogin(true));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return ResponseResultUtil.error(ErrorCodeEnum.STAFF_NOT_EXIST.getCode(), ErrorCodeEnum.STAFF_NOT_EXIST.getMessage());
|
|
|
}
|
|
|
|
|
|
@@ -310,11 +320,11 @@ public class StaffService extends BaseService<Staff> {
|
|
|
.setAppCode(param.get("appCode").toString()));
|
|
|
// 获取所有参数
|
|
|
Map<String, Object> allSettingValue = commonMapper.getAllSettingValue();
|
|
|
- Dictionary<String,Object> dic = new Hashtable<>();
|
|
|
+ Dictionary<String, Object> dic = new Hashtable<>();
|
|
|
dic.put("menuList", menuList);
|
|
|
dic.put("comMenuList", comMenuList.getData());
|
|
|
dic.put("settingValue", allSettingValue);
|
|
|
- dic.put("staff",staff);
|
|
|
+ dic.put("staff", staff);
|
|
|
return ResponseResultUtil.success(dic);
|
|
|
}
|
|
|
|