From dd0833ef33804b7cf085b8c3c005e5788a3617d6 Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Mon, 22 Mar 2021 17:10:38 +0800
Subject: [PATCH] 积分商城16
---
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java | 51 ++++++++++++++++++++++++++++++++-------------------
1 files changed, 32 insertions(+), 19 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 a24b205..7e81a21 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
@@ -23,6 +23,7 @@
import com.matrix.system.fenxiao.dao.ShopSalesmanApplyDao;
import com.matrix.system.fenxiao.entity.ShopSalesmanApply;
import com.matrix.system.fenxiao.service.ShopSalesmanApplyService;
+import com.matrix.system.hive.plugin.util.CollectionUtils;
import com.matrix.system.shopXcx.api.WeChatApiTools;
import com.matrix.system.shopXcx.dao.ShopProductDao;
import com.matrix.system.shopXcx.vo.SalesmanApplyCondition;
@@ -40,6 +41,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,40 +143,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);
- if(invitationId.equals(loginUser.getOpenId())){
- return AjaxResult.buildFailInstance("不能绑定自己");
+ if(invitationId.equals(loginUser.getUserId())){
+ return AjaxResult.buildSuccessInstance("不能绑定自己");
}
- if(loginUser.getIsSales()==null || loginUser.getIsSales()==2){
- return AjaxResult.buildFailInstance("只有分销员才能绑定客户");
- }
- loginUser = bizUserDao.selectById(loginUser.getUserId());
- if (loginUser.getIsSales() == null || loginUser.getIsSales() == BizUser.NOT_SALES) {
- if (StringUtils.isBlank(loginUser.getParentOpenId())) {
+ 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("分销员不能被绑定");
}
+
+
+
+
}
@@ -281,18 +290,22 @@
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())));
+ List<Integer> ids = strings.stream().filter(i -> StringUtils.isNotBlank(i)).map(i -> Integer.parseInt(i + "")).distinct().collect(Collectors.toList());
+ if(CollectionUtils.isNotEmpty(ids)){
+ applyConditionInfo.setProductList(shopProductDao.selectByIds(ids));
+ }else{
+ return AjaxResult.buildFailInstance("未配置消费产品,请联系管理员");
+ }
+
break;
case FenxiaoSettingConstant.FX_APPLY_CONDITION_XFRYCP:
//判断用户是否有确认收货的产品
- applyConditionInfo.setCondition("消费任意产品确认收货");
+ applyConditionInfo.setCondition("消费任意产品并确认收货");
break;
case FenxiaoSettingConstant.FX_APPLY_CONDITION_XCZDJE:
Double zdje=Double.parseDouble(applyCondition.getParamValue2());
--
Gitblit v1.9.1