From 624d20283ed45c1a3307af5758c7dfb999d1d724 Mon Sep 17 00:00:00 2001 From: Wang Date: Fri, 16 Jan 2026 10:40:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=A7=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../seer/teach/common/config/LlmConfig.java | 6 ++-- .../mp/admin/service/AdminAgentService.java | 36 ++++++++----------- .../teach/mp/service/IMpAgentService.java | 12 +++++-- .../mp/service/impl/MpAgentServiceImpl.java | 22 ++++++++++-- .../admin/api/UserInfoServiceApiImpl.java | 5 +-- 5 files changed, 49 insertions(+), 32 deletions(-) diff --git a/seer-common/common-config/src/main/java/com/seer/teach/common/config/LlmConfig.java b/seer-common/common-config/src/main/java/com/seer/teach/common/config/LlmConfig.java index dafffc4..e86f628 100644 --- a/seer-common/common-config/src/main/java/com/seer/teach/common/config/LlmConfig.java +++ b/seer-common/common-config/src/main/java/com/seer/teach/common/config/LlmConfig.java @@ -35,7 +35,7 @@ public class LlmConfig implements InitializingBean { @Value("${largeModel.stt:}") private String stt; - @Value("${largeModel.getComment:}") + @Value("${largeModel.comment:}") private String getComment; @Value("${largeModel.sseAiChat:}") @@ -53,10 +53,10 @@ public class LlmConfig implements InitializingBean { @Value("${largeModel.processUpload:}") private String processUpload; - @Value("${largeModel.getContextAboutSingleQuestion:}") + @Value("${largeModel.contextAboutSingleQuestion:}") private String getContextAboutSingleQuestion; - @Value("${largeModel.getTextBase64:}") + @Value("${largeModel.textBase64:}") private String getTextBase64; public static String IP; diff --git a/seer-mp/seer-mp-service-admin/src/main/java/com/seer/teach/mp/admin/service/AdminAgentService.java b/seer-mp/seer-mp-service-admin/src/main/java/com/seer/teach/mp/admin/service/AdminAgentService.java index fa50fcf..ad05659 100644 --- a/seer-mp/seer-mp-service-admin/src/main/java/com/seer/teach/mp/admin/service/AdminAgentService.java +++ b/seer-mp/seer-mp-service-admin/src/main/java/com/seer/teach/mp/admin/service/AdminAgentService.java @@ -12,7 +12,9 @@ import com.seer.teach.mp.admin.controller.req.MpAgentReq; import com.seer.teach.mp.admin.controller.req.MpAgentSaveReq; import com.seer.teach.mp.admin.controller.resp.AgentResp; import com.seer.teach.mp.admin.convert.AgentConvert; +import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity; import com.seer.teach.mp.entity.MpAgentEntity; +import com.seer.teach.mp.service.IMpAgentEmployeeRelationService; import com.seer.teach.mp.service.IMpAgentService; import com.seer.teach.user.api.UserInfoServiceApi; import com.seer.teach.user.api.dto.UserInfoDTO; @@ -33,6 +35,8 @@ public class AdminAgentService { private final UserInfoServiceApi userInfoServiceApi; + private final IMpAgentEmployeeRelationService mpAgentEmployeeRelationService; + /** * 获取代理商列表 * @@ -72,7 +76,7 @@ public class AdminAgentService { * @return 是否成功 */ public Boolean saveAgent(MpAgentSaveReq req) { - boolean userIdByMobile = userInfoServiceApi.getUserIdByMobile(req.getContactPhone()); + boolean userIdByMobile = mpAgentService.getCountByPhone(req.getContactPhone()) == 0; AssertUtils.isTrue(userIdByMobile, ResultCodeEnum.AGENT_IS_EXISTS); MpAgentEntity agentEntity = AgentConvert.INSTANCE.convertOneSave(req); boolean result = mpAgentService.saveAgent(agentEntity, req.getPassword()); @@ -89,29 +93,15 @@ public class AdminAgentService { public Boolean updateAgent(MpAgentReq req) { MpAgentEntity agent = mpAgentService.getById(req.getId()); AssertUtils.notNull(agent, ResultCodeEnum.AGENT_NOT_FOUND); - UserInfoDTO userInfoDTO = new UserInfoDTO(); - userInfoDTO.setId(agent.getContactUserId()); - userInfoDTO.setUserName(req.getContactName()); - userInfoDTO.setMobile(req.getContactPhone()); - if (StringUtils.isNotBlank(req.getPassword())) { - userInfoDTO.setPassword(req.getPassword()); - } - boolean updateUserResult = userInfoServiceApi.updateUserInfo(userInfoDTO); - log.info("更新用户结果: {}", updateUserResult); agent.setId(req.getId()); agent.setAgentName(req.getAgentName()); - agent.setAgentCode(req.getAgentCode()); agent.setAgentLevel(req.getAgentLevel()); agent.setContactName(req.getContactName()); - Integer contactUserId = userInfoServiceApi.getUserIdByUserName(agent.getContactName()); - agent.setContactUserId(contactUserId); agent.setContactPhone(req.getContactPhone()); agent.setAddress(req.getAddress()); agent.setStatus(req.getStatus()); - boolean result = mpAgentService.updateAgent(agent); - log.info("更新代理商结果: {}", result); - return result && updateUserResult; + return mpAgentService.updateAgent(agent, req.getPassword()); } /** @@ -125,17 +115,21 @@ public class AdminAgentService { log.warn("删除代理商时,ID列表为空"); return false; } - List agentList = mpAgentService.lambdaQuery().in(MpAgentEntity::getId, ids) - .select(MpAgentEntity::getContactUserId).list(); - List contactUserIdList = agentList.stream().map(MpAgentEntity::getContactUserId) - .filter(Objects::nonNull).toList(); - log.info("待删除代理商关联的用户ID列表: {}", contactUserIdList); boolean result = mpAgentService.removeByIds(ids); log.info("删除代理商结果: {}", result); if (result) { log.info("删除代理商成功,ID列表: {}", ids); // 删除关联的用户数据 + List agentList = mpAgentService.lambdaQuery().in(MpAgentEntity::getId, ids) + .select(MpAgentEntity::getContactUserId).list(); + List contactUserIdList = agentList.stream().map(MpAgentEntity::getContactUserId) + .filter(Objects::nonNull).toList(); + log.info("待删除代理商关联的用户ID列表: {}", contactUserIdList); userInfoServiceApi.deleteUserRoleByUserId(contactUserIdList); + + // 删除关联的代理商员工关系数据 + boolean remove = mpAgentEmployeeRelationService.remove(new LambdaQueryWrapper<>(MpAgentEmployeeRelationEntity.class).in(MpAgentEmployeeRelationEntity::getAgentId, ids)); + log.info("删除代理商员工关系结果: {}", remove); } return result; } diff --git a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/IMpAgentService.java b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/IMpAgentService.java index d1cf7f3..7d1e0cd 100644 --- a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/IMpAgentService.java +++ b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/IMpAgentService.java @@ -22,7 +22,7 @@ public interface IMpAgentService extends IService { * 保存代理商 * * @param agentEntity 代理商实体 - * @param password m密码 + * @param password 密码 * @return 是否成功 */ Boolean saveAgent(MpAgentEntity agentEntity,String password); @@ -31,13 +31,21 @@ public interface IMpAgentService extends IService { * 更新代理商 * * @param agentEntity 代理商实体 + * @param password 密码 * @return 是否成功 */ - Boolean updateAgent(MpAgentEntity agentEntity); + Boolean updateAgent(MpAgentEntity agentEntity,String password); /** * 获取代理商名称列表 * @return 代理商名称列表 */ List getAgentName(); + + /** + * 根据手机号获取代理商数量 + * @param phone 手机号 + * @return 代理商数量 + */ + long getCountByPhone(String phone); } \ No newline at end of file diff --git a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentServiceImpl.java b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentServiceImpl.java index 38a3ce8..6a29d15 100644 --- a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentServiceImpl.java +++ b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentServiceImpl.java @@ -9,6 +9,7 @@ import com.seer.teach.user.api.UserInfoServiceApi; import com.seer.teach.user.api.dto.UserInfoDTO; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import java.util.List; @@ -42,8 +43,20 @@ public class MpAgentServiceImpl extends ServiceImpl list = this.list(); return list.stream().map(MpAgentEntity::getAgentName).toList(); } + + @Override + public long getCountByPhone(String phone) { + return this.lambdaQuery().eq(MpAgentEntity::getContactPhone, phone).count(); + } } \ No newline at end of file diff --git a/seer-user/seer-user-service/src/main/java/com/seer/teach/user/admin/api/UserInfoServiceApiImpl.java b/seer-user/seer-user-service/src/main/java/com/seer/teach/user/admin/api/UserInfoServiceApiImpl.java index a550064..e1738ef 100644 --- a/seer-user/seer-user-service/src/main/java/com/seer/teach/user/admin/api/UserInfoServiceApiImpl.java +++ b/seer-user/seer-user-service/src/main/java/com/seer/teach/user/admin/api/UserInfoServiceApiImpl.java @@ -336,10 +336,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi { log.info("准备删除角色记录,ID列表: {}", ids); boolean result = userRoleService.removeByIds(ids); log.info("删除角色结果: {}", result); - // 删除用户信息 - boolean userResult = userService.removeByIds(userIds); - log.info("删除用户信息结果: {}", userResult); - return result && userResult; + return result; } @Override