| | |
| | | viewSettingVo.setRegularPoint(StrUtil.isEmpty(shareRatios.get(2))?0:Integer.parseInt(shareRatios.get(2))); |
| | | viewSettingVo.setRegularMoneyPercent(StrUtil.isEmpty(shareRatios.get(3))?BigDecimal.ZERO:new BigDecimal(shareRatios.get(3))); |
| | | // viewSettingVo.setFinishOrderNum(StrUtil.isEmpty(shareRatios.get(4))?0:Integer.parseInt(shareRatios.get(4))); |
| | | viewSettingVo.setPointReward(StrUtil.isEmpty(shareRatios.get(5))?0:Integer.parseInt(shareRatios.get(5))); |
| | | viewSettingVo.setPointReward(StrUtil.isEmpty(shareRatios.get(4))?0:Integer.parseInt(shareRatios.get(4))); |
| | | viewSettingVo.setStatus(redPaperRule.getStatus()); |
| | | } |
| | | }else{ |
| | |
| | | } |
| | | |
| | | AccountInfo accountInfo = accountMapper.selectOneByUserId(userId); |
| | | if (AccountInfo.IS_HEAD_Y.equals(accountInfo.getIsHead())) { |
| | | throw new RestException(-3, "团长不能加入团队"); |
| | | } |
| | | |
| | | UserShareInfo userShareInfo = userShareInfoMapper.selectByRegistPhone(accountInfo.getAccountName()); |
| | | if (userShareInfo != null) { |
| | | throw new RestException(-3, "您已与推广员绑定, 无法加入"); |
| | |
| | | stringBuffer.append(pointReward); |
| | | redPaperRule.setStatus((short) 0); |
| | | redPaperRule.setRuleName("分销规则"); |
| | | redPaperRule.setSharingProfitType("frist_reward,order_num_frist,regular_point,regular_money_percent,finish_order_num,point_reward"); |
| | | redPaperRule.setSharingProfitType("frist_reward,order_num_frist,regular_point,regular_money_percent,point_reward"); |
| | | redPaperRule.setShareRatio(stringBuffer.toString()); |
| | | redPaperRuleMapper.insert(redPaperRule); |
| | | } |
| | |
| | | int pointReward = ObjectUtil.isEmpty(model.getPointReward()) ? 0 : model.getPointReward(); |
| | | stringBuffer.append(pointReward); |
| | | redPaperRule.setStatus(model.getStatus()); |
| | | redPaperRule.setSharingProfitType("first_reward,order_num_first,regular_point,regular_money_percent,finish_order_num,point_reward"); |
| | | redPaperRule.setSharingProfitType("first_reward,order_num_first,regular_point,regular_money_percent,point_reward"); |
| | | redPaperRule.setShareRatio(stringBuffer.toString()); |
| | | redPaperRuleMapper.updateByPrimaryKey(redPaperRule); |
| | | } |
| | |
| | | return data; |
| | | } |
| | | |
| | | public void adddistrib(AdddistribDto model) { |
| | | String id = model.getId(); |
| | | public void adddistrib(String id) { |
| | | AccountInfo accountInfo = accountMapper.selectByPrimaryKey(id); |
| | | accountInfo.setIsHead(1); |
| | | accountMapper.updateByPrimaryKey(accountInfo); |
| | |
| | | |
| | | public ViewDistribInfoVo viewDistribInfo(String id) { |
| | | //获取团长基本信息 |
| | | ViewDistribInfoVo viewDistribInfoVo = accountMapper.selectDistribByAccountId(id); |
| | | if(StrUtil.isNotEmpty(viewDistribInfoVo.getNickname())){ |
| | | String decode = StringUtils.decode(viewDistribInfoVo.getNickname()); |
| | | viewDistribInfoVo.setNickname(decode); |
| | | } |
| | | return accountMapper.selectDistribByAccountId(id); |
| | | } |
| | | |
| | |
| | | if(CollUtil.isNotEmpty(orderItemsVos)){ |
| | | for(OrderItemsVo orderItemsVo : orderItemsVos){ |
| | | if(ObjectUtil.isNotEmpty(orderItemsVo)){ |
| | | String nickname = orderItemsVo.getNickname(); |
| | | String decode = StringUtils.decode(nickname); |
| | | orderItemsVo.setNickname(decode); |
| | | Long orderId = orderItemsVo.getOrderId(); |
| | | List<JhyOrderItems> jhyOrderItems = accountMapper.selectOrderById(orderId); |
| | | if(CollUtil.isNotEmpty(jhyOrderItems)){ |
| | |
| | | |
| | | |
| | | public Map<String, Object> distribDataList(DistribDataListDto distribDataListDto) { |
| | | if(StrUtil.isNotEmpty(distribDataListDto.getQueryCol())){ |
| | | String decode = StringUtils.encode(distribDataListDto.getQueryCol()); |
| | | distribDataListDto.setName(decode); |
| | | distribDataListDto.setPhone(distribDataListDto.getQueryCol()); |
| | | } |
| | | PageHelper.startPage(distribDataListDto.getPage(), distribDataListDto.getLimit()); |
| | | List<DistribDataListVo> distribDataListVos = accountMapper.distribDataList(distribDataListDto); |
| | | if(CollUtil.isNotEmpty(distribDataListVos)){ |
| | | for(DistribDataListVo distribDataListVo : distribDataListVos){ |
| | | if(ObjectUtil.isNotEmpty(distribDataListVo)){ |
| | | String nickname = distribDataListVo.getNickname(); |
| | | String decode = StringUtils.decode(nickname); |
| | | distribDataListVo.setNickname(decode); |
| | | String id = distribDataListVo.getId(); |
| | | String kg = accountMapper.selectOrderByHeadUserId(id); |
| | | String kg = accountMapper.selectOrderByHeadUserId(id,distribDataListDto); |
| | | distribDataListVo.setKg(kg); |
| | | String jdsl = accountMapper.selectJDSLByHeadUserId(id); |
| | | String jdsl = accountMapper.selectJDSLByHeadUserId(id,distribDataListDto); |
| | | distribDataListVo.setJdsl(jdsl); |
| | | } |
| | | } |
| | |
| | | public DistribDataInfoVo distribDataInfo(DistribDataInfoDto distribDataInfoDto) { |
| | | return accountMapper.selectDistribDataInfoVo(); |
| | | } |
| | | |
| | | public Map<String, Object> distribDataExport(ExportDistribDataListDto distribDataListDto) { |
| | | if(StrUtil.isNotEmpty(distribDataListDto.getQueryCol())){ |
| | | String decode = StringUtils.encode(distribDataListDto.getQueryCol()); |
| | | distribDataListDto.setName(decode); |
| | | distribDataListDto.setPhone(distribDataListDto.getQueryCol()); |
| | | } |
| | | List<DistribDataListVo> distribDataListVos = accountMapper.distribDataExport(distribDataListDto); |
| | | if(CollUtil.isNotEmpty(distribDataListVos)){ |
| | | for(DistribDataListVo distribDataListVo : distribDataListVos){ |
| | | if(ObjectUtil.isNotEmpty(distribDataListVo)){ |
| | | String nickname = distribDataListVo.getNickname(); |
| | | String decode = StringUtils.decode(nickname); |
| | | distribDataListVo.setNickname(decode); |
| | | String id = distribDataListVo.getId(); |
| | | String kg = accountMapper.selectOrderExportByHeadUserId(id,distribDataListDto); |
| | | distribDataListVo.setKg(kg); |
| | | String jdsl = accountMapper.selectJDSLExportByHeadUserId(id,distribDataListDto); |
| | | distribDataListVo.setJdsl(jdsl); |
| | | } |
| | | } |
| | | } |
| | | PageInfo<DistribDataListVo> pageInfo = new PageInfo<>(distribDataListVos); |
| | | Map<String, Object> data = new HashMap<>(); |
| | | int count = Convert.toInt(pageInfo.getTotal()); |
| | | data.put("data", distribDataListVos); |
| | | data.put("count", count); |
| | | data.put("code", 0); |
| | | return data; |
| | | } |
| | | |
| | | public ViewScoreSettingVo viewScoreSetting(String ruleStr) { |
| | | ViewScoreSettingVo viewScoreSettingVo = new ViewScoreSettingVo(); |
| | | RedPaperRule redPaperRule = redPaperRuleMapper.selectByRuleName(ruleStr); |
| | | if(ObjectUtil.isEmpty(redPaperRule)){ |
| | | viewScoreSettingVo.setRegisterScore(0); |
| | | viewScoreSettingVo.setShareScore(0); |
| | | viewScoreSettingVo.setShareScoreTime(0); |
| | | viewScoreSettingVo.setFirstScore(0); |
| | | }else{ |
| | | String shareRatio = redPaperRule.getShareRatio(); |
| | | if(StrUtil.isNotEmpty(shareRatio)){ |
| | | List<String> shareRatios = StrUtil.split(shareRatio,',',false,false); |
| | | if(ObjectUtil.isNotEmpty(shareRatios)){ |
| | | viewScoreSettingVo.setId(redPaperRule.getId()); |
| | | viewScoreSettingVo.setRegisterScore(StrUtil.isEmpty(shareRatios.get(0))?0:Integer.parseInt(shareRatios.get(0))); |
| | | viewScoreSettingVo.setShareScore(StrUtil.isEmpty(shareRatios.get(1))?0:Integer.parseInt(shareRatios.get(1))); |
| | | viewScoreSettingVo.setShareScoreTime(StrUtil.isEmpty(shareRatios.get(2))?0:Integer.parseInt(shareRatios.get(2))); |
| | | viewScoreSettingVo.setFirstScore(StrUtil.isEmpty(shareRatios.get(3))?0:Integer.parseInt(shareRatios.get(3))); |
| | | } |
| | | }else{ |
| | | viewScoreSettingVo.setId(redPaperRule.getId()); |
| | | viewScoreSettingVo.setRegisterScore(0); |
| | | viewScoreSettingVo.setShareScore(0); |
| | | viewScoreSettingVo.setShareScoreTime(0); |
| | | viewScoreSettingVo.setFirstScore(0); |
| | | } |
| | | } |
| | | return viewScoreSettingVo; |
| | | } |
| | | |
| | | public void addScoreSetting(UpdateScoreSetting model) { |
| | | RedPaperRule redPaperRule = new RedPaperRule(); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | int registerScore = ObjectUtil.isEmpty(model.getRegisterScore()) ? 0 : model.getRegisterScore(); |
| | | stringBuffer.append(registerScore+","); |
| | | int shareScore = ObjectUtil.isEmpty(model.getShareScore()) ? 0 : model.getShareScore(); |
| | | stringBuffer.append(shareScore+","); |
| | | int shareScoreTime = ObjectUtil.isEmpty(model.getShareScoreTime()) ? 0 : model.getShareScoreTime(); |
| | | stringBuffer.append(shareScoreTime+","); |
| | | int firstScore = ObjectUtil.isEmpty(model.getFirstScore()) ? 0 : model.getFirstScore(); |
| | | stringBuffer.append(firstScore+","); |
| | | redPaperRule.setStatus((short) 0); |
| | | redPaperRule.setRuleName("积分运行设置"); |
| | | redPaperRule.setSharingProfitType("register_score,share_score,share_score_time"); |
| | | redPaperRule.setShareRatio(stringBuffer.toString()); |
| | | redPaperRuleMapper.insert(redPaperRule); |
| | | } |
| | | |
| | | public void updateScoreSetting(UpdateScoreSetting model) { |
| | | RedPaperRule redPaperRule = redPaperRuleMapper.selectByPrimaryKey(model.getId()); |
| | | if(ObjectUtil.isNotEmpty(redPaperRule)){ |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | int registerScore = ObjectUtil.isEmpty(model.getRegisterScore()) ? 0 : model.getRegisterScore(); |
| | | stringBuffer.append(registerScore+","); |
| | | int shareScore = ObjectUtil.isEmpty(model.getShareScore()) ? 0 : model.getShareScore(); |
| | | stringBuffer.append(shareScore+","); |
| | | int shareScoreTime = ObjectUtil.isEmpty(model.getShareScoreTime()) ? 0 : model.getShareScoreTime(); |
| | | stringBuffer.append(shareScoreTime+","); |
| | | int firstScore = ObjectUtil.isEmpty(model.getFirstScore()) ? 0 : model.getFirstScore(); |
| | | stringBuffer.append(firstScore+","); |
| | | redPaperRule.setStatus(model.getStatus()); |
| | | redPaperRule.setSharingProfitType("register_score,share_score,share_score_time,first_score"); |
| | | redPaperRule.setShareRatio(stringBuffer.toString()); |
| | | redPaperRuleMapper.updateByPrimaryKey(redPaperRule); |
| | | } |
| | | } |
| | | } |