推广员
parent
06a36c6668
commit
9fbee20579
|
@ -66,10 +66,10 @@ public class BannerController {
|
|||
return success(BannerConvert.INSTANCE.convert(banner));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@PostMapping("/page")
|
||||
@Operation(summary = "获得 Banner 分页")
|
||||
@PreAuthorize("@ss.hasPermission('market:banner:query')")
|
||||
public CommonResult<PageResult<BannerRespVO>> getBannerPage(@Valid BannerPageReqVO pageVO) {
|
||||
public CommonResult<PageResult<BannerRespVO>> getBannerPage(@RequestBody@Valid BannerPageReqVO pageVO) {
|
||||
PageResult<BannerDO> pageResult = bannerService.getBannerPage(pageVO);
|
||||
return success(BannerConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
|
|
@ -25,6 +25,11 @@ public class BannerPageReqVO extends PageParam {
|
|||
@Schema(description = "标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 多租户编号
|
||||
*/
|
||||
@Schema(description = "多租户编号")
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description = "状态")
|
||||
@InEnum(CommonStatusEnum.class)
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.member.controller.admin.promoter;
|
|||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.common.SexEnum;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
|
@ -87,8 +88,8 @@ public class PromoterController {
|
|||
@Operation(summary = "获得推广员分页")
|
||||
@PreAuthorize("@ss.hasPermission('member:promoter:query')")
|
||||
public CommonResult<PageResult<PromoterRespVO>> getPromoterPage(@Valid PromoterPageReqVO pageVO) {
|
||||
PageResult<PromoterDO> pageResult = promoterService.getPromoterPage(pageVO);
|
||||
return success(PromoterConvert.INSTANCE.convertPage(pageResult));
|
||||
PageResult<PromoterRespVO> pageResult = promoterService.getPromoterPage(pageVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
|
|
|
@ -21,7 +21,7 @@ public class PromoterBaseVO {
|
|||
@Schema(description = "推广员名称", required = true, example = "5841")
|
||||
@NotEmpty(message = "推广员名称不能为空")
|
||||
@Size(max = 10,message = "推广员名称最长不能超过{max}")
|
||||
private String nickName;
|
||||
private String nickname;
|
||||
|
||||
|
||||
@Schema(description = "推广员手机号", example = "15601691300")
|
||||
|
|
|
@ -11,5 +11,8 @@ public class PromoterRespVO extends PromoterBaseVO {
|
|||
|
||||
@Schema(description = "编号", required = true, example = "3051")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "组织名称", required = true, example = "18443")
|
||||
private String orgName;
|
||||
@Schema(description = "组织名称", required = true, example = "18443")
|
||||
private String userId;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.dto.AdminUserQueryDTO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.AdminUserInfoRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUpdateStatusReqVO;
|
||||
import cn.iocoder.yudao.module.member.convert.user.UserConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
|
@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
@ -58,7 +60,13 @@ public class AdminUserController {
|
|||
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
|
||||
return success(avatar);
|
||||
}
|
||||
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "修改用户状态")
|
||||
@PreAuthorize("@ss.hasPermission('system:user:update')")
|
||||
public CommonResult<Boolean> updateUserStatus(@Valid @RequestBody MemberUpdateStatusReqVO reqVO) {
|
||||
userService.updateUserStatus(reqVO.getId(), reqVO.getStatus());
|
||||
return success(true);
|
||||
}
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得基本信息")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package cn.iocoder.yudao.module.member.controller.admin.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 用户更新状态 Request VO")
|
||||
@Data
|
||||
public class MemberUpdateStatusReqVO {
|
||||
|
||||
@Schema(description = "用户编号", required = true, example = "1024")
|
||||
@NotNull(message = "角色编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "状态,见 CommonStatusEnum 枚举", required = true, example = "1")
|
||||
@NotNull(message = "状态不能为空")
|
||||
// @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
}
|
|
@ -6,8 +6,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.promoter.PromoterDO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 推广员 Mapper
|
||||
|
@ -23,7 +25,7 @@ public interface PromoterMapper extends BaseMapperX<PromoterDO> {
|
|||
.eqIfPresent(PromoterDO::getUserId, reqVO.getUserId())
|
||||
.orderByDesc(PromoterDO::getId));
|
||||
}
|
||||
|
||||
IPage<PromoterRespVO> findListPage(IPage<PromoterRespVO> page, @Param("data") PromoterPageReqVO data);
|
||||
default List<PromoterDO> selectList(PromoterExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<PromoterDO>()
|
||||
.eqIfPresent(PromoterDO::getOrgId, reqVO.getOrgId())
|
||||
|
|
|
@ -5,6 +5,7 @@ import javax.validation.*;
|
|||
import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.*;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.promoter.PromoterDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
/**
|
||||
* 推广员 Service 接口
|
||||
|
@ -57,7 +58,7 @@ public interface PromoterService {
|
|||
* @param pageReqVO 分页查询
|
||||
* @return 推广员分页
|
||||
*/
|
||||
PageResult<PromoterDO> getPromoterPage(PromoterPageReqVO pageReqVO);
|
||||
PageResult<PromoterRespVO> getPromoterPage(PromoterPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得推广员列表, 用于 Excel 导出
|
||||
|
|
|
@ -9,6 +9,9 @@ import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
|||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
|
@ -58,11 +61,11 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
if(memberUserDO==null){
|
||||
//创建用户
|
||||
memberUserDO = new MemberUserDO();
|
||||
memberUserDO.setNickname(createReqVO.getNickName());
|
||||
memberUserDO.setNickname(createReqVO.getNickname());
|
||||
memberUserDO.setMobile(createReqVO.getMobile());
|
||||
memberUserDO.setStatus(createReqVO.getStatus());
|
||||
memberUserDO.setPassword(createReqVO.getMobile().substring(createReqVO.getMobile().length()-6));
|
||||
memberUserService.createUserIfAbsent(createReqVO.getMobile(),createReqVO.getNickName(),getClientIP());
|
||||
memberUserService.createUserIfAbsent(createReqVO.getMobile(),createReqVO.getNickname(),getClientIP());
|
||||
}
|
||||
// 插入
|
||||
PromoterDO promoter = PromoterConvert.INSTANCE.convert(createReqVO);
|
||||
|
@ -111,8 +114,10 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PromoterDO> getPromoterPage(PromoterPageReqVO pageReqVO) {
|
||||
return promoterMapper.selectPage(pageReqVO);
|
||||
public PageResult<PromoterRespVO> getPromoterPage(PromoterPageReqVO pageReqVO) {
|
||||
Page<PromoterRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
promoterMapper.findListPage(page,pageReqVO);
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -82,6 +82,8 @@ public interface MemberUserService {
|
|||
*/
|
||||
String updateUserAvatar(Long userId, InputStream inputStream) throws Exception;
|
||||
|
||||
void updateUserStatus(Long id, Integer status) ;
|
||||
|
||||
/**
|
||||
* 修改手机
|
||||
* @param userId 用户id
|
||||
|
|
|
@ -123,7 +123,16 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||
memberUserMapper.updateById(MemberUserDO.builder().id(userId).avatar(avatar).build());
|
||||
return avatar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserStatus(Long id, Integer status) {
|
||||
// 校验用户存在
|
||||
this.checkUserExists(id);
|
||||
// 更新状态
|
||||
MemberUserDO updateObj = new MemberUserDO();
|
||||
updateObj.setId(id);
|
||||
updateObj.setStatus(status);
|
||||
memberUserMapper.updateById(updateObj);
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateUserMobile(Long userId, AppUserUpdateMobileReqVO reqVO) {
|
||||
|
|
|
@ -9,4 +9,10 @@
|
|||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="findListPage" resultType="cn.iocoder.yudao.module.member.controller.admin.promoter.vo.PromoterRespVO">
|
||||
select a.id,a.user_id,a.org_id,b.nickname,b.status,b.mobile,c.parent_organization_name as 'orgName' from member_promoter a
|
||||
left join member_user b on a.user_id = b.id
|
||||
left join system_dept c on c.id=a.org_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -165,4 +165,6 @@ public interface ErrorCodeConstants {
|
|||
// ========== 站内信发送 1002028000 ==========
|
||||
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1002025000, "模板参数({})缺失");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -102,5 +102,14 @@ public class TenantBaseVO {
|
|||
@Length( max =200, message = "logo长度为 {max}位")
|
||||
private String logo;
|
||||
|
||||
/**
|
||||
* 商品提成
|
||||
*/
|
||||
private Integer goodsCommission;
|
||||
/**
|
||||
* 会员充值提成
|
||||
*/
|
||||
private Integer memberCommission;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -21,12 +21,12 @@ public class TenantCommissionUpdateReqVO {
|
|||
* 商品提成
|
||||
*/
|
||||
@NotNull(message = "商品提成不能为空")
|
||||
@Size(min = 0,max = 100,message ="商品提成{min}{max}之间" )
|
||||
// @Size(min = 0,max = 100,message ="商品提成{min}{max}之间" )
|
||||
private Integer goodsCommission;
|
||||
/**
|
||||
* 会员充值提成
|
||||
*/
|
||||
@NotNull(message = "会员充值提成不能为空")
|
||||
@Size(min = 0,max = 100,message ="会员充值提成{min}{max}之间" )
|
||||
// @Size(min = 0,max = 100,message ="会员充值提成{min}{max}之间" )
|
||||
private Integer memberCommission;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package cn.iocoder.yudao.module.system.controller.app.tenant;
|
||||
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.*;
|
||||
import cn.iocoder.yudao.module.system.convert.tenant.TenantConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 租户")
|
||||
@RestController
|
||||
@RequestMapping("/system/tenant")
|
||||
public class AppTenantController {
|
||||
|
||||
@Resource
|
||||
private TenantService tenantService;
|
||||
|
||||
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得租户")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:tenant:query')")
|
||||
public CommonResult<TenantRespVO> getTenant(@RequestParam("id") Long id) {
|
||||
TenantDO tenant = tenantService.getTenant(id);
|
||||
return success(TenantConvert.INSTANCE.convert(tenant));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package cn.iocoder.yudao.module.system.controller.app.tenant.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantBaseVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 租户 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TenantRespVO extends TenantBaseVO {
|
||||
|
||||
@Schema(description = "租户编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "租户名", required = true, example = "芋道")
|
||||
@NotNull(message = "租户名不能为空")
|
||||
private String name;
|
||||
|
||||
}
|
|
@ -159,7 +159,7 @@ public class TenantServiceImpl implements TenantService {
|
|||
// 校验租户名称是否重复
|
||||
validTenantNameDuplicate(updateReqVO.getName(), updateReqVO.getId());
|
||||
// 校验套餐被禁用
|
||||
TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(updateReqVO.getPackageId());
|
||||
TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(tenant.getPackageId());
|
||||
|
||||
// 更新租户
|
||||
TenantDO updateObj = TenantConvert.INSTANCE.convert(updateReqVO);
|
||||
|
|
|
@ -52,3 +52,15 @@ export function exportUserExcel(query) {
|
|||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
// 用户状态修改
|
||||
export function changeUserStatus(id, status) {
|
||||
const data = {
|
||||
id,
|
||||
status
|
||||
}
|
||||
return request({
|
||||
url: '/member/user/update-status',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
|
@ -35,14 +35,22 @@
|
|||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
<el-table-column label="组织id" align="center" prop="orgId" />
|
||||
<el-table-column label="会员id" align="center" prop="userId" />
|
||||
<el-table-column label="推广员名称" align="center" prop="nickname" />
|
||||
<el-table-column label="手机号" align="center" prop="mobile" />
|
||||
<el-table-column label="所属组织" align="center" prop="orgName" />
|
||||
<el-table-column label="启用状态" align="center" prop="status" >
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.status" :active-value="0" :inactive-value="1" @change="handleStatusChange(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['member:promoter:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['member:promoter:delete']">删除</el-button>
|
||||
v-hasPermi="['member:promoter:delete']">修改密码</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleStatusChange(scope.row)"
|
||||
v-hasPermi="['member:promoter:delete']">禁用</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -90,9 +98,19 @@
|
|||
|
||||
<script>
|
||||
import { createPromoter, updatePromoter, deletePromoter, getPromoter, getPromoterPage, importTemplate,exportPromoterExcel } from "@/api/member/promoter";
|
||||
import {
|
||||
changeUserStatus
|
||||
} from "@/api/member/user";
|
||||
import {getBaseHeader} from "@/utils/request";
|
||||
import {CommonStatusEnum} from "@/utils/constants";
|
||||
import {DICT_TYPE} from "@/utils/dict";
|
||||
export default {
|
||||
name: "Promoter",
|
||||
computed: {
|
||||
DICT_TYPE() {
|
||||
return DICT_TYPE
|
||||
}
|
||||
},
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
|
@ -229,6 +247,18 @@ export default {
|
|||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 用户状态修改
|
||||
handleStatusChange(row) {
|
||||
let text = row.status === CommonStatusEnum.ENABLE ? "启用" : "禁用";
|
||||
this.$modal.confirm('您确认要"' + text + '""' + row.nickname + '"推广员吗?').then(function() {
|
||||
return changeUserStatus(row.user_id, row.status);
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功");
|
||||
}).catch(function() {
|
||||
row.status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE
|
||||
: CommonStatusEnum.ENABLE;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
|
|
|
@ -108,9 +108,9 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="归属部门" prop="deptId">
|
||||
<el-form-item label="归属组织" prop="deptId">
|
||||
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :clearable="false"
|
||||
placeholder="请选择归属部门" :normalizer="normalizer"/>
|
||||
placeholder="请选择归属组织" :normalizer="normalizer"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
Loading…
Reference in New Issue