From 2c9c11076949c7739c633204a6b146448b16a4e1 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 25 Mar 2021 18:36:42 +0800
Subject: [PATCH] modify
---
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java | 39 ++++++++++++++++++++++++++++-----------
1 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
index 90d3e69..d2d94e3 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
@@ -40,6 +40,7 @@
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -141,33 +142,47 @@
}
- @ApiOperation(value = "绑定下级客户,当客户点击分销员分销的产品时调用", notes = "传入参数invitationId 必须 分销员openId 例: {invitationId:openId}")
+ @ApiOperation(value = "绑定下级客户,当客户点击分销员分销的产品时调用", notes = "传入参数invitationId 必须 分销员userId例: {invitationId:userId}")
@ApiResponses({
@ApiResponse(code = 200, message = "ok", response = Map.class)
})
@PostMapping(value = "/bindingParentSalesman")
public AjaxResult bindingParentSalesman(@RequestBody Map<String,String> param) {
String invitationId = param.get("invitationId");
+
+
if (StringUtils.isBlank(invitationId)) {
+ return AjaxResult.buildFailInstance("请求参数错误");
+ }
+ BizUser invitationUser = bizUserDao.selectById(Long.parseLong(invitationId));
+ if (invitationUser==null) {
return AjaxResult.buildFailInstance("请求参数错误");
}
BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class);
- loginUser = bizUserDao.selectById(loginUser.getUserId());
- if (loginUser.getIsSales() == null || loginUser.getIsSales() == BizUser.NOT_SALES) {
- if (StringUtils.isBlank(loginUser.getParentOpenId())) {
+ if(invitationId.equals(loginUser.getUserId())){
+ return AjaxResult.buildSuccessInstance("不能绑定自己");
+ }
+ loginUser = bizUserDao.selectById(loginUser.getUserId());
+ if(loginUser.getIsSales()==1){
+ return AjaxResult.buildSuccessInstance("只有非分销员才能被绑定成客户");
+ }else{
+ if (StringUtils.isBlank(loginUser.getParentOpenId())) {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("userId", loginUser.getUserId());
- updateParam.put("parentOpenId", invitationId);
+ updateParam.put("parentOpenId", invitationUser.getOpenId());
+ updateParam.put("bindingParentTime",new Date());
bizUserDao.updateByMap(updateParam);
return AjaxResult.buildSuccessInstance("绑定成功");
} else {
return AjaxResult.buildSuccessInstance("已经存在上级");
}
- } else {
- return AjaxResult.buildSuccessInstance("分销员不能被绑定");
}
+
+
+
+
}
@@ -274,18 +289,18 @@
BusParameterSettings applyCondition = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_APPLY_CONDITION, loginUser.getCompanyId());
switch (applyCondition.getParamValue()){
case FenxiaoSettingConstant.FX_APPLY_CONDITION_WTJ:
- applyConditionInfo.setCondition("无条件");
+ applyConditionInfo.setCondition("您已满足申请条件");
break;
case FenxiaoSettingConstant.FX_APPLY_CONDITION_XFZDCP:
- applyConditionInfo.setCondition("消费指定产品确认收货");
+ applyConditionInfo.setCondition("消费指定产品并确认收货");
List<String> strings = StringUtils.strToColl(applyCondition.getParamValue1(), ",");
applyConditionInfo.setProductList(
shopProductDao.selectByIds(
- strings.stream().map(i -> Integer.parseInt(i + "")).collect(Collectors.toList())));
+ strings.stream().filter(i->StringUtils.isNotBlank(i)).map(i -> Integer.parseInt(i + "")).distinct().collect(Collectors.toList())));
break;
case FenxiaoSettingConstant.FX_APPLY_CONDITION_XFRYCP:
//判断用户是否有确认收货的产品
- applyConditionInfo.setCondition("消费任意产品确认收货");
+ applyConditionInfo.setCondition("消费任意产品并确认收货");
break;
case FenxiaoSettingConstant.FX_APPLY_CONDITION_XCZDJE:
Double zdje=Double.parseDouble(applyCondition.getParamValue2());
@@ -301,4 +316,6 @@
+
+
}
--
Gitblit v1.9.1