|
|
@ -1,11 +1,13 @@ |
|
|
package com.example.web.service.impl; |
|
|
package com.example.web.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.example.web.entity.InformationTra; |
|
|
import com.example.web.entity.Managers; |
|
|
import com.example.web.entity.Managers; |
|
|
import com.example.web.entity.Users; |
|
|
import com.example.web.entity.Users; |
|
|
import com.example.web.entity.UsersManagements; |
|
|
import com.example.web.entity.UsersManagements; |
|
|
import com.example.web.mapper.ManagersMapper; |
|
|
|
|
|
import com.example.web.mapper.UsersMapper; |
|
|
import com.example.web.mapper.UsersMapper; |
|
|
|
|
|
import com.example.web.mapper.ManagersMapper; |
|
|
import com.example.web.mapper.UsersManagementsMapper; |
|
|
import com.example.web.mapper.UsersManagementsMapper; |
|
|
|
|
|
import com.example.web.service.InformationTraService; |
|
|
import com.example.web.service.UserService; |
|
|
import com.example.web.service.UserService; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
@ -26,6 +28,9 @@ public class UserServiceImpl implements UserService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private UsersManagementsMapper usersManagementsMapper; |
|
|
private UsersManagementsMapper usersManagementsMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private InformationTraService informationTraService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Map<String, Object> getUserList(Map<String, Object> requestParams) { |
|
|
public Map<String, Object> getUserList(Map<String, Object> requestParams) { |
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
@ -159,6 +164,12 @@ public class UserServiceImpl implements UserService { |
|
|
try { |
|
|
try { |
|
|
String userId = (String) params.get("userId"); |
|
|
String userId = (String) params.get("userId"); |
|
|
String followup = (String) params.get("followup"); |
|
|
String followup = (String) params.get("followup"); |
|
|
|
|
|
String userName = (String) params.get("userName"); |
|
|
|
|
|
String managercompany = (String) params.get("managercompany"); |
|
|
|
|
|
String managerdepartment = (String) params.get("managerdepartment"); |
|
|
|
|
|
String organization = (String) params.get("organization"); |
|
|
|
|
|
String role = (String) params.get("role"); |
|
|
|
|
|
String assistant = (String) params.get("assistant"); |
|
|
|
|
|
|
|
|
if (userId == null || followup == null) { |
|
|
if (userId == null || followup == null) { |
|
|
result.put("success", false); |
|
|
result.put("success", false); |
|
|
@ -169,6 +180,19 @@ public class UserServiceImpl implements UserService { |
|
|
// 更新跟进信息
|
|
|
// 更新跟进信息
|
|
|
usersMapper.updateFollowup(params); |
|
|
usersMapper.updateFollowup(params); |
|
|
|
|
|
|
|
|
|
|
|
// 记录跟进操作
|
|
|
|
|
|
InformationTra tra = createInformationTra( |
|
|
|
|
|
managercompany, |
|
|
|
|
|
managerdepartment, |
|
|
|
|
|
organization, |
|
|
|
|
|
role, |
|
|
|
|
|
userName, |
|
|
|
|
|
assistant, |
|
|
|
|
|
userId, |
|
|
|
|
|
"跟进客户: " + followup |
|
|
|
|
|
); |
|
|
|
|
|
informationTraService.recordUserOperation(tra); |
|
|
|
|
|
|
|
|
result.put("success", true); |
|
|
result.put("success", true); |
|
|
result.put("message", "跟进成功"); |
|
|
result.put("message", "跟进成功"); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
@ -186,6 +210,11 @@ public class UserServiceImpl implements UserService { |
|
|
try { |
|
|
try { |
|
|
String userId = (String) params.get("userId"); |
|
|
String userId = (String) params.get("userId"); |
|
|
String userName = (String) params.get("userName"); |
|
|
String userName = (String) params.get("userName"); |
|
|
|
|
|
String managercompany = (String) params.get("managercompany"); |
|
|
|
|
|
String managerdepartment = (String) params.get("managerdepartment"); |
|
|
|
|
|
String organization = (String) params.get("organization"); |
|
|
|
|
|
String role = (String) params.get("role"); |
|
|
|
|
|
String assistant = (String) params.get("assistant"); |
|
|
|
|
|
|
|
|
if (userId == null || userName == null) { |
|
|
if (userId == null || userName == null) { |
|
|
result.put("success", false); |
|
|
result.put("success", false); |
|
|
@ -196,15 +225,22 @@ public class UserServiceImpl implements UserService { |
|
|
// 1. 更新 usermanagements 表,为客户添加认领人信息
|
|
|
// 1. 更新 usermanagements 表,为客户添加认领人信息
|
|
|
usersMapper.updateUsersManagements(params); |
|
|
usersMapper.updateUsersManagements(params); |
|
|
|
|
|
|
|
|
// 2. 更新 users 表,设置 followup 字段为认领人
|
|
|
// 2. 更新 users 表,设置 sync_status 为 0
|
|
|
Map<String, Object> followupParams = new HashMap<>(); |
|
|
|
|
|
followupParams.put("userId", userId); |
|
|
|
|
|
followupParams.put("followup", userName); |
|
|
|
|
|
usersMapper.updateFollowup(followupParams); |
|
|
|
|
|
|
|
|
|
|
|
// 3. 更新 users 表,设置 sync_status 为 0
|
|
|
|
|
|
usersMapper.updateSyncStatus(params); |
|
|
usersMapper.updateSyncStatus(params); |
|
|
|
|
|
|
|
|
|
|
|
// 记录认领操作
|
|
|
|
|
|
InformationTra tra = createInformationTra( |
|
|
|
|
|
managercompany, |
|
|
|
|
|
managerdepartment, |
|
|
|
|
|
organization, |
|
|
|
|
|
role, |
|
|
|
|
|
userName, |
|
|
|
|
|
assistant, |
|
|
|
|
|
userId, |
|
|
|
|
|
"认领客户" |
|
|
|
|
|
); |
|
|
|
|
|
informationTraService.recordUserOperation(tra); |
|
|
|
|
|
|
|
|
result.put("success", true); |
|
|
result.put("success", true); |
|
|
result.put("message", "认领成功"); |
|
|
result.put("message", "认领成功"); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
@ -222,6 +258,12 @@ public class UserServiceImpl implements UserService { |
|
|
try { |
|
|
try { |
|
|
String userId = (String) params.get("userId"); |
|
|
String userId = (String) params.get("userId"); |
|
|
String type = (String) params.get("type"); |
|
|
String type = (String) params.get("type"); |
|
|
|
|
|
String userName = (String) params.get("userName"); |
|
|
|
|
|
String managercompany = (String) params.get("managercompany"); |
|
|
|
|
|
String managerdepartment = (String) params.get("managerdepartment"); |
|
|
|
|
|
String organization = (String) params.get("organization"); |
|
|
|
|
|
String role = (String) params.get("role"); |
|
|
|
|
|
String assistant = (String) params.get("assistant"); |
|
|
|
|
|
|
|
|
if (userId == null || type == null) { |
|
|
if (userId == null || type == null) { |
|
|
result.put("success", false); |
|
|
result.put("success", false); |
|
|
@ -235,6 +277,19 @@ public class UserServiceImpl implements UserService { |
|
|
// 2. 清除 usermanagements 表中的记录
|
|
|
// 2. 清除 usermanagements 表中的记录
|
|
|
usersMapper.clearUsersManagements(params); |
|
|
usersMapper.clearUsersManagements(params); |
|
|
|
|
|
|
|
|
|
|
|
// 记录归还操作
|
|
|
|
|
|
InformationTra tra = createInformationTra( |
|
|
|
|
|
managercompany, |
|
|
|
|
|
managerdepartment, |
|
|
|
|
|
organization, |
|
|
|
|
|
role, |
|
|
|
|
|
userName, |
|
|
|
|
|
assistant, |
|
|
|
|
|
userId, |
|
|
|
|
|
"归还客户到" + type |
|
|
|
|
|
); |
|
|
|
|
|
informationTraService.recordUserOperation(tra); |
|
|
|
|
|
|
|
|
result.put("success", true); |
|
|
result.put("success", true); |
|
|
result.put("message", "归还成功"); |
|
|
result.put("message", "归还成功"); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
@ -251,6 +306,12 @@ public class UserServiceImpl implements UserService { |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
String userId = (String) params.get("userId"); |
|
|
String userId = (String) params.get("userId"); |
|
|
|
|
|
String userName = (String) params.get("userName"); |
|
|
|
|
|
String managercompany = (String) params.get("managercompany"); |
|
|
|
|
|
String managerdepartment = (String) params.get("managerdepartment"); |
|
|
|
|
|
String organization = (String) params.get("organization"); |
|
|
|
|
|
String role = (String) params.get("role"); |
|
|
|
|
|
String assistant = (String) params.get("assistant"); |
|
|
|
|
|
|
|
|
if (userId == null) { |
|
|
if (userId == null) { |
|
|
result.put("success", false); |
|
|
result.put("success", false); |
|
|
@ -261,6 +322,19 @@ public class UserServiceImpl implements UserService { |
|
|
// 更新 users 表,设置 sync_statuss 字段值为 0
|
|
|
// 更新 users 表,设置 sync_statuss 字段值为 0
|
|
|
usersMapper.updateSyncStatusToZero(params); |
|
|
usersMapper.updateSyncStatusToZero(params); |
|
|
|
|
|
|
|
|
|
|
|
// 记录操作
|
|
|
|
|
|
InformationTra tra = createInformationTra( |
|
|
|
|
|
managercompany, |
|
|
|
|
|
managerdepartment, |
|
|
|
|
|
organization, |
|
|
|
|
|
role, |
|
|
|
|
|
userName, |
|
|
|
|
|
assistant, |
|
|
|
|
|
userId, |
|
|
|
|
|
"简道云操作" |
|
|
|
|
|
); |
|
|
|
|
|
informationTraService.recordUserOperation(tra); |
|
|
|
|
|
|
|
|
result.put("success", true); |
|
|
result.put("success", true); |
|
|
result.put("message", "操作成功"); |
|
|
result.put("message", "操作成功"); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
@ -284,6 +358,11 @@ public class UserServiceImpl implements UserService { |
|
|
List<String> userIds = (List<String>) params.get("userIds"); |
|
|
List<String> userIds = (List<String>) params.get("userIds"); |
|
|
String managerId = (String) params.get("managerId"); |
|
|
String managerId = (String) params.get("managerId"); |
|
|
String userName = (String) params.get("userName"); |
|
|
String userName = (String) params.get("userName"); |
|
|
|
|
|
String operatorUserName = (String) params.get("operatorUserName"); |
|
|
|
|
|
String managercompany = (String) params.get("managercompany"); |
|
|
|
|
|
String managerdepartment = (String) params.get("managerdepartment"); |
|
|
|
|
|
String organization = (String) params.get("organization"); |
|
|
|
|
|
String role = (String) params.get("role"); |
|
|
|
|
|
|
|
|
if (userIds == null || userIds.isEmpty() || managerId == null || userName == null) { |
|
|
if (userIds == null || userIds.isEmpty() || managerId == null || userName == null) { |
|
|
result.put("success", false); |
|
|
result.put("success", false); |
|
|
@ -339,6 +418,19 @@ public class UserServiceImpl implements UserService { |
|
|
|
|
|
|
|
|
// 不更新users表的sync_status,保持原始值
|
|
|
// 不更新users表的sync_status,保持原始值
|
|
|
// usersMapper.updateSyncStatus(updateParams);
|
|
|
// usersMapper.updateSyncStatus(updateParams);
|
|
|
|
|
|
|
|
|
|
|
|
// 记录分配操作
|
|
|
|
|
|
InformationTra tra = createInformationTra( |
|
|
|
|
|
managercompany, |
|
|
|
|
|
managerdepartment, |
|
|
|
|
|
organization, |
|
|
|
|
|
role, |
|
|
|
|
|
operatorUserName, |
|
|
|
|
|
"", |
|
|
|
|
|
userId, |
|
|
|
|
|
"分配负责人: " + selectedManager.getUserName() |
|
|
|
|
|
); |
|
|
|
|
|
informationTraService.recordUserOperation(tra); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
result.put("success", true); |
|
|
result.put("success", true); |
|
|
@ -350,4 +442,37 @@ public class UserServiceImpl implements UserService { |
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 创建信息跟踪记录 |
|
|
|
|
|
* @param tracompany 修改者公司 |
|
|
|
|
|
* @param tradepartment 修改者部门 |
|
|
|
|
|
* @param traorganization 修改者组织 |
|
|
|
|
|
* @param trarole 修改者角色 |
|
|
|
|
|
* @param trauserName 修改者名字 |
|
|
|
|
|
* @param traassistant 修改协助人 |
|
|
|
|
|
* @param userId 客户ID |
|
|
|
|
|
* @param operationEvent 操作事件 |
|
|
|
|
|
* @return 信息跟踪实体 |
|
|
|
|
|
*/ |
|
|
|
|
|
private InformationTra createInformationTra( |
|
|
|
|
|
String tracompany, |
|
|
|
|
|
String tradepartment, |
|
|
|
|
|
String traorganization, |
|
|
|
|
|
String trarole, |
|
|
|
|
|
String trauserName, |
|
|
|
|
|
String traassistant, |
|
|
|
|
|
String userId, |
|
|
|
|
|
String operationEvent) { |
|
|
|
|
|
InformationTra tra = new InformationTra(); |
|
|
|
|
|
tra.setTracompany(tracompany); |
|
|
|
|
|
tra.setTradepartment(tradepartment); |
|
|
|
|
|
tra.setTraorganization(traorganization); |
|
|
|
|
|
tra.setTrarole(trarole); |
|
|
|
|
|
tra.setTrauserName(trauserName); |
|
|
|
|
|
tra.setTraassistant(traassistant); |
|
|
|
|
|
tra.setUserId(userId); |
|
|
|
|
|
tra.setOperationEvent("跟进系统-" + operationEvent); |
|
|
|
|
|
return tra; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|