| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- package com.goafanti.customer.controller;
- import com.goafanti.common.bo.Result;
- import com.goafanti.common.controller.BaseApiController;
- import com.goafanti.common.utils.excel.NewExcelUtil;
- import com.goafanti.customer.bo.InputUserClueBo;
- import com.goafanti.customer.bo.InputUserClueList;
- import com.goafanti.customer.bo.OutUserClueExcel;
- import com.goafanti.customer.service.UserClueService;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.web.bind.annotation.*;
- import org.springframework.web.multipart.MultipartFile;
- import javax.annotation.Resource;
- import java.util.List;
- @RestController
- @RequestMapping("/api/admin/userClue")
- public class UserClueApiController extends BaseApiController{
- @Resource
- private UserClueService userClueService;
- @Value(value = "${upload.path}")
- private String uploadPath = null;
- /**
- * 客户线索列表
- * @param in
- * @return
- */
- @GetMapping("/list")
- public Result list(InputUserClueList in) {
- return new Result(userClueService.list(in));
- }
- /**
- * 导入客户线索
- * @return
- */
- @PostMapping("/import")
- public Result importUserClue( @RequestParam(value = "file", required = false) MultipartFile file) {
- NewExcelUtil<OutUserClueExcel> excelUtil=new NewExcelUtil<>(OutUserClueExcel.class);
- List<OutUserClueExcel> list =null;
- try {
- list=excelUtil.importExcel(file.getInputStream(),1);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return new Result().data(userClueService.importUserClue(list));
- }
- /**
- * 导出客户线索模版
- * @return
- */
- @GetMapping("/exportTemplate")
- public Result exportList( ) {
- NewExcelUtil<OutUserClueExcel> excelUtil=new NewExcelUtil<>(OutUserClueExcel.class);
- return excelUtil.exportExcel(null,"客户线索模版",uploadPath);
- }
- /**
- * 新增客户线索
- * @return
- */
- @PostMapping("/add")
- public Result add( InputUserClueBo in) {
- Result res = new Result();
- return res.data(userClueService.add(in));
- }
- }
|