| | |
| | | package com.xzx.gc.user.controller; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.xzx.gc.common.constant.CommonEnum; |
| | | import com.xzx.gc.common.constant.Constants; |
| | | import com.xzx.gc.common.dto.log.OperationAppLog; |
| | |
| | | @ApiOperation(value="分銷系統管理--新增团长", notes="test: 仅0有正确返回") |
| | | public JsonResult adddistrib(@RequestBody AdddistribDto model, HttpServletRequest request) { |
| | | String id = model.getId(); |
| | | AccountInfo accountInfo = accountMapper.selectByPrimaryKey(id); |
| | | if(ObjectUtil.isEmpty(accountInfo)){ |
| | | return JsonResult.failMessage("账户不存在!"); |
| | | } |
| | | List<String> ids = StrUtil.split(id, ','); |
| | | // AccountInfo accountInfo = accountMapper.selectByPrimaryKey(id); |
| | | List<AccountInfo> accountInfos = accountMapper.selectAccountInfoByIds(ids); |
| | | if (CollUtil.isNotEmpty(accountInfos)) { |
| | | for (AccountInfo accountInfo : accountInfos) { |
| | | // if(ObjectUtil.isEmpty(accountInfo)){ |
| | | // return JsonResult.failMessage("账户不存在!"); |
| | | // } |
| | | if(ObjectUtil.isEmpty(accountInfo.getIsHead()) |
| | | || accountInfo.getIsHead() == 1){ |
| | | return JsonResult.failMessage("账户不能重复添加!"); |
| | | return JsonResult.failMessage(accountInfo.getAccountName() + "账户不能重复添加!"); |
| | | } |
| | | if(ObjectUtil.isEmpty(accountInfo.getDelFlag()) |
| | | || accountInfo.getDelFlag() == 1){ |
| | | return JsonResult.failMessage("账户已删除!"); |
| | | return JsonResult.failMessage(accountInfo.getAccountName() + "账户已删除!"); |
| | | } |
| | | if(ObjectUtil.isEmpty(accountInfo.getIsProhibit()) |
| | | || accountInfo.getIsProhibit() == "1"){ |
| | | return JsonResult.failMessage("账户已冻结!"); |
| | | || "1".equals(accountInfo.getIsProhibit())){ |
| | | return JsonResult.failMessage(accountInfo.getAccountName() + "账户已冻结!"); |
| | | } |
| | | //团员不能当团长 |
| | | String userId = accountInfo.getUserId(); |
| | | UserHeadRelate userHeadRelate = userHeadRelateMapper.selectMemberByUserId(userId); |
| | | if(ObjectUtil.isNotEmpty(userHeadRelate)){ |
| | | return JsonResult.failMessage("账户不能申请成为团长!"); |
| | | return JsonResult.failMessage(accountInfo.getAccountName() + "账户不能申请成为团长!"); |
| | | } |
| | | distribService.adddistrib(model); |
| | | OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request)) |
| | | .methodName(Constants.USER_MODUL_NAME).operateAction("分銷系統管理--新增团长-"+id).build(); |
| | | mqUtil.sendApp(build); |
| | | } |
| | | |
| | | return JsonResult.success("操作成功!"); |
| | | } else { |
| | | return JsonResult.failMessage("参数错误"); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "团长列表") |
| | |
| | | List<List<String>> rows = new ArrayList<>(); |
| | | List<String> header=new ArrayList<>(); |
| | | //标题 |
| | | header=CollUtil.newArrayList( "团长名称", "手机号", "身份", "团员数量", "交易单数", "累计收益积分", "累计收益(元)", "累计订单重量(kg)","累计数量(家电)"); |
| | | header=CollUtil.newArrayList( "团长名称", "手机号", "身份", "团员数量", "交易单数", "累计积分收益", "累计环保币收益", "累计订单重量(kg)","累计订单数量(家电)"); |
| | | rows.add(header); |
| | | Map<String, Object> stringObjectMap = distribService.distribDataExport(distribDataListDto); |
| | | List<DistribDataListVo> distribDataListVos = (List<DistribDataListVo>) stringObjectMap.get("data"); |