From 7b15b7791474b8b05b7cd31c691efe714da97376 Mon Sep 17 00:00:00 2001 From: jyy <935090232@qq.com> Date: Wed, 10 Mar 2021 18:53:43 +0800 Subject: [PATCH] 新增申请成为分销员接口 --- zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java | 79 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 72 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 c9d726e..e3ce8f6 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 @@ -1,11 +1,24 @@ package com.matrix.system.shopXcx.api.action; +import com.matrix.biz.bean.BizUser; +import com.matrix.component.redis.RedisUserLoginUtils; import com.matrix.core.pojo.AjaxResult; +import com.matrix.core.tools.StringUtils; +import com.matrix.system.common.bean.BusParameterSettings; +import com.matrix.system.common.dao.BusParameterSettingsDao; +import com.matrix.system.common.interceptor.HostInterceptor; +import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant; +import com.matrix.system.fenxiao.dao.ShopSalesmanApplyDao; +import com.matrix.system.fenxiao.entity.ShopSalesmanApply; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; +import java.util.Map; /** * @author wzy @@ -16,9 +29,61 @@ @RequestMapping(value = "/wxapi/salesman") public class WxSalesmanAction { - @ApiOperation(value = "测试接口", notes = "测试接口") - @GetMapping(value = "/test") - public AjaxResult test() { - return null; + @Autowired + BusParameterSettingsDao busParameterSettingsDao; + + @Autowired + ShopSalesmanApplyDao salesmanApplyDao; + + @Autowired + private RedisUserLoginUtils redisUserLoginUtils; + + @ApiOperation(value = "查询推广计划", notes = "") + @GetMapping(value = "/getTgPlan") + public AjaxResult getTgPlan() { + BusParameterSettings busParameterSettings = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_TG_PLAN, HostInterceptor.getCompanyId()); + AjaxResult ajaxResult = AjaxResult.buildSuccessInstance(""); + ajaxResult.putInMap("tgjh",busParameterSettings.getParamValue3()); + return ajaxResult; } + + + @ApiOperation(value = "申请成为推广员", notes = "传入参数invitationId 邀请人openId 如: {invitationId:openId}") + @ApiResponses({ + @ApiResponse(code = 200, message = "ok", response = Map.class) + }) + @PostMapping(value = "/applyToBeAnSalesman") + public AjaxResult applyToBeAnSalesman(@RequestBody Map<String,String> param) { + BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); + ShopSalesmanApply shopSalesmanApply=new ShopSalesmanApply(); + shopSalesmanApply.setUserId(loginUser.getUserId()); + shopSalesmanApply.setCreateBy(loginUser.getNickName()); + shopSalesmanApply.setApplyWay(ShopSalesmanApply.APPLY_WAY_SELF); + shopSalesmanApply.setApplyStatus(ShopSalesmanApply.APPLY_STATUS_DSH); + shopSalesmanApply.setCompanyId(loginUser.getCompanyId()); + shopSalesmanApply.setUpdateBy(loginUser.getNickName()); + Date date = new Date(); + shopSalesmanApply.setCreateTime(date); + shopSalesmanApply.setUpdateTime(date); + String invitationId = param.get("invitationId"); + if(StringUtils.isNotBlank(invitationId)){ + shopSalesmanApply.setParentUserId(invitationId); + } + salesmanApplyDao.insert(shopSalesmanApply); + return AjaxResult.buildSuccessInstance("申请成功"); + } + + + + + + + + + + + + + + } -- Gitblit v1.9.1