添加销售人员时默认添加一个登录用户
This commit is contained in:
@@ -195,5 +195,6 @@ public class PasswordUtil {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -179,5 +179,6 @@ public class ServiceManager {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,9 +6,12 @@ import com.rj.common.DataEnrichmentUtil;
|
||||
import com.rj.entity.Dealership;
|
||||
import com.rj.entity.ProjectManagement;
|
||||
import com.rj.entity.SalesManagement;
|
||||
import com.rj.entity.sys.User;
|
||||
import com.rj.service.IDealershipService;
|
||||
import com.rj.service.IProjectManagementService;
|
||||
import com.rj.service.ISalesManagementService;
|
||||
import com.rj.service.sys.IUserService;
|
||||
import com.rj.controller.sys.UserController;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -17,7 +20,9 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -40,6 +45,12 @@ public class SalesManagementController {
|
||||
@Autowired
|
||||
private ISalesManagementService salesManagementService;
|
||||
|
||||
@Autowired
|
||||
private IUserService userService;
|
||||
|
||||
@Autowired
|
||||
private UserController userController;
|
||||
|
||||
/**
|
||||
* 新增销售
|
||||
*/
|
||||
@@ -54,6 +65,14 @@ public class SalesManagementController {
|
||||
salesManagement.setUpdateTime(LocalDateTime.now());
|
||||
boolean success = salesManagementService.save(salesManagement);
|
||||
if (success) {
|
||||
// 原有逻辑处理完成后,创建用户管理模块的用户
|
||||
try {
|
||||
createUserForSales(salesManagement);
|
||||
} catch (Exception userException) {
|
||||
// 用户创建失败不影响销售人员创建成功,只记录日志
|
||||
System.err.println("创建用户失败:" + userException.getMessage());
|
||||
}
|
||||
|
||||
result.put("success", true);
|
||||
result.put("message", "销售添加成功");
|
||||
result.put("data", salesManagement);
|
||||
@@ -70,6 +89,61 @@ public class SalesManagementController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 为销售人员创建用户管理模块的用户
|
||||
*/
|
||||
private void createUserForSales(SalesManagement salesManagement) {
|
||||
// 检查销售人员是否有联系方式(登录账号)
|
||||
if (salesManagement.getLoginAccount() == null || salesManagement.getLoginAccount().trim().isEmpty()) {
|
||||
throw new RuntimeException("销售人员联系方式不能为空");
|
||||
}
|
||||
|
||||
String phone = salesManagement.getLoginAccount();
|
||||
|
||||
// 生成密码:当前日期 + 联系方式后4位
|
||||
String password = generatePasswordForSales(phone);
|
||||
|
||||
// 创建用户对象
|
||||
User user = new User();
|
||||
user.setUserId(salesManagement.getId().hashCode());
|
||||
user.setUserName(phone); // 用户名 = 销售人员电话
|
||||
user.setPhone(phone); // 电话号码 = 销售人员电话
|
||||
user.setPassword(password); // 设置密码(UserController会自动加密)
|
||||
user.setEmail(phone+"@YiDuoWang.com");
|
||||
// 调用UserController的addUser方法保存用户
|
||||
ResponseEntity<Map<String, Object>> response = userController.addUser(user);
|
||||
|
||||
// 检查响应结果
|
||||
if (response.getBody() != null) {
|
||||
Map<String, Object> result = response.getBody();
|
||||
Boolean success = (Boolean) result.get("success");
|
||||
if (success == null || !success) {
|
||||
String message = (String) result.get("message");
|
||||
throw new RuntimeException("用户创建失败:" + (message != null ? message : "未知错误"));
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("用户创建失败:响应为空");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成销售人员密码:当前日期 + 联系方式后4位
|
||||
*/
|
||||
private String generatePasswordForSales(String phone) {
|
||||
// 获取当前日期,格式:yyyyMMdd
|
||||
String currentDate = LocalDate.now().format(DateTimeFormatter.ofPattern("MMdd"));
|
||||
|
||||
// 获取联系方式后4位
|
||||
String lastFourDigits = "";
|
||||
if (phone != null && phone.length() >= 4) {
|
||||
lastFourDigits = phone.substring(phone.length() - 4);
|
||||
} else {
|
||||
lastFourDigits = phone; // 如果长度不足4位,使用全部
|
||||
}
|
||||
|
||||
return currentDate + lastFourDigits;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询销售
|
||||
*/
|
||||
|
||||
@@ -417,5 +417,6 @@ public class MenuController {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -387,5 +387,6 @@ public class RoleController {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -393,5 +393,6 @@ public class UserRoleController {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -159,5 +159,6 @@ public class DifyWorkflowResponseDto {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -102,5 +102,6 @@ public interface CustomerProfileAnalysisMapper extends BaseMapper<CustomerProfil
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -123,5 +123,6 @@ public interface ICustomerProfileAnalysisService extends IService<CustomerProfil
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -158,5 +158,6 @@ public class CustomerProfileAnalysisServiceImpl extends ServiceImpl<CustomerProf
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -130,5 +130,6 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -130,5 +130,6 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -130,5 +130,6 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -139,5 +139,6 @@ spring:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -57,9 +57,11 @@ spring:
|
||||
database: 0
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://124.221.59.58:3309/ai_smart_badge?useUnicode=true&characterEncoding=utf8
|
||||
# url: jdbc:mysql://124.221.59.58:3309/ai_smart_badge?useUnicode=true&characterEncoding=utf8
|
||||
url: jdbc:mysql://101.35.52.237:13307/ai_smart_badge?useUnicode=true&characterEncoding=utf8
|
||||
username: root
|
||||
password: ChangAndb.123!
|
||||
password: cstcom.123!
|
||||
# password: ChangAndb.123!
|
||||
hikari:
|
||||
maximumPoolSize: 10
|
||||
minimumIdle: 5
|
||||
|
||||
@@ -116,5 +116,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -315,5 +315,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -37,18 +37,27 @@ filename: D:\bCard\code\Langchain4j-rj\src\main\sql\适配准真实.sql
|
||||
|
||||
适配销售顾问--开始
|
||||
ID sales_Name sales_Phone
|
||||
1972975619388026881 江叶 1899263500
|
||||
1972975623548776449 许莲 1894165677
|
||||
1972975624127590401 叶洋 1887059943
|
||||
1972975624584769537 曾艺 1883632473
|
||||
1972975625037754369 赵眉 1502041762
|
||||
1972975625520099329 付婵 1506166863
|
||||
1972975619388026881 江叶 18992635001
|
||||
1972975623548776449 许莲 18941656771
|
||||
1972975624127590401 叶洋 18870599431
|
||||
1972975624584769537 曾艺 18836324731
|
||||
1972975625037754369 赵眉 15020417621
|
||||
1972975625520099329 付婵 15061668631
|
||||
适配销售顾问 --结束
|
||||
|
||||
适配经销商门店的JSON ---开始
|
||||
{'1957424710587330562', '广州奔驰4S店'},{'1957424711560409089', '北京奥迪4S店'},{'1957424714953601026', '上海宝马4S店'},{'1957424739267981313', '深圳雷克萨斯4S店'},{'1957424740000000001', '成都保时捷4S店'},{'1957424740000000017', '昆明威兹曼4S店'},{}
|
||||
适配经销商门店的JSON --结束
|
||||
|
||||
适配客户信息--开始
|
||||
id customer_name phone dealershop_id shop_name sales_id sales_name
|
||||
1957425000000000001 陈志强 13800138001 1957424710587330562 广州奔驰4S店 1972975623548776449 许莲
|
||||
1957425000000000002 李美丽 13800138002 1957424711560409089 北京奥迪4S店 1972975619388026881 江叶
|
||||
1957425000000000003 王建国 13800138003 1957424714953601026 上海宝马4S店 1972975624127590401 叶洋
|
||||
1957425000000000004 刘小红 13800138004 1957424739267981313 深圳雷克萨斯4S店 1972975624584769537 曾艺
|
||||
1957425000000000005 张伟 13800138005 1957424740000000001 成都保时捷4S店 1972975625037754369 赵眉
|
||||
1957425000000000006 赵敏 13800138006 1957424740000000017 昆明威兹曼4S店 1972975625520099329 付婵
|
||||
适配客户信息--结束
|
||||
|
||||
|
||||
适配单向开口率的JSON--开始
|
||||
@@ -69,6 +78,8 @@ filename: D:\bCard\code\Langchain4j-rj\src\main\sql\适配准真实.sql
|
||||
适配单向开口率的JSON--结束
|
||||
|
||||
|
||||
|
||||
|
||||
录音文本内容适配维度 --- 开始
|
||||
0、请模拟30段录音文本内容形成一个数组,每段内容需要覆盖下面的维度,并把这些文暂存在AudioMockInsertDataScheduler.java 的最后,并在插入时随机获取一个维度,插入数据库
|
||||
1、模拟数据时得分要求:总分不能低于50分 ,总分不超过100分 ,每一项适配维度分值是 6分
|
||||
|
||||
@@ -253,5 +253,6 @@ public class FaceDetectImageCountTest {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -194,5 +194,6 @@ public class TtsRequestLogShortUrlTest {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -172,5 +172,6 @@ public class VideoSynthesisTempUrlTest {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -147,5 +147,6 @@ public class VideoSynthesisVideoNameTest {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user