| | |
| | | if (containsAny(text, "指标", "统计", "看板", "总览", "经营分析")) { |
| | | return salesAgentTools.getSalesDashboard(memoryId, startDate, endDate, text); |
| | | } |
| | | if (containsAny(text, "客户档案", "私海", "公海", "客户池")) { |
| | | if (containsAny(text, "客户档案", "销售档案", "公海", "客户池")) { |
| | | return salesAgentTools.listCustomerProfiles(memoryId, extractSeaType(text), keyword, limit); |
| | | } |
| | | if (containsAny(text, "销售报价", "报价单", "报价", "询价")) { |
| | |
| | | |
| | | private String tryExecuteQuickPrompt(String memoryId, String text) { |
| | | String normalized = normalizeForMatch(text); |
| | | if ("查询私海客户档案前10条".equals(normalized)) { |
| | | return salesAgentTools.listCustomerProfiles(memoryId, "private", null, 10); |
| | | if ("查询销售档案前10条".equals(normalized)) { |
| | | return salesAgentTools.listCustomerProfiles(memoryId, "public", null, 10); |
| | | } |
| | | if ("查询公海客户档案".equals(normalized)) { |
| | | if ("查询客户档案".equals(normalized)) { |
| | | return salesAgentTools.listCustomerProfiles(memoryId, "public", null, 10); |
| | | } |
| | | if ("查询本月销售报价".equals(normalized)) { |
| | |
| | | } |
| | | |
| | | private String extractSeaType(String text) { |
| | | if (text.contains("公海")) { |
| | | if (text.contains("公海") || text.contains("销售档案")) { |
| | | return "public"; |
| | | } |
| | | if (text.contains("私海")) { |
| | | return "private"; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | } |
| | | String text = message.trim(); |
| | | return containsAny(text, |
| | | "查询", "查看", "统计", "分析", "建议", "客户档案", "私海", "公海", |
| | | "查询", "查看", "统计", "分析", "建议", "客户档案", "销售档案", "公海", |
| | | "销售报价", "销售台账", "销售退货", "客户往来", "发货台账", "回款", "报价", "风险"); |
| | | } |
| | | |
| | |
| | | String value = seaType.trim().toLowerCase(Locale.ROOT); |
| | | return switch (value) { |
| | | case "private", "私海", "0" -> 0; |
| | | case "public", "公海", "1" -> 1; |
| | | case "public", "公海", "销售档案", "1" -> 1; |
| | | default -> null; |
| | | }; |
| | | } |
| | |
| | | if (type == null) { |
| | | return "未知"; |
| | | } |
| | | return type == 1 ? "公海" : "私海"; |
| | | return type == 1 ? "销售档案" : "普通"; |
| | | } |
| | | |
| | | private int normalizeLimit(Integer limit) { |
| | |
| | | throw new RuntimeException("客户档案下有销售合同,请先删除销售合同"); |
| | | } |
| | | // 查询是否有已分配的公海客户 |
| | | List<Customer> assignedPools = customerMapper.selectList( |
| | | /*List<Customer> assignedPools = customerMapper.selectList( |
| | | new QueryWrapper<Customer>().lambda() |
| | | .in(Customer::getId, idList) |
| | | .eq(Customer::getType, 1). |
| | |
| | | ); |
| | | if (!assignedPools.isEmpty()) { |
| | | throw new RuntimeException("客户档案下有已分配的公海客户,请先收回"); |
| | | } |
| | | }*/ |
| | | // 删除客户的同时也需要删除对应的客户跟随、附件和回访提醒 |
| | | for (Long id : ids) { |
| | | customerFollowUpService.deleteByCustomerId(id); |
| | |
| | | } |
| | | |
| | | // 根据 type 参数设置客户类型(私海/公海) |
| | | if (type != null) { |
| | | /*if (type != null) { |
| | | userList.forEach(customer -> { |
| | | customer.setType(type); |
| | | }); |
| | | } |
| | | }*/ |
| | | this.saveOrUpdateBatch(userList); |
| | | return R.ok(true); |
| | | } catch (Exception e) { |
| | |
| | | and customer_type = #{c.customerType} |
| | | </if> |
| | | <!-- 公海查询:type = 1(公海客户)--> |
| | | <if test="c.type != null and c.type == 1"> |
| | | <!--<if test="c.type != null and c.type == 1"> |
| | | and type = #{c.type} |
| | | </if> |
| | | </if>--> |
| | | <!-- 私海查询:type = 0(私海客户)或者 type = 1(公海客户)且已被分配,并且是自己领用、自己创建或者共享给自己的客户 --> |
| | | <if test="c.type != null and c.type == 0"> |
| | | <!--<if test="c.type != null and c.type == 0"> |
| | | and ( |
| | | (type = #{c.type} or (type = 1 and is_assigned = 1)) |
| | | and ( |
| | |
| | | ) |
| | | ) |
| | | ) |
| | | </if> |
| | | </if>--> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | and customer_type = #{c.customerType} |
| | | </if> |
| | | <!-- 公海查询:type = 1(公海客户)--> |
| | | <if test="c.type != null and c.type == 1"> |
| | | <!--<if test="c.type != null and c.type == 1"> |
| | | and type = #{c.type} |
| | | </if> |
| | | </if>--> |
| | | <!-- 私海查询:type = 0(私海客户)或者 type = 1(公海客户)且已被分配,并且是自己领用、自己创建或者共享给自己的客户 --> |
| | | <if test="c.type != null and c.type == 0"> |
| | | <!--<if test="c.type != null and c.type == 0"> |
| | | and ( |
| | | (type = #{c.type} or (type = 1 and is_assigned = 1)) |
| | | and ( |
| | |
| | | ) |
| | | ) |
| | | ) |
| | | </if> |
| | | </if>--> |
| | | </where> |
| | | </select> |
| | | |