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 | 86 +++++++++++++++++++++++++++++++++++++++---
1 files changed, 79 insertions(+), 7 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 ed74a5d..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
@@ -10,6 +10,7 @@
import com.matrix.component.tools.WxacodeUtil;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.pojo.BasePageQueryDto;
+import com.matrix.core.pojo.VerificationResult;
import com.matrix.core.tools.LogUtil;
import com.matrix.core.tools.MD5Util;
import com.matrix.core.tools.PropertiesUtil;
@@ -22,7 +23,10 @@
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;
import com.matrix.system.shopXcx.vo.SalesmanCenterInfo;
import com.matrix.system.shopXcx.vo.SalesmanVo;
import io.swagger.annotations.Api;
@@ -37,8 +41,11 @@
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;
+import java.util.stream.Collectors;
/**
* @author wzy
@@ -66,6 +73,10 @@
private BizUserDao bizUserDao;
@Autowired
WeChatApiTools weChatApiTools;
+
+ @Autowired
+ ShopProductDao shopProductDao;
+
@ApiOperation(value = "查询推广计划", notes = "")
@GetMapping(value = "/getTgPlan")
@@ -132,33 +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);
- 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("分销员不能被绑定");
}
+
+
+
+
}
@@ -249,6 +274,53 @@
return AjaxResult.buildSuccessInstance(salesmanCenterInfo);
}
+ @ApiOperation(value = "查询分销员申请条件", notes = "")
+ @PostMapping(value = "/getSalesmanApplyCondition")
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "ok", response = SalesmanApplyCondition.class)
+ })
+ AjaxResult getSalesmanApplyCondition() {
+ BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class);
+ VerificationResult ableToBeAnSalesman = shopSalesmanApplyService.isAbleToBeAnSalesman(loginUser.getOpenId(),loginUser.getCompanyId());
+ SalesmanApplyCondition applyConditionInfo=new SalesmanApplyCondition();
+ applyConditionInfo.setIsAbleApply(ableToBeAnSalesman.isJudgeResult());
+ applyConditionInfo.setMsg(ableToBeAnSalesman.getMsg());
+
+ //申请条件
+ BusParameterSettings applyCondition = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_APPLY_CONDITION, loginUser.getCompanyId());
+ switch (applyCondition.getParamValue()){
+ case FenxiaoSettingConstant.FX_APPLY_CONDITION_WTJ:
+ applyConditionInfo.setCondition("您已满足申请条件");
+ break;
+ case FenxiaoSettingConstant.FX_APPLY_CONDITION_XFZDCP:
+ applyConditionInfo.setCondition("消费指定产品并确认收货");
+ List<String> strings = StringUtils.strToColl(applyCondition.getParamValue1(), ",");
+ 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("消费任意产品并确认收货");
+ break;
+ case FenxiaoSettingConstant.FX_APPLY_CONDITION_XCZDJE:
+ Double zdje=Double.parseDouble(applyCondition.getParamValue2());
+ applyConditionInfo.setCondition("消费满"+zdje+"元确认收货");
+ applyConditionInfo.setMinAmount(zdje);
+ }
+
+ return AjaxResult.buildSuccessInstance(applyConditionInfo);
+ }
+
+
+
+
+
+
}
--
Gitblit v1.9.1