CompanyVoiceMobileController.java 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. package com.fs.company.controller;
  2. import java.util.List;
  3. import com.fs.common.utils.ServletUtils;
  4. import com.fs.company.vo.CompanyVoiceMobileVO;
  5. import com.fs.core.security.LoginUser;
  6. import com.fs.crm.param.CrmLineCustomerImportParam;
  7. import org.springframework.security.access.prepost.PreAuthorize;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.web.bind.annotation.GetMapping;
  10. import org.springframework.web.bind.annotation.PostMapping;
  11. import org.springframework.web.bind.annotation.PutMapping;
  12. import org.springframework.web.bind.annotation.DeleteMapping;
  13. import org.springframework.web.bind.annotation.PathVariable;
  14. import org.springframework.web.bind.annotation.RequestBody;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RestController;
  17. import com.fs.common.annotation.Log;
  18. import com.fs.common.core.controller.BaseController;
  19. import com.fs.common.core.domain.AjaxResult;
  20. import com.fs.common.enums.BusinessType;
  21. import com.fs.company.domain.CompanyVoiceMobile;
  22. import com.fs.company.service.ICompanyVoiceMobileService;
  23. import com.fs.common.utils.poi.ExcelUtil;
  24. import com.fs.common.core.page.TableDataInfo;
  25. import org.springframework.web.multipart.MultipartFile;
  26. /**
  27. * 中间号Controller
  28. *
  29. * @author fs
  30. * @date 2021-10-04
  31. */
  32. @RestController
  33. @RequestMapping("/company/companyVoiceMobile")
  34. public class CompanyVoiceMobileController extends BaseController
  35. {
  36. @Autowired
  37. private ICompanyVoiceMobileService companyVoiceMobileService;
  38. /**
  39. * 查询中间号列表
  40. */
  41. @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:list')")
  42. @GetMapping("/list")
  43. public TableDataInfo list(CompanyVoiceMobile companyVoiceMobile)
  44. {
  45. startPage();
  46. List<CompanyVoiceMobileVO> list = companyVoiceMobileService.selectCompanyVoiceMobileVOList(companyVoiceMobile);
  47. return getDataTable(list);
  48. }
  49. /**
  50. * 导出中间号列表
  51. */
  52. @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:export')")
  53. @Log(title = "中间号", businessType = BusinessType.EXPORT)
  54. @GetMapping("/export")
  55. public AjaxResult export(CompanyVoiceMobile companyVoiceMobile)
  56. {
  57. List<CompanyVoiceMobile> list = companyVoiceMobileService.selectCompanyVoiceMobileList(companyVoiceMobile);
  58. ExcelUtil<CompanyVoiceMobile> util = new ExcelUtil<CompanyVoiceMobile>(CompanyVoiceMobile.class);
  59. return util.exportExcel(list, "companyVoiceMobile");
  60. }
  61. /**
  62. * 获取中间号详细信息
  63. */
  64. @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:query')")
  65. @GetMapping(value = "/{mobileId}")
  66. public AjaxResult getInfo(@PathVariable("mobileId") Long mobileId)
  67. {
  68. return AjaxResult.success(companyVoiceMobileService.selectCompanyVoiceMobileById(mobileId));
  69. }
  70. /**
  71. * 新增中间号
  72. */
  73. @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:add')")
  74. @Log(title = "中间号", businessType = BusinessType.INSERT)
  75. @PostMapping
  76. public AjaxResult add(@RequestBody CompanyVoiceMobile companyVoiceMobile)
  77. {
  78. if(companyVoiceMobile.getMobileType().equals(1)){
  79. companyVoiceMobile.setCompanyId(0l);
  80. }
  81. return toAjax(companyVoiceMobileService.insertCompanyVoiceMobile(companyVoiceMobile));
  82. }
  83. /**
  84. * 修改中间号
  85. */
  86. @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:edit')")
  87. @Log(title = "中间号", businessType = BusinessType.UPDATE)
  88. @PutMapping
  89. public AjaxResult edit(@RequestBody CompanyVoiceMobile companyVoiceMobile)
  90. {
  91. if(companyVoiceMobile.getMobileType().equals(1)){
  92. companyVoiceMobile.setCompanyId(0l);
  93. }
  94. return toAjax(companyVoiceMobileService.updateCompanyVoiceMobile(companyVoiceMobile));
  95. }
  96. /**
  97. * 删除中间号
  98. */
  99. @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:remove')")
  100. @Log(title = "中间号", businessType = BusinessType.DELETE)
  101. @DeleteMapping("/{mobileIds}")
  102. public AjaxResult remove(@PathVariable Long[] mobileIds)
  103. {
  104. return toAjax(companyVoiceMobileService.deleteCompanyVoiceMobileByIds(mobileIds));
  105. }
  106. @Log(title = "导入线索客户", businessType = BusinessType.IMPORT)
  107. @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:import')")
  108. @PostMapping("/importData")
  109. public AjaxResult importLineData(MultipartFile file) throws Exception
  110. {
  111. ExcelUtil<CompanyVoiceMobile> util = new ExcelUtil<CompanyVoiceMobile>(CompanyVoiceMobile.class);
  112. List<CompanyVoiceMobile> list = util.importExcel(file.getInputStream());
  113. String message = companyVoiceMobileService.importMobile(list);
  114. return AjaxResult.success(message);
  115. }
  116. //下载模板
  117. @GetMapping("/importTemplate")
  118. public AjaxResult importLineTemplate()
  119. {
  120. ExcelUtil<CompanyVoiceMobile> util = new ExcelUtil<CompanyVoiceMobile>(CompanyVoiceMobile.class);
  121. return util.importTemplateExcel("号码数据");
  122. }
  123. }