增加状态更新接口客户的状态可以是线索高一项第1项客户
This commit is contained in:
@@ -6,6 +6,7 @@ import com.rj.common.AudioManagementConstants;
|
||||
import com.rj.common.DataEnrichmentUtil;
|
||||
import com.rj.dto.CustomerPhotoPreviewResult;
|
||||
import com.rj.dto.CustomerPhotoUploadResult;
|
||||
import com.rj.dto.CustomerStageUpdateResult;
|
||||
import com.rj.dto.NearbyMerchantSearchResult;
|
||||
import com.rj.entity.AudioManagement;
|
||||
import com.rj.entity.CustomerManagement;
|
||||
@@ -335,6 +336,24 @@ public class CustomerManagementController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户 ID 更新阶段(stage)
|
||||
*/
|
||||
@PatchMapping("/updateStage")
|
||||
@Operation(summary = "更新客户阶段", description = "根据客户 ID 更新 stage 字段")
|
||||
public ResponseEntity<Map<String, Object>> updateStage(
|
||||
@Parameter(description = "客户ID", required = true) @RequestParam String id,
|
||||
@Parameter(description = "阶段", required = true) @RequestParam String stage) {
|
||||
CustomerStageUpdateResult updateResult = customerManagementService.updateCustomerStage(id, stage);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("success", updateResult.isSuccess());
|
||||
result.put("message", updateResult.getMessage());
|
||||
if (updateResult.getCustomer() != null) {
|
||||
result.put("data", updateResult.getCustomer());
|
||||
}
|
||||
return ResponseEntity.status(updateResult.getHttpStatus()).body(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除客户
|
||||
*/
|
||||
@@ -487,7 +506,7 @@ public class CustomerManagementController {
|
||||
audio.setSalesPhone(customer.getSalesPhone());
|
||||
audio.setDealershipId(customer.getDealershipId());
|
||||
audio.setDealershipName(customer.getDealershipName());
|
||||
audio.setIntentionLevel(customer.getIntendedModel());
|
||||
audio.setIntentionLevel(customer.getStage());
|
||||
audio.setRemarks(customer.getDetailedAddress());
|
||||
audio.setInfoCarddescription(customer.getInfoCard());
|
||||
audio.setCompanyType(customer.getCustomerSource());
|
||||
|
||||
35
src/main/java/com/rj/dto/CustomerStageUpdateResult.java
Normal file
35
src/main/java/com/rj/dto/CustomerStageUpdateResult.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.rj.dto;
|
||||
|
||||
import com.rj.entity.CustomerManagement;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 客户阶段(stage)更新结果,供控制层映射 HTTP 状态与 JSON。
|
||||
*/
|
||||
@Getter
|
||||
public class CustomerStageUpdateResult {
|
||||
|
||||
private final int httpStatus;
|
||||
private final boolean success;
|
||||
private final String message;
|
||||
private final CustomerManagement customer;
|
||||
|
||||
private CustomerStageUpdateResult(int httpStatus, boolean success, String message, CustomerManagement customer) {
|
||||
this.httpStatus = httpStatus;
|
||||
this.success = success;
|
||||
this.message = message;
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public static CustomerStageUpdateResult ok(CustomerManagement customer) {
|
||||
return new CustomerStageUpdateResult(200, true, "阶段更新成功", customer);
|
||||
}
|
||||
|
||||
public static CustomerStageUpdateResult badRequest(String message) {
|
||||
return new CustomerStageUpdateResult(400, false, message, null);
|
||||
}
|
||||
|
||||
public static CustomerStageUpdateResult serverError(String message) {
|
||||
return new CustomerStageUpdateResult(500, false, message, null);
|
||||
}
|
||||
}
|
||||
@@ -69,9 +69,9 @@ public class CustomerManagement implements Serializable {
|
||||
@TableField("recording_count")
|
||||
private Integer recordingCount;
|
||||
|
||||
@Schema(description = "意向车型")
|
||||
@TableField("intended_model")
|
||||
private String intendedModel;
|
||||
@Schema(description = "阶段")
|
||||
@TableField("stage")
|
||||
private String stage;
|
||||
|
||||
@Schema(description = "信息卡")
|
||||
@TableField("info_card")
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.rj.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.rj.dto.CustomerPhotoPreviewResult;
|
||||
import com.rj.dto.CustomerPhotoUploadResult;
|
||||
import com.rj.dto.CustomerStageUpdateResult;
|
||||
import com.rj.entity.CustomerManagement;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -29,4 +30,9 @@ public interface ICustomerManagementService extends IService<CustomerManagement>
|
||||
* @param photoType front / side / life,与 id 联用时可空
|
||||
*/
|
||||
CustomerPhotoPreviewResult openCustomerPhotoPreview(String url, String id, String photoType);
|
||||
|
||||
/**
|
||||
* 按客户主键更新阶段(stage)与更新时间。
|
||||
*/
|
||||
CustomerStageUpdateResult updateCustomerStage(String id, String stage);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.rj.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.rj.config.MinIOConfig;
|
||||
import com.rj.dto.CustomerPhotoPreviewResult;
|
||||
import com.rj.dto.CustomerPhotoUploadResult;
|
||||
import com.rj.dto.CustomerStageUpdateResult;
|
||||
import com.rj.entity.CustomerManagement;
|
||||
import com.rj.mapper.CustomerManagementMapper;
|
||||
import com.rj.service.ICustomerManagementService;
|
||||
@@ -15,6 +17,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@@ -65,6 +68,32 @@ public class CustomerManagementServiceImpl extends ServiceImpl<CustomerManagemen
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomerStageUpdateResult updateCustomerStage(String id, String stage) {
|
||||
try {
|
||||
if (id == null || id.trim().isEmpty()) {
|
||||
return CustomerStageUpdateResult.badRequest("客户ID不能为空");
|
||||
}
|
||||
String idTrim = id.trim();
|
||||
if (getById(idTrim) == null) {
|
||||
return CustomerStageUpdateResult.badRequest("客户不存在");
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
boolean updated = update(
|
||||
new LambdaUpdateWrapper<CustomerManagement>()
|
||||
.eq(CustomerManagement::getId, idTrim)
|
||||
.set(CustomerManagement::getStage, stage)
|
||||
.set(CustomerManagement::getUpdateTime, now));
|
||||
if (!updated) {
|
||||
return CustomerStageUpdateResult.badRequest("阶段更新失败");
|
||||
}
|
||||
return CustomerStageUpdateResult.ok(getById(idTrim));
|
||||
} catch (Exception e) {
|
||||
log.error("客户阶段更新失败: {}", e.getMessage(), e);
|
||||
return CustomerStageUpdateResult.serverError("阶段更新异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomerPhotoPreviewResult openCustomerPhotoPreview(String url, String id, String photoType) {
|
||||
String photoUrl = null;
|
||||
|
||||
@@ -36,13 +36,13 @@ public class NearbyMerchantSearchServiceImpl implements INearbyMerchantSearchSer
|
||||
/** 与 customer_management 正面/侧面/生活照三字段一致 */
|
||||
private static final int MAX_PHOTO_URLS = 3;
|
||||
|
||||
/** 高德采集写入客户时的默认门店/销售/意向(可按业务调整) */
|
||||
/** 高德采集写入客户时的默认门店/销售/阶段(可按业务调整) */
|
||||
private static final String DEFAULT_DEALERSHIP_ID = "1957424710587330562";
|
||||
private static final String DEFAULT_DEALERSHIP_NAME = "北京移多旺科技有限公司";
|
||||
private static final String DEFAULT_SALES_ID = "2";
|
||||
private static final String DEFAULT_SALES_NAME = "15810181776";
|
||||
private static final String DEFAULT_SALES_PHONE = "15810181776";
|
||||
private static final String DEFAULT_INTENDED_MODEL = "线索";
|
||||
private static final String DEFAULT_STAGE = "线索";
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
private final ObjectMapper objectMapper;
|
||||
@@ -337,7 +337,7 @@ public class NearbyMerchantSearchServiceImpl implements INearbyMerchantSearchSer
|
||||
c.setSalesId(DEFAULT_SALES_ID);
|
||||
c.setSalesName(DEFAULT_SALES_NAME);
|
||||
c.setSalesPhone(DEFAULT_SALES_PHONE);
|
||||
c.setIntendedModel(DEFAULT_INTENDED_MODEL);
|
||||
c.setStage(DEFAULT_STAGE);
|
||||
}
|
||||
|
||||
/** 接口检索参数 CITY、ADDRESS 两段拼接写入 {@code remark} */
|
||||
|
||||
Reference in New Issue
Block a user