Bläddra i källkod

增加客户无需审批参数配置、小程序用户提交时根据参数自动判断通过

liyuan 11 timmar sedan
förälder
incheckning
3d6b8affb8

+ 106 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjpfCustomerReviewedParam.java

@@ -0,0 +1,106 @@
+package org.springblade.salesPart.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 客户审核参数实体类
+ * @author Rain
+ */
+@Data
+@TableName("pjpf_customer_reviewed_param")
+public class PjpfCustomerReviewedParam {
+
+	/**
+	 * 主键ID,bigint(20),自增
+	 */
+	private Long id;
+
+	/**
+	 * 租户ID,varchar(10),标识所属租户
+	 */
+	@TableField("tenant_id")
+	private String tenantId;
+
+	/**
+	 * 价格类型,varchar(10),如:固定价、浮动价等
+	 */
+	@TableField("price_type")
+	private String priceType;
+
+	/**
+	 * 仓库ID,bigint(20),关联仓库表
+	 */
+	@TableField("warehouse_id")
+	private Long warehouseId;
+
+	/**
+	 * 仓库名称,varchar(50),用于展示
+	 */
+	@TableField("warehouse_name")
+	private String warehouseName;
+
+	/**
+	 * 业务员ID,bigint(20),关联用户表
+	 */
+	@TableField("sales_man")
+	private Long salesMan;
+
+	/**
+	 * 业务员名称,varchar(50),用于展示
+	 */
+	@TableField("sales_man_name")
+	private String salesManName;
+
+	/**
+	 * 创建人ID,bigint(64),记录创建者
+	 */
+	@TableField("create_user")
+	private Long createUser;
+
+	/**
+	 * 客户类型
+	 */
+	@TableField("corps_type_id")
+	private Long corpsTypeId;
+
+	/**
+	 * 创建部门ID,bigint(64),记录创建部门
+	 */
+	@TableField("create_dept")
+	private Long createDept;
+
+	/**
+	 * 创建时间,datetime,记录创建时间
+	 */
+	@TableField("create_time")
+	private Date createTime;
+
+	/**
+	 * 更新人ID,bigint(64),记录最后修改人
+	 */
+	@TableField("update_user")
+	private Long updateUser;
+
+	/**
+	 * 更新时间,datetime,记录最后更新时间
+	 */
+	@TableField("update_time")
+	private Date updateTime;
+
+	/**
+	 * 是否删除标记,smallint(6);0-未删除,1-已删除(逻辑删除)
+	 */
+	@TableLogic
+	@TableField("is_deleted")
+	private Integer isDeleted;
+
+	/**
+	 * 版本号,int(10),用于乐观锁控制
+	 */
+	@Version
+	@TableField("version")
+	private Integer version;
+}

+ 11 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/controller/CorpsDescController.java

@@ -742,4 +742,15 @@ public class CorpsDescController extends BladeController {
 		return corpsDescService.importBrand(excelList);
 		return corpsDescService.importBrand(excelList);
 	}
 	}
 
 
+	@PostMapping("/getCustomerReviewedParam")
+	public R getCustomerReviewedParam() {
+		return R.data(corpsDescService.getCustomerReviewedParam());
+	}
+
+
+	@PostMapping("/submitCustomerReviewedParam")
+	public R submitCustomerReviewedParam(@RequestBody PjpfCustomerReviewedParam param) {
+		return corpsDescService.submitCustomerReviewedParam(param);
+	}
+
 }
 }

+ 11 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/mapper/CustomerReviewedParamMapper.java

@@ -0,0 +1,11 @@
+package org.springblade.salesPart.corps.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springblade.salesPart.entity.PjpfCustomerReviewedParam;
+
+/**
+ * @author Rain
+ */
+public interface CustomerReviewedParamMapper extends BaseMapper<PjpfCustomerReviewedParam> {
+
+}

