|
|
@@ -0,0 +1,79 @@
|
|
|
+package com.fs.qw.controller;
|
|
|
+
|
|
|
+import com.fs.common.annotation.Log;
|
|
|
+import com.fs.common.core.controller.BaseController;
|
|
|
+import com.fs.common.core.domain.AjaxResult;
|
|
|
+import com.fs.common.core.page.TableDataInfo;
|
|
|
+import com.fs.common.enums.BusinessType;
|
|
|
+import com.fs.common.utils.poi.ExcelUtil;
|
|
|
+import com.fs.qw.domain.FsCompanyCustomer;
|
|
|
+import com.fs.qw.service.IFsCompanyCustomerService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/qw/companyCustomer")
|
|
|
+public class FsCompanyCustomerController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsCompanyCustomerService fsCompanyCustomerService;
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:companyCustomer:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(FsCompanyCustomer fsCompanyCustomer){
|
|
|
+ startPage();
|
|
|
+ List<FsCompanyCustomer> list = fsCompanyCustomerService.selectFsCompanyCustomerList(fsCompanyCustomer);
|
|
|
+ if (!CollectionUtils.isEmpty(list)) {
|
|
|
+ for (FsCompanyCustomer customer : list) {
|
|
|
+ customer.setPhone(maskPhoneMiddleFive(customer.getPhone()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:companyCustomer:export')")
|
|
|
+ @Log(title = "客户信息", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public AjaxResult export(FsCompanyCustomer fsCompanyCustomer) {
|
|
|
+ List<FsCompanyCustomer> list = fsCompanyCustomerService.selectFsCompanyCustomerList(fsCompanyCustomer);
|
|
|
+ ExcelUtil<FsCompanyCustomer> util = new ExcelUtil<FsCompanyCustomer>(FsCompanyCustomer.class);
|
|
|
+ return util.exportExcel(list, "客户信息数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取客户详情
|
|
|
+ */
|
|
|
+ @GetMapping("/{id}")
|
|
|
+ public AjaxResult getInfo(@PathVariable Long id) {
|
|
|
+ FsCompanyCustomer fsCompanyCustomer = fsCompanyCustomerService.selectFsCompanyCustomerById(id);
|
|
|
+ fsCompanyCustomer.setPhone(maskPhoneMiddleFive(fsCompanyCustomer.getPhone()));
|
|
|
+ return AjaxResult.success(fsCompanyCustomer);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 手机号中间5位脱敏处理 (例如: 13812345678 -> 138******678)
|
|
|
+ * @param phone 原始手机号
|
|
|
+ * @return 脱敏后的手机号
|
|
|
+ */
|
|
|
+ private String maskPhoneMiddleFive(String phone) {
|
|
|
+ // 判断是否为空,不为空才进行替换处理
|
|
|
+ if (phone == null || phone.isEmpty()) {
|
|
|
+ return phone;
|
|
|
+ }
|
|
|
+ // 使用正则表达式将中间5位数字替换为 *****
|
|
|
+ // (\\d{3}) 匹配前3位并作为分组1,\\d{5} 匹配中间5位,(\\d{3}) 匹配后3位并作为分组2
|
|
|
+ return phone.replaceAll("(\\d{3})\\d{5}(\\d{3})", "$1*****$2");
|
|
|
+ }
|
|
|
+}
|