15 files modified
1 files added
| | |
| | | agentService.resetPwd(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @PostMapping("edit") |
| | | @RequiresPermissions("agent:edit") |
| | | @ControllerEndpoint(operation = "修改代理商", exceptionMessage = "修改代理商失败") |
| | | public FebsResponse edit(@Valid AgentUser agentUser) { |
| | | User user = getCurrentUser(); |
| | | agentService.editAgent(agentUser, user); |
| | | return new FebsResponse().success(); |
| | | } |
| | | } |
| | |
| | | package com.xcong.excoin.modules.agent.controller; |
| | | |
| | | import com.xcong.excoin.common.controller.BaseController; |
| | | import com.xcong.excoin.common.entity.FebsConstant; |
| | | import com.xcong.excoin.common.entity.FebsResponse; |
| | | import com.xcong.excoin.common.entity.QueryRequest; |
| | | import com.xcong.excoin.modules.agent.entity.MemberEntity; |
| | | import com.xcong.excoin.modules.agent.service.IMemberService; |
| | | import com.xcong.excoin.system.entity.User; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | |
| | | @GetMapping("getList") |
| | | public FebsResponse getList(MemberEntity member, QueryRequest request) { |
| | | User user = getCurrentUser(); |
| | | member.setInviteId(FebsConstant.USER_TYPE_ADMIN.equals(user.getType()) ? FebsConstant.DEFAULT_REFERER_ID : user.getInviteId()); |
| | | Map<String, Object> data = getDataTable(memberService.findMemberListInPage(member, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | |
| | | |
| | | import com.xcong.excoin.common.entity.FebsConstant; |
| | | import com.xcong.excoin.common.utils.FebsUtil; |
| | | import com.xcong.excoin.system.entity.User; |
| | | import com.xcong.excoin.system.service.IUserService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @Controller("memberView") |
| | | @RequestMapping(FebsConstant.VIEW_PREFIX + "/agent") |
| | | @RequiredArgsConstructor |
| | | public class ViewController { |
| | | |
| | | private final IUserService userService; |
| | | |
| | | @GetMapping("member") |
| | | @RequiresPermissions("amember:view") |
| | | public String member() { |
| | | return FebsUtil.view("modules/agent/member"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("agent") |
| | | @RequiresPermissions("agent:view") |
| | |
| | | public String agentAdd() { |
| | | return FebsUtil.view("modules/agent/agentAdd"); |
| | | } |
| | | |
| | | @GetMapping("agentEdit/{id}") |
| | | @RequiresPermissions("agent:edit") |
| | | public String agentEdit(@PathVariable Long id, Model model) { |
| | | User user = userService.findUserInfoById(id); |
| | | model.addAttribute("user", user); |
| | | return FebsUtil.view("modules/agent/agentEdit"); |
| | | } |
| | | } |
| | |
| | | public interface AgentFriendRelationMapper extends BaseMapper<AgentFriendRelationEntity> { |
| | | |
| | | AgentFriendRelationEntity selectAgentFriendRelationByUserId(@Param("userId") Long userId); |
| | | |
| | | int updateByUserId(@Param("record") AgentFriendRelationEntity agentFriendRelationEntity); |
| | | } |
| | |
| | | void delAgent(String[] ids); |
| | | |
| | | void resetPwd(Long id); |
| | | |
| | | void editAgent(AgentUser agentUser, User user); |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import sun.management.Agent; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | |
| | | addUser.setType(FebsConstant.USER_TYPE_AGENT); |
| | | addUser.setSystem(FebsConstant.SYSTEM_AGENT); |
| | | addUser.setCreateTime(new Date()); |
| | | addUser.setMobile(agentUser.getTelphone()); |
| | | addUser.setInviteId(agentUser.getInviteId()); |
| | | addUser.setAgentName(agentUser.getName()); |
| | | addUser.setPassword(Md5Util.encrypt(addUser.getUsername(), User.DEFAULT_PASSWORD)); |
| | |
| | | agentFriendRelationMapper.insert(agentFriendRelation); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void delAgent(String[] ids) { |
| | | List<String> list = Arrays.asList(ids); |
| | |
| | | user.setPassword(Md5Util.encrypt(user.getUsername(), User.DEFAULT_PASSWORD)); |
| | | userMapper.updateById(user); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void editAgent(AgentUser agentUser, User user) { |
| | | if (!FebsConstant.USER_TYPE_ADMIN.equals(user.getType())) { |
| | | AgentFriendRelationEntity friendRelationEntity = agentFriendRelationMapper.selectAgentFriendRelationByUserId(user.getUserId()); |
| | | if (agentUser.getReturnRatio().compareTo(friendRelationEntity.getReturnRatio()) > 0) { |
| | | throw new FebsException("返佣比例需小于上级的返佣比例"); |
| | | } |
| | | } |
| | | |
| | | User editUser = new User(); |
| | | editUser.setUserId(agentUser.getId()); |
| | | editUser.setMobile(agentUser.getTelphone()); |
| | | editUser.setAgentName(agentUser.getName()); |
| | | userMapper.updateById(editUser); |
| | | |
| | | AgentFriendRelationEntity relationEntity = new AgentFriendRelationEntity(); |
| | | relationEntity.setUserId(agentUser.getId()); |
| | | relationEntity.setReturnRatio(agentUser.getReturnRatio()); |
| | | agentFriendRelationMapper.updateByUserId(relationEntity); |
| | | } |
| | | } |
| | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | @TableField(exist = false) |
| | | private String deptIds; |
| | | |
| | | private BigDecimal returnRatio; |
| | | |
| | | public Long getId() { |
| | | return userId; |
| | | } |
| | |
| | | |
| | | User selectUserByInviteId(@Param("inviteId") String inviteId); |
| | | |
| | | User selectUserInfoById(@Param("id") Long id); |
| | | |
| | | } |
| | |
| | | * @param user 个人信息 |
| | | */ |
| | | void updateProfile(User user); |
| | | |
| | | User findUserInfoById(Long id); |
| | | } |
| | |
| | | User currentUser = FebsUtil.getCurrentUser(); |
| | | return currentUser.getUserId().equals(id); |
| | | } |
| | | |
| | | @Override |
| | | public User findUserInfoById(Long id) { |
| | | return this.baseMapper.selectUserInfoById(id); |
| | | } |
| | | } |
| | |
| | | select * from agent_friend_relation |
| | | where user_id=#{userId} |
| | | </select> |
| | | |
| | | <update id="updateByUserId"> |
| | | update agent_friend_relation |
| | | set return_ratio = #{record.returnRatio} |
| | | where user_id=#{record.userId} |
| | | </update> |
| | | </mapper> |
| | |
| | | <select id="selectMemberListInPage" resultType="com.xcong.excoin.modules.agent.entity.MemberEntity"> |
| | | select * from member |
| | | <where> |
| | | <if test="record != null" > |
| | | <if test="record != null"> |
| | | <if test="record.inviteId !=null and record.inviteId!=''"> |
| | | and find_in_set(#{record.inviteId}, referer_ids) |
| | | </if> |
| | | <if test="record.startTime!=null"> |
| | | and create_time >=#{record.startTime} |
| | | </if> |
| | |
| | | <if test="record.accountStatus!=null"> |
| | | and account_status = #{record.accountStatus} |
| | | </if> |
| | | <if test="record.accountType != null" > |
| | | <if test="record.accountType != null"> |
| | | and account_type = #{record.accountType} |
| | | </if> |
| | | <if test="record.certifyStatus != null"> |
| | |
| | | a.create_time, |
| | | a.status, |
| | | b.return_ratio, |
| | | c.phone telphone, |
| | | c.email, |
| | | a.mobile telphone, |
| | | c.referer_id refererId, |
| | | c.certify_status |
| | | from t_user a |
| | |
| | | <select id="selectUserByInviteId" resultType="user"> |
| | | select * from t_user where invite_id=#{inviteId} |
| | | </select> |
| | | |
| | | <select id="selectUserInfoById" resultType="user"> |
| | | select |
| | | a.user_id, |
| | | a.agent_name, |
| | | a.username, |
| | | a.mobile, |
| | | a.invite_id, |
| | | b.return_ratio |
| | | from t_user a |
| | | left join agent_friend_relation b on a.user_id=b.user_id |
| | | where a.user_id=#{id} |
| | | </select> |
| | | </mapper> |
| | |
| | | }); |
| | | } |
| | | if (layEvent === 'edit') { |
| | | febs.modal.open('修改用户', 'system/user/update/' + data.username, { |
| | | febs.modal.open('修改用户', '/agent/agentEdit/' + data.id, { |
| | | area: $(window).width() <= 750 ? '90%' : '50%', |
| | | offset: '30px', |
| | | btn: ['提交', '取消'], |
| | |
| | | {field: 'name', title: '代理姓名', minWidth: 100, align: 'center'}, |
| | | {field: 'account', title: '代理账号', minWidth: 100, align: 'center'}, |
| | | {field: 'inviteId', title: '代理UID', minWidth: 100, align: 'center'}, |
| | | {field: 'phone', title: '手机号', minWidth: 130, align: 'center'}, |
| | | {field: 'email', title: '邮箱', minWidth: 180, align: 'center'}, |
| | | {field: 'phone', title: '联系方式', minWidth: 130, align: 'center'}, |
| | | // {field: 'email', title: '邮箱', minWidth: 180, align: 'center'}, |
| | | {field: 'refererId', title: '上级UID', minWidth: 100, align: 'center'}, |
| | | {title: '是否实名', templet: '#certify-status', minWidth: 100, align: 'center'}, |
| | | {field: 'childCnt', title: '发展代理数', minWidth: 100, align: 'center'}, |
New file |
| | |
| | | <style> |
| | | #user-update { |
| | | padding: 20px 25px 25px 0; |
| | | } |
| | | |
| | | #user-update .layui-treeSelect .ztree li a, .ztree li span { |
| | | margin: 0 0 2px 3px !important; |
| | | } |
| | | |
| | | #user-update #data-permission-tree-block { |
| | | border: 1px solid #eee; |
| | | border-radius: 2px; |
| | | padding: 3px 0; |
| | | } |
| | | |
| | | #user-update .layui-treeSelect .ztree li span.button.switch { |
| | | top: 1px; |
| | | left: 3px; |
| | | } |
| | | </style> |
| | | <div class="layui-fluid" id="user-update"> |
| | | <form class="layui-form" action="" lay-filter="user-update-form"> |
| | | <div class="layui-form-item febs-hide"> |
| | | <label class="layui-form-label febs-form-item-require">用户id:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="id" data-th-value="${user.userId}"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">用户名:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="account" lay-verify="required" data-th-id="${user.userId}" readonly autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">代理姓名:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" minlength="2" maxlength="25" lay-verify="range" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">联系电话:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="tel" name="telphone" lay-verify="phone" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">代理UID:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="inviteId" lay-verify="required" readonly autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">返佣比例:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="returnRatio" lay-verify="slot" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="user-update-form-submit" id="submit"></button> |
| | | <button type="reset" class="layui-btn" id="reset"></button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'validate'], function () { |
| | | var $ = layui.$, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | form = layui.form, |
| | | user = [[${user}]], |
| | | validate = layui.validate; |
| | | |
| | | form.verify(validate); |
| | | form.render(); |
| | | |
| | | initFormValue(); |
| | | |
| | | function initFormValue() { |
| | | form.val("user-update-form", { |
| | | "account": user.username, |
| | | "name": user.agentName, |
| | | "telphone": user.mobile, |
| | | "inviteId": user.inviteId, |
| | | "returnRatio" : user.returnRatio |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(user-update-form-submit)', function (data) { |
| | | febs.post(ctx + 'agent/edit', data.field, function () { |
| | | layer.closeAll(); |
| | | $('#febs-user').find('#query').click(); |
| | | }); |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |
| | |
| | | {title: '账号类型', templet: '#account-type'}, |
| | | {title: '账号状态', templet: '#account-status'}, |
| | | {title: '审核状态', templet: '#certify-status'}, |
| | | {field: 'createTime', title: '注册时间', minWidth: 180}, |
| | | {title: '操作', toolbar: '#user-option', minWidth: 140, fixed : 'right'} |
| | | {field: 'createTime', title: '注册时间', minWidth: 180} |
| | | ]] |
| | | }); |
| | | } |