+ 8 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/mapper/CustomerReviewedParamMapper.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--suppress ALL -->
+<mapper namespace="org.springblade.salesPart.corps.mapper.CustomerReviewedParamMapper">
+
+
+
+</mapper>

+ 16 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/service/ICorpsDescService.java

@@ -22,6 +22,7 @@ import org.apache.ibatis.annotations.Param;
 import org.springblade.client.entity.CorpsDesc;
 import org.springblade.client.entity.CorpsDesc;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.api.R;
 import org.springblade.salesPart.entity.PjCorpsDesc;
 import org.springblade.salesPart.entity.PjCorpsDesc;
+import org.springblade.salesPart.entity.PjpfCustomerReviewedParam;
 import org.springblade.salesPart.excel.CorpsDescImportExcel;
 import org.springblade.salesPart.excel.CorpsDescImportExcel;
 import org.springblade.salesPart.excel.CorpsImportBrandExcel;
 import org.springblade.salesPart.excel.CorpsImportBrandExcel;
 import org.springblade.salesPart.excel.SupplierImportExcel;
 import org.springblade.salesPart.excel.SupplierImportExcel;
@@ -130,4 +131,19 @@ public interface ICorpsDescService extends IService<PjCorpsDesc> {
 	IPage<PjCorpsDesc> appCustomerAnalysis(IPage<PjCorpsDesc> page, PjCorpsDesc corpsDescDto);
 	IPage<PjCorpsDesc> appCustomerAnalysis(IPage<PjCorpsDesc> page, PjCorpsDesc corpsDescDto);
 
 
 	PjCorpsDesc appCustomerAnalysisDetail(Long id);
 	PjCorpsDesc appCustomerAnalysisDetail(Long id);
+
+	/**
+	 * 保存默认客户提交参数
+	 *
+	 * @param param 数据
+	 * @return 结果
+	 */
+    R submitCustomerReviewedParam(PjpfCustomerReviewedParam param);
+
+	/**
+	 * 获取默认客户提交参数
+	 *
+	 * @return 默认客户提交参数
+	 */
+	PjpfCustomerReviewedParam getCustomerReviewedParam();
 }
 }

+ 79 - 86
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/service/impl/CorpsDescServiceImpl.java

@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
+import org.springblade.common.enums.CommonEnum;
+import org.springblade.common.enums.NumberEnum;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.secure.utils.SecureUtil;
@@ -18,6 +20,7 @@ import org.springblade.salesPart.brand.service.IBrandDescService;
 import org.springblade.salesPart.corps.mapper.CorpsDescMapper;
 import org.springblade.salesPart.corps.mapper.CorpsDescMapper;
 import org.springblade.salesPart.corps.mapper.CorpsTypeDescMapper;
 import org.springblade.salesPart.corps.mapper.CorpsTypeDescMapper;
 import org.springblade.salesPart.corps.mapper.CorpsTypeMapper;
 import org.springblade.salesPart.corps.mapper.CorpsTypeMapper;
+import org.springblade.salesPart.corps.mapper.CustomerReviewedParamMapper;
 import org.springblade.salesPart.corps.service.ICorpsDescService;
 import org.springblade.salesPart.corps.service.ICorpsDescService;
 import org.springblade.salesPart.corps.service.ICorpsVisitService;
 import org.springblade.salesPart.corps.service.ICorpsVisitService;
 import org.springblade.salesPart.entity.*;
 import org.springblade.salesPart.entity.*;
@@ -68,6 +71,8 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 
 
 	private final OrderMapper orderMapper;
 	private final OrderMapper orderMapper;
 
 
