123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- package com.fs.company.controller;
- import java.util.List;
- import com.fs.common.utils.ServletUtils;
- import com.fs.company.vo.CompanyVoiceMobileVO;
- import com.fs.core.security.LoginUser;
- import com.fs.crm.param.CrmLineCustomerImportParam;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import com.fs.common.annotation.Log;
- import com.fs.common.core.controller.BaseController;
- import com.fs.common.core.domain.AjaxResult;
- import com.fs.common.enums.BusinessType;
- import com.fs.company.domain.CompanyVoiceMobile;
- import com.fs.company.service.ICompanyVoiceMobileService;
- import com.fs.common.utils.poi.ExcelUtil;
- import com.fs.common.core.page.TableDataInfo;
- import org.springframework.web.multipart.MultipartFile;
- /**
- * 中间号Controller
- *
- * @author fs
- * @date 2021-10-04
- */
- @RestController
- @RequestMapping("/company/companyVoiceMobile")
- public class CompanyVoiceMobileController extends BaseController
- {
- @Autowired
- private ICompanyVoiceMobileService companyVoiceMobileService;
- /**
- * 查询中间号列表
- */
- @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:list')")
- @GetMapping("/list")
- public TableDataInfo list(CompanyVoiceMobile companyVoiceMobile)
- {
- startPage();
- List<CompanyVoiceMobileVO> list = companyVoiceMobileService.selectCompanyVoiceMobileVOList(companyVoiceMobile);
- return getDataTable(list);
- }
- /**
- * 导出中间号列表
- */
- @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:export')")
- @Log(title = "中间号", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult export(CompanyVoiceMobile companyVoiceMobile)
- {
- List<CompanyVoiceMobile> list = companyVoiceMobileService.selectCompanyVoiceMobileList(companyVoiceMobile);
- ExcelUtil<CompanyVoiceMobile> util = new ExcelUtil<CompanyVoiceMobile>(CompanyVoiceMobile.class);
- return util.exportExcel(list, "companyVoiceMobile");
- }
- /**
- * 获取中间号详细信息
- */
- @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:query')")
- @GetMapping(value = "/{mobileId}")
- public AjaxResult getInfo(@PathVariable("mobileId") Long mobileId)
- {
- return AjaxResult.success(companyVoiceMobileService.selectCompanyVoiceMobileById(mobileId));
- }
- /**
- * 新增中间号
- */
- @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:add')")
- @Log(title = "中间号", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody CompanyVoiceMobile companyVoiceMobile)
- {
- if(companyVoiceMobile.getMobileType().equals(1)){
- companyVoiceMobile.setCompanyId(0l);
- }
- return toAjax(companyVoiceMobileService.insertCompanyVoiceMobile(companyVoiceMobile));
- }
- /**
- * 修改中间号
- */
- @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:edit')")
- @Log(title = "中间号", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody CompanyVoiceMobile companyVoiceMobile)
- {
- if(companyVoiceMobile.getMobileType().equals(1)){
- companyVoiceMobile.setCompanyId(0l);
- }
- return toAjax(companyVoiceMobileService.updateCompanyVoiceMobile(companyVoiceMobile));
- }
- /**
- * 删除中间号
- */
- @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:remove')")
- @Log(title = "中间号", businessType = BusinessType.DELETE)
- @DeleteMapping("/{mobileIds}")
- public AjaxResult remove(@PathVariable Long[] mobileIds)
- {
- return toAjax(companyVoiceMobileService.deleteCompanyVoiceMobileByIds(mobileIds));
- }
- @Log(title = "导入线索客户", businessType = BusinessType.IMPORT)
- @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:import')")
- @PostMapping("/importData")
- public AjaxResult importLineData(MultipartFile file) throws Exception
- {
- ExcelUtil<CompanyVoiceMobile> util = new ExcelUtil<CompanyVoiceMobile>(CompanyVoiceMobile.class);
- List<CompanyVoiceMobile> list = util.importExcel(file.getInputStream());
- String message = companyVoiceMobileService.importMobile(list);
- return AjaxResult.success(message);
- }
- //下载模板
- @GetMapping("/importTemplate")
- public AjaxResult importLineTemplate()
- {
- ExcelUtil<CompanyVoiceMobile> util = new ExcelUtil<CompanyVoiceMobile>(CompanyVoiceMobile.class);
- return util.importTemplateExcel("号码数据");
- }
- }
|