From 5857fd14f4608ace25724ba6386d72d210e20870 Mon Sep 17 00:00:00 2001 From: jyy <935090232@qq.com> Date: Thu, 25 Mar 2021 10:27:47 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/score_shop' into score_shop --- zq-erp/src/main/java/com/matrix/system/fenxiao/service/ShopSalesmanApplyService.java | 90 +++++++++++++++++++++++++++------------------ 1 files changed, 54 insertions(+), 36 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/fenxiao/service/ShopSalesmanApplyService.java b/zq-erp/src/main/java/com/matrix/system/fenxiao/service/ShopSalesmanApplyService.java index 3acf923..cd840dc 100644 --- a/zq-erp/src/main/java/com/matrix/system/fenxiao/service/ShopSalesmanApplyService.java +++ b/zq-erp/src/main/java/com/matrix/system/fenxiao/service/ShopSalesmanApplyService.java @@ -54,7 +54,7 @@ ShopSalesmanGradeDao shopSalesmanGradeDao; @Autowired - private BizUserDao bizUserDao; + BizUserDao bizUserDao; @Autowired BizUserService bizUserService; @@ -116,8 +116,13 @@ if(busParameterSettings!=null &&busParameterSettings.getParamValue().equals("1")){ //自动审核 + //初始等级ID(公司id,是否为初始等级) + QueryWrapper<ShopSalesmanGrade> queryWrapperOrepool = new QueryWrapper<>(); + queryWrapperOrepool.eq("company_id", loginUser.getCompanyId()); + queryWrapperOrepool.eq("is_default", 1); + ShopSalesmanGrade shopSalesmanGrade = shopSalesmanGradeDao.selectOne(queryWrapperOrepool); shopSalesmanApply.setApplyStatus(ShopSalesmanApply.APPLY_STATUS_TG); - bizUserService.setToBeAnSalesman(loginUser.getOpenId(),invitationId); + bizUserService.setToBeAnSalesman(loginUser.getOpenId(),invitationId,shopSalesmanGrade.getId()); }else{ shopSalesmanApply.setApplyStatus(ShopSalesmanApply.APPLY_STATUS_DSH); @@ -139,41 +144,47 @@ public VerificationResult isAbleToBeAnSalesman(String openId,Long companyId) { VerificationResult verificationResult=null; - //申请条件 - BusParameterSettings applyCondition = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_APPLY_CONDITION, companyId); - switch (applyCondition.getParamValue()){ - case FenxiaoSettingConstant.FX_APPLY_CONDITION_WTJ: - verificationResult= VerificationResult.buildVerificationResult(true); - break; - case FenxiaoSettingConstant.FX_APPLY_CONDITION_XFZDCP: - int buyZdcpCount= shopOrderV2Dao.countBuyZdcp(openId,applyCondition.getParamValue1()); - if(buyZdcpCount>0){ - verificationResult= VerificationResult.buildVerificationResult(true); - }else{ - verificationResult= VerificationResult.buildVerificationResult(false,"不符合申请条件,请消费指定产品后再申请!"); - } - break; - case FenxiaoSettingConstant.FX_APPLY_CONDITION_XFRYCP: - //判断用户是否有确认收货的产品 - int receivedOrderCount= shopOrderV2Dao.selectReceivedOrderCount(openId); - if(receivedOrderCount>0){ - verificationResult= VerificationResult.buildVerificationResult(true); - }else{ - verificationResult= VerificationResult.buildVerificationResult(false,"不符合申请条件,请消费任意产品后再申请!"); - } - break; - case FenxiaoSettingConstant.FX_APPLY_CONDITION_XCZDJE: - Double zdje=Double.parseDouble(applyCondition.getParamValue2()); - Double yxfje=shopOrderV2Dao.countOrderAmount(openId); - if(zdje<yxfje){ - verificationResult=VerificationResult.buildVerificationResult(true); - }else{ - verificationResult= VerificationResult.buildVerificationResult(false,"不符合申请条件,请消费满"+zdje+"元后再申请!"); - } - break; - default: - verificationResult= VerificationResult.buildVerificationResult(true); + //申请模式 + BusParameterSettings applyWay = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_APPLY_WAY, companyId); + if (applyWay.getParamValue().equals(FenxiaoSettingConstant.FX_APPLY_WAY_AUTO)) { + verificationResult= VerificationResult.buildVerificationResult(true); + }else{ + //申请条件 + BusParameterSettings applyCondition = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_APPLY_CONDITION, companyId); + switch (applyCondition.getParamValue()){ + case FenxiaoSettingConstant.FX_APPLY_CONDITION_WTJ: + verificationResult= VerificationResult.buildVerificationResult(true); + break; + case FenxiaoSettingConstant.FX_APPLY_CONDITION_XFZDCP: + int buyZdcpCount= shopOrderV2Dao.countBuyZdcp(openId,applyCondition.getParamValue1()); + if(buyZdcpCount>0){ + verificationResult= VerificationResult.buildVerificationResult(true); + }else{ + verificationResult= VerificationResult.buildVerificationResult(false,"不符合申请条件,请消费指定产品后再申请!"); + } + break; + case FenxiaoSettingConstant.FX_APPLY_CONDITION_XFRYCP: + //判断用户是否有确认收货的产品 + int receivedOrderCount= shopOrderV2Dao.selectReceivedOrderCount(openId); + if(receivedOrderCount>0){ + verificationResult= VerificationResult.buildVerificationResult(true); + }else{ + verificationResult= VerificationResult.buildVerificationResult(false,"不符合申请条件,请消费任意产品后再申请!"); + } + break; + case FenxiaoSettingConstant.FX_APPLY_CONDITION_XCZDJE: + Double zdje=Double.parseDouble(applyCondition.getParamValue2()); + Double yxfje=shopOrderV2Dao.countOrderAmount(openId); + if(zdje<yxfje){ + verificationResult=VerificationResult.buildVerificationResult(true); + }else{ + verificationResult= VerificationResult.buildVerificationResult(false,"不符合申请条件,请消费满"+zdje+"元后再申请!"); + } + break; + default: + verificationResult= VerificationResult.buildVerificationResult(true); + } } return verificationResult; } @@ -219,6 +230,7 @@ //修改USER的状态 bizUser.setParentOpenId(parentUserId); bizUser.setBindingParentTime(new Date()); + bizUser.setSalesmanGrade(shopSalesmanApply.getGradeId()); bizUserDao.updateByModel(bizUser); } @@ -365,6 +377,10 @@ if(StrUtil.isEmpty(name)) { return AjaxResult.buildFailInstance("请输入方案名称"); } + Double selfCommission = updateFyfaDto.getSelfCommission(); + if(ObjectUtil.isEmpty(selfCommission)) { + return AjaxResult.buildFailInstance("请输入正确的自购返佣"); + } Double sealesCommission = updateFyfaDto.getSealesCommission(); if(ObjectUtil.isEmpty(sealesCommission)) { return AjaxResult.buildFailInstance("请输入正确的推广提成"); @@ -378,6 +394,7 @@ ShopSalesmanGrade shopSalesmanGrade = new ShopSalesmanGrade(); shopSalesmanGrade.setCompanyId(updateFyfaDto.getCompanyId()); shopSalesmanGrade.setName(updateFyfaDto.getName()); + shopSalesmanGrade.setSelfCommission(selfCommission); shopSalesmanGrade.setSealesCommission(sealesCommission); shopSalesmanGrade.setInvitationCommission(invitationCommission); shopSalesmanGrade.setGradeCondition(updateFyfaDto.getGradeCondition()); @@ -392,6 +409,7 @@ } selectById.setCompanyId(updateFyfaDto.getCompanyId()); selectById.setName(updateFyfaDto.getName()); + selectById.setSelfCommission(selfCommission); selectById.setSealesCommission(sealesCommission); selectById.setInvitationCommission(invitationCommission); selectById.setGradeCondition(updateFyfaDto.getGradeCondition()); -- Gitblit v1.9.1