| | |
| | | import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanApplyDao; |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanApply; |
| | | import com.matrix.system.fenxiao.service.ShopSalesmanApplyService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.*; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | ShopSalesmanApplyDao salesmanApplyDao; |
| | | |
| | | @Autowired |
| | | ShopSalesmanApplyService shopSalesmanApplyService; |
| | | |
| | | @Autowired |
| | | private RedisUserLoginUtils redisUserLoginUtils; |
| | | |
| | | @Autowired |
| | | private BizUserDao bizUserDao; |
| | | |
| | | |
| | | @ApiOperation(value = "查询推广计划", notes = "") |
| | | @GetMapping(value = "/getTgPlan") |
| | |
| | | |
| | | @ApiOperation(value = "申请成为推广员", notes = "传入参数invitationId 邀请人openId ,非必填 例: {invitationId:openId}") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = Map.class) |
| | | @ApiResponse(code = 200, message = "ok", response = ShopSalesmanApply.class) |
| | | }) |
| | | @PostMapping(value = "/applyToBeAnSalesman") |
| | | @Transactional |
| | | 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); |
| | | loginUser=bizUserDao.selectById(loginUser.getUserId()); |
| | | //校验审核状态,和是否重复发起 |
| | | QueryWrapper<ShopSalesmanApply> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("user_id",loginUser.getOpenId()); |
| | | ShopSalesmanApply checkApply = salesmanApplyDao.selectOne(queryWrapper); |
| | | if(checkApply==null|| |
| | | checkApply.getApplyStatus()==ShopSalesmanApply.APPLY_STATUS_WTG){ |
| | | |
| | | 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); |
| | | }else if(StringUtils.isNotBlank(loginUser.getParentOpenId())){ |
| | | //如果曾经是被邀请进来的则自动绑定为之前邀请人的下级 |
| | | shopSalesmanApply.setParentUserId(loginUser.getParentOpenId()); |
| | | } |
| | | salesmanApplyDao.insert(shopSalesmanApply); |
| | | return AjaxResult.buildSuccessInstance("申请成功"); |
| | | }else{ |
| | | return AjaxResult.buildFailInstance("不能重复申请"); |
| | | } |
| | | |
| | | redisUserLoginUtils.updateUserInfo(loginUser); |
| | | return AjaxResult.buildSuccessInstance(shopSalesmanApply); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "查询推广员审核进度", notes = "") |
| | | @ApiOperation(value = " ", notes = "") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = ShopSalesmanApply.class) |
| | | }) |
| | |
| | | try { |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(loginUser.getOpenId() + "", "pages/index/index", MD5Util.strToMD5(loginUser.getOpenId() + "")); |
| | | |
| | | //获取海报 |
| | | BusParameterSettings posterSetting = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_TG_POSTER, HostInterceptor.getCompanyId()); |
| | | |
| | | String posterSavePath = posterSetting.getParamValue1(); |
| | | BufferedImage productImgBuf = ImageIO.read(new File(qrcodeSavePath)); |
| | | BufferedImage qrcordImgBuf = ImageIO.read(new File(posterSavePath)); |
| | | |
| | | BufferedImage backgroundImgBuf = new BufferedImage(750, 900, BufferedImage.TYPE_4BYTE_ABGR); |
| | | //绘制背景+产品 |
| | | Graphics2D g = backgroundImgBuf.createGraphics(); |
| | | g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1)); |
| | | |
| | | |
| | | |
| | | |
| | | LogUtil.debug("qrcodeSavePath={}", qrcodeSavePath); |
| | | // 图片保存目录路径 |
| | | String baseSavePath = PropertiesUtil.getString(AppConstance.FILES_TORAGE_PATH); |