+	private final CustomerReviewedParamMapper customerReviewedParamMapper;
+
 	static final int GB_SP_DIFF = 160;
 	static final int GB_SP_DIFF = 160;
 	// 存放国标一级汉字不同读音的起始区位码
 	// 存放国标一级汉字不同读音的起始区位码
 	static final int[] secPosValueList = {1601, 1637, 1833, 2078, 2274, 2302, 2433, 2594, 2787, 3106, 3212, 3472, 3635,
 	static final int[] secPosValueList = {1601, 1637, 1833, 2078, 2274, 2302, 2433, 2594, 2787, 3106, 3212, 3472, 3635,
@@ -1243,6 +1248,31 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 		return corpsDesc;
 		return corpsDesc;
 	}
 	}
 
 
+	@Override
+	public R submitCustomerReviewedParam(PjpfCustomerReviewedParam param) {
+		BladeUser nowUser = AuthUtil.getUser();
+		Date nowDate = new Date();
+		if (Objects.isNull(param.getId())) {
+			param.setTenantId(nowUser.getTenantId());
+			param.setCreateUser(nowUser.getUserId());
+			param.setCreateTime(nowDate);
+			int insertCount = customerReviewedParamMapper.insert(param);
+			return R.status(insertCount > 0);
+		}
+		param.setUpdateTime(nowDate);
+		param.setUpdateUser(nowUser.getUserId());
+		param.setVersion(param.getVersion() + 1);
+		int updateCount = customerReviewedParamMapper.update(param, new LambdaQueryWrapper<PjpfCustomerReviewedParam>()
+			.eq(PjpfCustomerReviewedParam::getId, param.getId()).eq(PjpfCustomerReviewedParam::getTenantId, nowUser.getTenantId()));
+		return R.status(updateCount > 0);
+	}
+
+	@Override
+	public PjpfCustomerReviewedParam getCustomerReviewedParam() {
+		return customerReviewedParamMapper.selectOne(new LambdaQueryWrapper<PjpfCustomerReviewedParam>()
+			.eq(PjpfCustomerReviewedParam::getTenantId, AuthUtil.getTenantId()).orderByDesc(PjpfCustomerReviewedParam::getCreateTime).last("limit 1"));
+	}
+
 	/**
 	/**
 	 * 小程序新增或修改 客户详情
 	 * 小程序新增或修改 客户详情
 	 *
 	 *
@@ -1252,36 +1282,36 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 	@Override
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	@Transactional(rollbackFor = Exception.class)
 	public R saveCorpsDesc(PjCorpsDesc corpsDesc) {
 	public R saveCorpsDesc(PjCorpsDesc corpsDesc) {
+		if (StringUtils.isBlank(corpsDesc.getCname())) {
+			return R.fail("客户名称不能为空");
+		}
+		BladeUser nowUser = AuthUtil.getUser();
 		Long userId = SecureUtil.getUserId();
 		Long userId = SecureUtil.getUserId();
-		Long deptId = Long.valueOf(AuthUtil.getDeptId());
+		Long deptId = Long.valueOf(nowUser.getDeptId());
 		Date date = new Date();
 		Date date = new Date();
-		if (null == corpsDesc.getInitials() || "".equals(corpsDesc.getInitials())) {//首字母为空
+		R<Dept> resDept = sysClient.getDept(deptId);
+		if (!resDept.isSuccess() || ObjectUtils.isNull(resDept.getData())) {
+			return R.fail("未找到小程序相关信息,请退出后重试");
+		}
+		String deptName = resDept.getData().getFullName();
+		if (null == corpsDesc.getInitials() || corpsDesc.getInitials().isEmpty()) {
 			//获得名称首字母
 			//获得名称首字母
 			String initials = getSpells(corpsDesc.getCname());
 			String initials = getSpells(corpsDesc.getCname());
 			corpsDesc.setInitials(initials.substring(0, 1));
 			corpsDesc.setInitials(initials.substring(0, 1));
 		}
 		}
-		R<Dept> resDept = sysClient.getDept(Long.parseLong(AuthUtil.getDeptId()));
-		if (!resDept.isSuccess() || ObjectUtils.isNull(resDept.getData())) {
-			throw new RuntimeException("未找到小程序id");
-		}
-		String deptName = resDept.getData().getFullName();
 		//保存客户信息
 		//保存客户信息
 		corpsDesc.setCorpType("KH");
 		corpsDesc.setCorpType("KH");
-		if (StringUtils.isBlank(corpsDesc.getCname())) {
-			return R.data(200, "error", "客户名称不能为空");
-		}
-
-		PjCorpsDesc pjCorpsDesc = baseMapper.selectCorpsDescCname(corpsDesc.getCname(), AuthUtil.getDeptId(), AuthUtil.getTenantId());
+		PjCorpsDesc pjCorpsDesc = baseMapper.selectCorpsDescCname(corpsDesc.getCname(), nowUser.getDeptId(), nowUser.getTenantId());
 		if (ObjectUtils.isNotNull(pjCorpsDesc)) {
 		if (ObjectUtils.isNotNull(pjCorpsDesc)) {
 			pjCorpsDesc.setSalesCompanyId(deptId);
 			pjCorpsDesc.setSalesCompanyId(deptId);
 			pjCorpsDesc.setSalesCompanyName(deptName);
 			pjCorpsDesc.setSalesCompanyName(deptName);
 			baseMapper.updateById(pjCorpsDesc);
 			baseMapper.updateById(pjCorpsDesc);
 			List<PjCorpsAttn> corpsAttnList = corpsAttnService.list(new LambdaQueryWrapper<PjCorpsAttn>()
 			List<PjCorpsAttn> corpsAttnList = corpsAttnService.list(new LambdaQueryWrapper<PjCorpsAttn>()
 				.eq(PjCorpsAttn::getIsDeleted, 0)
 				.eq(PjCorpsAttn::getIsDeleted, 0)
-				.eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
+				.eq(PjCorpsAttn::getTenantId, nowUser.getTenantId())
 				.eq(PjCorpsAttn::getTel, corpsDesc.getTel()));
 				.eq(PjCorpsAttn::getTel, corpsDesc.getTel()));
 			PjCorpsAttn corpsAttn = corpsAttnService.getOne(new LambdaQueryWrapper<PjCorpsAttn>().eq(PjCorpsAttn::getIsDeleted, 0)
 			PjCorpsAttn corpsAttn = corpsAttnService.getOne(new LambdaQueryWrapper<PjCorpsAttn>().eq(PjCorpsAttn::getIsDeleted, 0)
-				.eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
+				.eq(PjCorpsAttn::getTenantId, nowUser.getTenantId())
 				.eq(PjCorpsAttn::getPid, pjCorpsDesc.getId())
 				.eq(PjCorpsAttn::getPid, pjCorpsDesc.getId())
 				.eq(PjCorpsAttn::getTel, corpsDesc.getTel())
 				.eq(PjCorpsAttn::getTel, corpsDesc.getTel())
 			);
 			);
@@ -1306,24 +1336,24 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 				}
 				}
 				//保存客户联系人信息
 				//保存客户联系人信息
 				PjCorpsAttn corpsAttn1 = new PjCorpsAttn();
 				PjCorpsAttn corpsAttn1 = new PjCorpsAttn();
-				User user = userClient.loginByAccount("", corpsDesc.getTel(), "4", AuthUtil.getTenantId(), resDept.getData().getAppletsId());
+				User user = userClient.loginByAccount("", corpsDesc.getTel(), "4", nowUser.getTenantId(), resDept.getData().getAppletsId());
 				if (ObjectUtils.isNotNull(user)) {
 				if (ObjectUtils.isNotNull(user)) {
 					corpsAttn1.setUserId(user.getId());
 					corpsAttn1.setUserId(user.getId());
 					userClient.updateUserStorageId(user.getId() + "", pjCorpsDesc.getDeliveryWarehouseId(), pjCorpsDesc.getDeliveryWarehouseName());
 					userClient.updateUserStorageId(user.getId() + "", pjCorpsDesc.getDeliveryWarehouseId(), pjCorpsDesc.getDeliveryWarehouseName());
 				}
 				}
 				corpsAttn1.setCname(corpsDesc.getAttn());
 				corpsAttn1.setCname(corpsDesc.getAttn());
 				corpsAttn1.setTel(corpsDesc.getTel());
 				corpsAttn1.setTel(corpsDesc.getTel());
-				corpsAttn1.setTenantId(AuthUtil.getTenantId());
+				corpsAttn1.setTenantId(nowUser.getTenantId());
 				corpsAttn1.setPid(pjCorpsDesc.getId());
 				corpsAttn1.setPid(pjCorpsDesc.getId());
 				corpsAttn1.setCreateTime(new Date());
 				corpsAttn1.setCreateTime(new Date());
-				corpsAttn1.setCreateUser(AuthUtil.getUserId());
+				corpsAttn1.setCreateUser(nowUser.getUserId());
 				corpsAttn1.setSalesCompanyId(deptId);
 				corpsAttn1.setSalesCompanyId(deptId);
 				corpsAttn1.setSalesCompanyName(deptName);
 				corpsAttn1.setSalesCompanyName(deptName);
 				corpsAttnService.save(corpsAttn1);
 				corpsAttnService.save(corpsAttn1);
 			}
 			}
 
 
 			PjCorpsAddr corpsAddr = corpsAddrService.getOne(new LambdaQueryWrapper<PjCorpsAddr>().eq(PjCorpsAddr::getIsDeleted, 0)
 			PjCorpsAddr corpsAddr = corpsAddrService.getOne(new LambdaQueryWrapper<PjCorpsAddr>().eq(PjCorpsAddr::getIsDeleted, 0)
-				.eq(PjCorpsAddr::getTenantId, AuthUtil.getTenantId())
+				.eq(PjCorpsAddr::getTenantId, nowUser.getTenantId())
 				.eq(PjCorpsAddr::getPid, pjCorpsDesc.getId())
 				.eq(PjCorpsAddr::getPid, pjCorpsDesc.getId())
 				.eq(PjCorpsAddr::getTel, corpsDesc.getTel()));
 				.eq(PjCorpsAddr::getTel, corpsDesc.getTel()));
 			if (ObjectUtils.isNotNull(corpsAddr)) {
 			if (ObjectUtils.isNotNull(corpsAddr)) {
@@ -1341,11 +1371,11 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 				corpsAddr1.setTel(corpsDesc.getTel());
 				corpsAddr1.setTel(corpsDesc.getTel());
 				corpsAddr1.setBelongtoarea(corpsDesc.getAddr());
 				corpsAddr1.setBelongtoarea(corpsDesc.getAddr());
 				corpsAddr1.setDetailedAddress(corpsDesc.getDetails());
 				corpsAddr1.setDetailedAddress(corpsDesc.getDetails());
-				corpsAddr1.setTenantId(AuthUtil.getTenantId());
+				corpsAddr1.setTenantId(nowUser.getTenantId());
 				corpsAddr1.setPid(pjCorpsDesc.getId());
 				corpsAddr1.setPid(pjCorpsDesc.getId());
 				corpsAddr1.setCreateTime(new Date());
 				corpsAddr1.setCreateTime(new Date());
-				corpsAddr1.setTenantId(AuthUtil.getTenantId());
-				corpsAddr1.setCreateUser(AuthUtil.getUserId());
+				corpsAddr1.setTenantId(nowUser.getTenantId());
+				corpsAddr1.setCreateUser(nowUser.getUserId());
 				corpsAddr1.setSalesCompanyId(deptId);
 				corpsAddr1.setSalesCompanyId(deptId);
 				corpsAddr1.setSalesCompanyName(deptName);
 				corpsAddr1.setSalesCompanyName(deptName);
 				corpsAddr1.setDefaultAddres("0");
 				corpsAddr1.setDefaultAddres("0");
@@ -1353,11 +1383,26 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 			}
 			}
 		} else {
 		} else {
 			if (null == corpsDesc.getId()) {
 			if (null == corpsDesc.getId()) {
-				corpsDesc.setTenantId(SecureUtil.getTenantId());
-				corpsDesc.setCreateDept(Long.valueOf(SecureUtil.getDeptId()));
+				String customerNotReviewedParam =  sysClient.getParamService("customer_not_reviewed");
+				if (Objects.equals(CommonEnum.ONE.info, customerNotReviewedParam)) {
+					PjpfCustomerReviewedParam pjpfCustomerReviewedParam = customerReviewedParamMapper.selectOne(new LambdaQueryWrapper<PjpfCustomerReviewedParam>()
+						.eq(PjpfCustomerReviewedParam::getTenantId, nowUser.getTenantId()).eq(PjpfCustomerReviewedParam::getIsDeleted, 0)
+						.orderByDesc(PjpfCustomerReviewedParam::getCreateTime).last(" limit 1"));
+					if (ObjectUtils.isNotNull(pjpfCustomerReviewedParam)) {
+						corpsDesc.setDeliveryWarehouseId(pjpfCustomerReviewedParam.getWarehouseId());
+						corpsDesc.setDeliveryWarehouseName(pjpfCustomerReviewedParam.getWarehouseName());
+						corpsDesc.setPriceSystem(pjpfCustomerReviewedParam.getPriceType());
+						corpsDesc.setSalesmanId(pjpfCustomerReviewedParam.getSalesMan());
+						corpsDesc.setSalesmanName(pjpfCustomerReviewedParam.getSalesManName());
+						corpsDesc.setCheckStatus("通过");
+						corpsDesc.setEnableOrNot(NumberEnum.ONE.number);
+					}
+				}
+				corpsDesc.setTenantId(nowUser.getTenantId());
+				corpsDesc.setCreateDept(deptId);
 				corpsDesc.setCreateTime(date);
 				corpsDesc.setCreateTime(date);
 				corpsDesc.setCreateUser(userId);
 				corpsDesc.setCreateUser(userId);
-				corpsDesc.setPriceSystem("售价1");
+				corpsDesc.setPriceSystem(StringUtils.isNotBlank(corpsDesc.getPriceSystem()) ? corpsDesc.getPriceSystem() : "售价1");
 				corpsDesc.setSalesCompanyId(deptId);
 				corpsDesc.setSalesCompanyId(deptId);
 				corpsDesc.setSalesCompanyName(deptName);
 				corpsDesc.setSalesCompanyName(deptName);
 				baseMapper.insert(corpsDesc);
 				baseMapper.insert(corpsDesc);
@@ -1368,7 +1413,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 				PjCorpsAttn corpsAttn = new PjCorpsAttn();
 				PjCorpsAttn corpsAttn = new PjCorpsAttn();
 				List<PjCorpsAttn> corpsAttnList = corpsAttnService.list(new LambdaQueryWrapper<PjCorpsAttn>()
 				List<PjCorpsAttn> corpsAttnList = corpsAttnService.list(new LambdaQueryWrapper<PjCorpsAttn>()
 					.eq(PjCorpsAttn::getTel, corpsDesc.getTel())
 					.eq(PjCorpsAttn::getTel, corpsDesc.getTel())
-					.eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
+					.eq(PjCorpsAttn::getTenantId, nowUser.getTenantId())
 					.eq(PjCorpsAttn::getIsDeleted, 0));
 					.eq(PjCorpsAttn::getIsDeleted, 0));
 				if (!corpsAttnList.isEmpty()) {
 				if (!corpsAttnList.isEmpty()) {
 					PjCorpsDesc pjCorpsDesc1 = baseMapper.selectById(corpsAttnList.get(0).getPid());
 					PjCorpsDesc pjCorpsDesc1 = baseMapper.selectById(corpsAttnList.get(0).getPid());
@@ -1378,12 +1423,12 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 						throw new RuntimeException("该手机号未查到客户信息");
 						throw new RuntimeException("该手机号未查到客户信息");
 					}
 					}
 				}
 				}
-				User user = userClient.loginByAccount("", corpsDesc.getTel(), "4", AuthUtil.getTenantId(), resDept.getData().getAppletsId());
+				User user = userClient.loginByAccount("", corpsDesc.getTel(), "4", nowUser.getTenantId(), resDept.getData().getAppletsId());
 				if (ObjectUtils.isNotNull(user)) {
 				if (ObjectUtils.isNotNull(user)) {
 					long count = corpsAttnService.count(new LambdaQueryWrapper<PjCorpsAttn>()
 					long count = corpsAttnService.count(new LambdaQueryWrapper<PjCorpsAttn>()
 						.eq(PjCorpsAttn::getUserId, user.getId())
 						.eq(PjCorpsAttn::getUserId, user.getId())
 						.eq(PjCorpsAttn::getTel, corpsDesc.getTel())
 						.eq(PjCorpsAttn::getTel, corpsDesc.getTel())
-						.eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
+						.eq(PjCorpsAttn::getTenantId, nowUser.getTenantId())
 						.eq(PjCorpsAttn::getIsDeleted, 0));
 						.eq(PjCorpsAttn::getIsDeleted, 0));
 					if (count > 0) {
 					if (count > 0) {
 						throw new RuntimeException("手机号已存在,提交失败");
 						throw new RuntimeException("手机号已存在,提交失败");
@@ -1393,11 +1438,11 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 				}
 				}
 				corpsAttn.setCname(corpsDesc.getAttn());
 				corpsAttn.setCname(corpsDesc.getAttn());
 				corpsAttn.setTel(corpsDesc.getTel());
 				corpsAttn.setTel(corpsDesc.getTel());
-				corpsAttn.setTenantId(AuthUtil.getTenantId());
+				corpsAttn.setTenantId(nowUser.getTenantId());
 				corpsAttn.setPid(corpsDesc.getId());
 				corpsAttn.setPid(corpsDesc.getId());
 				corpsAttn.setCreateTime(new Date());
 				corpsAttn.setCreateTime(new Date());
-				corpsAttn.setTenantId(AuthUtil.getTenantId());
-				corpsAttn.setCreateUser(AuthUtil.getUserId());
+				// corpsAttn.setTenantId(nowUser.getTenantId());
+				corpsAttn.setCreateUser(nowUser.getUserId());
 				corpsAttn.setSalesCompanyId(deptId);
 				corpsAttn.setSalesCompanyId(deptId);
 				corpsAttn.setSalesCompanyName(deptName);
 				corpsAttn.setSalesCompanyName(deptName);
 				corpsAttnService.save(corpsAttn);
 				corpsAttnService.save(corpsAttn);
@@ -1408,73 +1453,21 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 				corpsAddr.setTel(corpsDesc.getTel());
 				corpsAddr.setTel(corpsDesc.getTel());
 				corpsAddr.setBelongtoarea(corpsDesc.getAddr());
 				corpsAddr.setBelongtoarea(corpsDesc.getAddr());
 				corpsAddr.setDetailedAddress(corpsDesc.getDetails());
 				corpsAddr.setDetailedAddress(corpsDesc.getDetails());
-				corpsAddr.setTenantId(AuthUtil.getTenantId());
+				corpsAddr.setTenantId(nowUser.getTenantId());
 				corpsAddr.setPid(corpsDesc.getId());
 				corpsAddr.setPid(corpsDesc.getId());
 				corpsAddr.setCreateTime(new Date());
 				corpsAddr.setCreateTime(new Date());
-				corpsAddr.setTenantId(AuthUtil.getTenantId());
-				corpsAddr.setCreateUser(AuthUtil.getUserId());
+				//corpsAddr.setTenantId(nowUser.getTenantId());
+				corpsAddr.setCreateUser(nowUser.getUserId());
 				corpsAddr.setDefaultAddres("1");
 				corpsAddr.setDefaultAddres("1");
 				corpsAddrService.save(corpsAddr);
 				corpsAddrService.save(corpsAddr);
 				//保存客户与类别对应关系
 				//保存客户与类别对应关系
 				this.saveOrUpdateTypeDesc(corpsDesc, userId, pId, date, tenantId);
 				this.saveOrUpdateTypeDesc(corpsDesc, userId, pId, date, tenantId);
 			} else {
 			} else {
 				corpsDesc.setUpdateTime(new Date());
 				corpsDesc.setUpdateTime(new Date());
-				corpsDesc.setUpdateUser(AuthUtil.getUserId());
+				corpsDesc.setUpdateUser(nowUser.getUserId());
 				baseMapper.updateById(corpsDesc);
 				baseMapper.updateById(corpsDesc);
 			}
 			}
 		}
 		}
-		/*PjShip item = new PjShip();
-		//给角色为财务的人发送消息
-		R<String> clientDeptIds = sysClient.getRoleIds(AuthUtil.getTenantId(), "客服");
-		StringBuilder openIds = new StringBuilder();
-		if (clientDeptIds.isSuccess() && StringUtils.isNotBlank(clientDeptIds.getData())) {
-			R<List<User>> userList = userClient.listUserByRoleId(clientDeptIds.getData(), AuthUtil.getTenantId(), AuthUtil.getDeptId());
-			if (userList.isSuccess() && CollectionUtils.isNotEmpty(userList.getData())) {
-				for (User datum : userList.getData()) {
-					if (ObjectUtils.isNotNull(datum.getOaOpenId())) {
-						openIds.append(datum.getOaOpenId()).append(",");
-					}
-				}
-			}
-		}
-		SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
-		String date1 = format.format(new Date());
-		System.out.println("=========发送人openIds=========" + openIds);
-		if (ObjectUtils.isNotNull(openIds)) {
-			R<List<WechatMessageConfigurationItem>> res = wechatClient.getTemplateType("1", AuthUtil.getTenantId());
-			if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
-				item.setDate(date1);
-				item.setGoodsNames("商品json");
-				item.setCustomerName("客户名称");
-				item.setBillno("13456");
-				List<WxMpTemplateData> data = new ArrayList<>();
-				for (WechatMessageConfigurationItem items : res.getData()) {
-					try {
-						// 根据方法名获取对应的Method对象
-						Method method = item.getClass().getMethod(items.getMethod());
-						// 调用get方法并打印结果
-						Object result = method.invoke(item);
-						System.out.println(result);
-						if (ObjectUtils.isNotNull(result)) {
-							data.add(new WxMpTemplateData(items.getDataValue(), result.toString()));
-						} else {
-							data.add(new WxMpTemplateData(items.getDataValue(), "无"));
-						}
-					} catch (Exception e) {
-						e.printStackTrace();
-					}
-				}
-				if (!data.isEmpty()) {
-					WxMpTemplateDto wxMpTemplateDto = new WxMpTemplateDto();
-					wxMpTemplateDto.setOpenid(openIds.substring(0, openIds.length() - 1));
-					wxMpTemplateDto.setTenantId(AuthUtil.getTenantId());
-					wxMpTemplateDto.setType("1");
-					wxMpTemplateDto.setData(data);
-					String rest = wechatClient.sendMessageNew(wxMpTemplateDto);
-					System.out.println("=========发送返回值=========" + rest);
-				}
-			}
-		}*/
 		return R.data(corpsDesc);
 		return R.data(corpsDesc);
 	}
 	}