From 87710caff5482ee0bcaa58cf76c3cf0e3a9758f0 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期五, 05 十二月 2025 14:44:04 +0800
Subject: [PATCH] 分公司审核,解除列表
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmBranchController.java | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 116 insertions(+), 2 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmBranchController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmBranchController.java
index df5f843..74ebc20 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmBranchController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmBranchController.java
@@ -12,21 +12,28 @@
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.WebUtils;
import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.system.dto.BranchAuditDTO;
import com.ruoyi.system.dto.TCrmBranchDTO;
import com.ruoyi.system.dto.UnbindDTO;
+import com.ruoyi.system.dto.UnbindProcessingDTO;
+import com.ruoyi.system.export.TCrmBranchAuditExport;
import com.ruoyi.system.export.TCrmBranchExport;
import com.ruoyi.system.export.TSysAppUserClinicExport;
import com.ruoyi.system.export.TSysAppUserExport;
import com.ruoyi.system.model.*;
+import com.ruoyi.system.query.TCrmBranchAuditQuery;
import com.ruoyi.system.query.TCrmBranchQuery;
import com.ruoyi.system.query.TSysAppUserQuery;
import com.ruoyi.system.service.*;
+import com.ruoyi.system.vo.TCrmBranchLiftVO;
import com.ruoyi.system.vo.TCrmBranchVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -36,6 +43,7 @@
import java.io.IOException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -84,6 +92,37 @@
Integer roleType = tokenService.getLoginUser().getUser().getRoleType();
query.setRoleType(roleType);
return R.ok(crmBranchService.pageList(query));
+ }
+
+ /**
+ * 获取crm分公司管理管理列表
+ */
+ @ApiOperation(value = "获取crm分公司审核分页列表")
+ @PostMapping(value = "/pageAuditList")
+ public R<PageInfo<TCrmBranchVO>> pageAuditList(@RequestBody TCrmBranchAuditQuery query) {
+ return R.ok(crmBranchService.pageAuditList(query));
+ }
+
+ /**
+ * 获取crm分公司管理管理列表
+ */
+ @ApiOperation(value = "获取crm分公司解除绑定分页列表")
+ @PostMapping(value = "/pageUnbindList")
+ public R<PageInfo<TCrmBranchLiftVO>> pageUnbindList(@RequestBody TCrmBranchAuditQuery query) {
+ return R.ok(crmBranchService.pageUnbindList(query));
+ }
+
+ /**
+ * 获取crm分公司管理管理列表
+ */
+ @ApiOperation(value = "获取crm分公司省公司管理列表")
+ @PostMapping(value = "/listProvince")
+ public R<List<TCrmBranch>> listProvince() {
+ List<TCrmBranch> crmBranches = crmBranchService.list(Wrappers.lambdaQuery(TCrmBranch.class)
+ .eq(TCrmBranch::getPersonType, 1)
+ .eq(TCrmBranch::getStatus, 1)
+ .orderByDesc(TCrmBranch::getCreateTime));
+ return R.ok(crmBranches);
}
/**
@@ -301,11 +340,42 @@
}
}
+ @Log(title = "crm分公司管理信息-分公司审核信息导出", businessType = BusinessType.EXPORT)
+ @ApiOperation(value = "分公司审核信息导出")
+ @PostMapping("/exportAuditList")
+ public void exportAuditList(@RequestBody TCrmBranchAuditQuery query){
+ List<TCrmBranchAuditExport> crmBranchAuditExports = crmBranchService.exportAuditList(query);
+ Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TCrmBranchAuditExport.class, crmBranchAuditExports);
+ HttpServletResponse response = WebUtils.response();
+ assert response != null;
+ response.setContentType("application/vnd.ms-excel");
+ response.setCharacterEncoding("utf-8");
+ ServletOutputStream outputStream = null;
+ try {
+ String fileName = URLEncoder.encode("分公司审核信息.xls", "utf-8");
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+ response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+ response.setHeader("Pragma", "no-cache");
+ response.setHeader("Cache-Control", "no-cache");
+ outputStream = response.getOutputStream();
+ workbook.write(outputStream);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
/**
* 解除绑定
*/
- @ApiOperation(value = "crm分公司管理信息-解除绑定", notes = "clinicId:诊所id")
- @GetMapping(value = "/unbind")
+ @Log(title = "crm分公司管理信息-解除绑定", businessType = BusinessType.UPDATE)
+ @ApiOperation(value = "crm分公司管理信息-解除绑定")
+ @PostMapping(value = "/unbind")
public R<String> unbind(@RequestBody UnbindDTO dto) {
Long userId = tokenService.getLoginUser().getUserId();
TCrmBranch crmBranch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class)
@@ -324,5 +394,49 @@
return R.ok();
}
+ /**
+ * 分公司审核
+ */
+ @Log(title = "crm分公司管理信息-分公司审核", businessType = BusinessType.UPDATE)
+ @ApiOperation(value = "crm分公司管理信息-分公司审核")
+ @PostMapping(value = "/branchAudit")
+ public R<String> branchAudit(@RequestBody BranchAuditDTO dto) {
+ TCrmBranch crmBranch = crmBranchService.getById(dto.getId());
+ crmBranch.setAuditStatus(dto.getAuditStatus());
+ crmBranch.setAuditRemark(dto.getAuditRemark());
+ crmBranch.setAuditTime(LocalDateTime.now());
+ crmBranch.setMoneyCommission(dto.getMoneyCommission());
+ crmBranch.setPointsCommission(dto.getPointsCommission());
+ crmBranchService.updateById(crmBranch);
+ return R.ok();
+ }
+
+ /**
+ * 解绑处理
+ */
+ @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
+ @Log(title = "crm分公司管理信息-解绑处理", businessType = BusinessType.UPDATE)
+ @ApiOperation(value = "crm分公司管理信息-解绑处理")
+ @PostMapping(value = "/unbindProcessing")
+ public R<String> unbindProcessing(@RequestBody UnbindProcessingDTO dto) {
+ // 查询解绑信息
+ TCrmBranchLift crmBranchLift = crmBranchLiftService.getById(dto.getId());
+ if (Objects.isNull(crmBranchLift)){
+ return R.fail("未查询到该解绑信息");
+ }
+ crmBranchLift.setStatus(dto.getStatus());
+ crmBranchLift.setRemarks(dto.getRemarks());
+ crmBranchLiftService.updateById(crmBranchLift);
+ TCrmBranch crmBranch = crmBranchService.getById(crmBranchLift.getBranchId());
+ crmBranch.setPhone(crmBranchLift.getChargePhone());
+ crmBranchService.updateById(crmBranch);
+ // 查询分公司绑定的人员
+ SysUser sysUser = sysUserService.selectUserById(crmBranch.getUserId());
+ sysUser.setPhonenumber(crmBranchLift.getChargePhone());
+ sysUser.setUserName(crmBranchLift.getChargePhone());
+ sysUserService.updateUser(sysUser);
+ return R.ok();
+ }
+
}
--
Gitblit v1.7.1