| | |
| | | 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; |
| | |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanApply; |
| | | import com.matrix.system.fenxiao.service.ShopSalesmanApplyService; |
| | | 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; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | @Autowired |
| | | ShopSalesmanApplyDao salesmanApplyDao; |
| | | |
| | | |
| | | @Autowired |
| | | ShopSalesmanApplyService shopSalesmanApplyService; |
| | | |
| | |
| | | @Autowired |
| | | WeChatApiTools weChatApiTools; |
| | | |
| | | @Autowired |
| | | ShopProductDao shopProductDao; |
| | | |
| | | |
| | | @ApiOperation(value = "查询推广计划", notes = "") |
| | | @GetMapping(value = "/getTgPlan") |
| | | public AjaxResult getTgPlan() { |
| | |
| | | ajaxResult.setData(busParameterSettings.getParamValue3()); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | @ApiOperation(value = "查询分销商城开关", notes = "1开启分销,2关闭分销") |
| | | @GetMapping(value = "/getSalesMallSetting") |
| | | public AjaxResult getSalesMallSwith() { |
| | | BusParameterSettings fxSwith = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_SWITCH, HostInterceptor.getCompanyId()); |
| | | BusParameterSettings fxModel = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_MODEL, HostInterceptor.getCompanyId()); |
| | | AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("查询成功"); |
| | | ajaxResult.putInMap("fxSwith",fxSwith.getParamValue()); |
| | | ajaxResult.putInMap("fxModel",fxModel.getParamValue()); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "申请成为推广员", notes = "传入参数invitationId 邀请人openId ,非必填 例: {invitationId:openId}") |
| | |
| | | public AjaxResult applyToBeAnSalesman(@RequestBody Map<String,String> param) { |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | String invitationId = param.get("invitationId"); |
| | | ShopSalesmanApply shopSalesmanApply= shopSalesmanApplyService.applyToBeAnSalesman(loginUser.getOpenId(),invitationId); |
| | | if(StringUtils.isNotBlank(invitationId)){ |
| | | BizUser invitationUser = bizUserDao.findByOpenId(invitationId); |
| | | if(invitationUser!=null && invitationUser.getOpenId().equals(loginUser.getOpenId())) { |
| | | return AjaxResult.buildFailInstance("不能邀请自己成为推广员"); |
| | | } |
| | | } |
| | | |
| | | ShopSalesmanApply shopSalesmanApply= shopSalesmanApplyService.applyToBeAnSalesman(loginUser.getOpenId(),"",invitationId,ShopSalesmanApply.APPLY_WAY_SELF); |
| | | loginUser=bizUserDao.selectById(loginUser.getUserId()); |
| | | redisUserLoginUtils.updateUserInfo(loginUser); |
| | | return AjaxResult.buildSuccessInstance(shopSalesmanApply); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | QueryWrapper<ShopSalesmanApply> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("user_id",loginUser.getOpenId()); |
| | | queryWrapper.eq("apply_status",ShopSalesmanApply.APPLY_STATUS_DSH); |
| | | ShopSalesmanApply shopSalesmanApply = salesmanApplyDao.selectOne(queryWrapper); |
| | | return AjaxResult.buildSuccessInstance(shopSalesmanApply); |
| | | } |
| | |
| | | return AjaxResult.buildFailInstance("请求参数错误"); |
| | | } |
| | | |
| | | |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | if(invitationId.equals(loginUser.getOpenId())){ |
| | | return AjaxResult.buildFailInstance("不能绑定自己"); |
| | | } |
| | | 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())) { |
| | |
| | | BufferedImage qrcordImgBuf = ImageIO.read(new File(qrcodeSavePath)); |
| | | |
| | | //获取海报 |
| | | BusParameterSettings posterSetting = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_TG_POSTER, HostInterceptor.getCompanyId()); |
| | | BusParameterSettings posterSetting = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_TG_POSTER, loginUser.getCompanyId()); |
| | | String posterPath=baseSavePath+"wxacode" + File.separatorChar+MD5Util.strToMD5(loginUser.getOpenId())+"poster.png"; |
| | | ImageUtil.downloadPicture(posterSetting.getParamValue(),posterPath); |
| | | BufferedImage posterImgBuf = ImageIO.read(new File(posterPath)); |
| | |
| | | BufferedImage backgroundImgBuf = new BufferedImage(700, 900, BufferedImage.TYPE_4BYTE_ABGR); |
| | | //绘制背景+产品 |
| | | Graphics2D g = backgroundImgBuf.createGraphics(); |
| | | //g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1)); |
| | | g.setColor(Color.WHITE); |
| | | g.fillRect(0,0,700,900); |
| | | g.drawImage(posterImgBuf,0,0,700, 700,null); |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "查询分销员中心信息", notes = "") |
| | | @PostMapping(value = "/getSalesmanCenterInfo") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = SalesmanCenterInfo.class) |
| | | }) |
| | | AjaxResult getSalesmanCenterInfo() { |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | SalesmanCenterInfo salesmanCenterInfo= salesmanApplyDao.selectSalesmanCenterInfo(loginUser.getOpenId()); |
| | | 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(), ","); |
| | | applyConditionInfo.setProductList( |
| | | shopProductDao.selectByIds( |
| | | strings.stream().map(i -> Integer.parseInt(i + "")).collect(Collectors.toList()))); |
| | | 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); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |