You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.7 KiB
54 lines
1.7 KiB
|
3 months ago
|
package com.example.web.controller;
|
||
|
|
|
||
|
|
import com.example.web.service.FollowUpService;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.http.ResponseEntity;
|
||
|
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/api/followup")
|
||
|
|
public class FollowupController {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private FollowUpService followUpService;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 根据电话号码获取跟进信息
|
||
|
|
* @param phoneNumber 电话号码
|
||
|
|
* @param dataSource 数据源(primary或wechat)
|
||
|
|
* @return 跟进信息
|
||
|
|
*/
|
||
|
|
@GetMapping("/get")
|
||
|
|
public ResponseEntity<String> getFollowUp(
|
||
|
|
@RequestParam String phoneNumber) {
|
||
|
|
try {
|
||
|
|
String followup = followUpService.getFollowUpByPhone(phoneNumber);
|
||
|
|
return ResponseEntity.ok(followup);
|
||
|
|
} catch (Exception e) {
|
||
|
|
return ResponseEntity.internalServerError().body("获取跟进信息失败:" + e.getMessage());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 保存跟进信息
|
||
|
|
* @param phoneNumber 电话号码
|
||
|
|
* @param followup 跟进信息
|
||
|
|
* @return 保存结果
|
||
|
|
*/
|
||
|
|
@PostMapping("/save")
|
||
|
|
public ResponseEntity<String> saveFollowUp(
|
||
|
|
@RequestParam String phoneNumber,
|
||
|
|
@RequestParam String followup) {
|
||
|
|
try {
|
||
|
|
boolean result = followUpService.saveFollowUp(phoneNumber, followup);
|
||
|
|
if (result) {
|
||
|
|
return ResponseEntity.ok("跟进信息保存成功");
|
||
|
|
} else {
|
||
|
|
return ResponseEntity.badRequest().body("跟进信息保存失败");
|
||
|
|
}
|
||
|
|
} catch (Exception e) {
|
||
|
|
return ResponseEntity.internalServerError().body("保存跟进信息失败:" + e.getMessage());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|