From 5edb953a5683a303409ae38d9853bcd519f16cef Mon Sep 17 00:00:00 2001 From: username <1532322479@qq.com> Date: Sun, 16 Feb 2025 15:13:52 +0800 Subject: [PATCH] Initial commit --- .../system/SysRegisterController.java | 38 +++++++ .../src/main/resources/application-druid.yml | 6 +- bs-admin/src/main/resources/application.yml | 12 +-- .../web/service/SysRegisterService.java | 21 ++-- .../resources/mapper/system/SysUserMapper.xml | 4 +- bs-ui/.env.development | 5 +- bs-ui/src/api/system/dept.js | 2 +- .../product/components/BrokerProduct.vue | 72 ++++++++++++- .../components/BrokerProductByUserId.vue | 102 ++++++++++++++++-- .../product/components/BrokerProductTwo.vue | 79 ++++++++++++-- .../broker/product/components/DfBroker.vue | 17 +++ .../recommend/components/BrokerProduct.vue | 70 +++++++++--- bs-ui/vue.config.js | 4 +- 13 files changed, 375 insertions(+), 57 deletions(-) diff --git a/bs-admin/src/main/java/com/bs/web/controller/system/SysRegisterController.java b/bs-admin/src/main/java/com/bs/web/controller/system/SysRegisterController.java index e7fd48e..6246ad5 100644 --- a/bs-admin/src/main/java/com/bs/web/controller/system/SysRegisterController.java +++ b/bs-admin/src/main/java/com/bs/web/controller/system/SysRegisterController.java @@ -1,5 +1,6 @@ package com.bs.web.controller.system; +import cn.hutool.core.lang.Validator; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.bs.common.constant.Constants; import com.bs.common.core.domain.entity.SysRole; @@ -16,6 +17,7 @@ import com.bs.system.mapper.SysUserRoleMapper; import com.bs.system.service.ISysUserService; import io.swagger.util.Json; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @@ -70,6 +72,42 @@ public class SysRegisterController extends BaseController // return error("当前系统没有开启注册功能!"); // } String msg = registerService.register(user); + if (Validator.isNotEmpty(msg)) { + return error(msg); + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysUser::getUserName,user.getUsername()); + List sysUsers = userMapper.selectList(wrapper); + SysUser sysUser = sysUsers.get(0); + userService.insertUserAuth(sysUser.getUserId(), new Long[]{2L}); + LoginUser loginUser = createLoginUser(sysUser, null); + String token = tokenService.createToken(loginUser); + AjaxResult ajax = AjaxResult.success(); + ajax.put(Constants.TOKEN, token); + return ajax; + } + + @GetMapping("/ceshi") + public AjaxResult ceshi() + { +// if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) +// { +// return error("当前系统没有开启注册功能!"); +// } + RegisterBody user = new RegisterBody(); + user.setPassword("123456"); + user.setUsername("测试手机号5"); + user.setPhonenumber("18396103855"); +// INSERT INTO sys_user (user_id, dept_id, user_name, nick_name, email, phonenumber, sex, avatar, password, status, review_status, +// tenant_id, user_type, create_time) +// VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +// 09:56:48.703 [http-nio-8089-exec-19] DEBUG c.b.s.m.S.insertNew - [debug,137] - ==> Parameters: 1737683808874(Long), 0(Long), +// 测试手机号2(String), 测试手机号2(String), null, 18396103859(String), null, null + + String msg = registerService.register(user); + if (Validator.isNotEmpty(msg)) { + return error(msg); + } LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(SysUser::getUserName,user.getUsername()); List sysUsers = userMapper.selectList(wrapper); diff --git a/bs-admin/src/main/resources/application-druid.yml b/bs-admin/src/main/resources/application-druid.yml index 19b9f8e..26c9182 100644 --- a/bs-admin/src/main/resources/application-druid.yml +++ b/bs-admin/src/main/resources/application-druid.yml @@ -8,10 +8,10 @@ spring: master: url: jdbc:mysql://localhost:3306/df-broker?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true username: root - password: fastrise@chain -# url: jdbc:mysql://124.71.134.146:63306/my-base?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true + password: root +# url: jdbc:mysql://120.77.170.30:3306/df-broker?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true # username: root -# password: abcd123 +# password: fastrise@chain # 从库数据源 slave: # 从数据源开关/默认关闭 diff --git a/bs-admin/src/main/resources/application.yml b/bs-admin/src/main/resources/application.yml index 91ef24a..10ff76a 100644 --- a/bs-admin/src/main/resources/application.yml +++ b/bs-admin/src/main/resources/application.yml @@ -16,10 +16,10 @@ bs: copyrightYear: 2023 # 实例演示开关 demoEnabled: true - # 文件路径 示例( Windows配置D:/bs/uploadPath,Linux配置 /home/bs/uploadPath) - profile: D:/bs/uploadPath + # 文件路径 示例( Windows配置C:/bs/uploadPath,Linux配置 /home/bs/uploadPath) + profile: C:/bs/uploadPath # 文件存储路径 windows 路径 - winLocalFilePath: D:/bs/uploadPath + winLocalFilePath: C:/bs/uploadPath # winLocalFilePath: E:/test # 文件存储路径 linux 路径 linuxLocalFilePath: /home/chain-mos/attachment @@ -52,7 +52,7 @@ bs: # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 - port: 8080 + port: 8089 servlet: # 应用的访问路径 context-path: / @@ -86,9 +86,9 @@ user: servlet: multipart: # 单个文件大小 - max-file-size: 10MB + max-file-size: 30MB # 设置总上传的文件大小 - max-request-size: 20MB + max-request-size: 40MB # 服务模块 devtools: restart: diff --git a/bs-framework/src/main/java/com/bs/framework/web/service/SysRegisterService.java b/bs-framework/src/main/java/com/bs/framework/web/service/SysRegisterService.java index e329104..de2061b 100644 --- a/bs-framework/src/main/java/com/bs/framework/web/service/SysRegisterService.java +++ b/bs-framework/src/main/java/com/bs/framework/web/service/SysRegisterService.java @@ -1,5 +1,6 @@ package com.bs.framework.web.service; +import cn.hutool.core.lang.Validator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.bs.common.constant.CacheConstants; @@ -50,12 +51,13 @@ public class SysRegisterService SysUser sysUser = new SysUser(); sysUser.setUserName(username); sysUser.setReviewStatus("1"); + sysUser.setPhonenumber(registerBody.getPhonenumber()); // 验证码开关 - boolean captchaEnabled = configService.selectCaptchaEnabled(); - if (captchaEnabled) - { - validateCaptcha(username, registerBody.getCode(), registerBody.getUuid()); - } +// boolean captchaEnabled = configService.selectCaptchaEnabled(); +// if (captchaEnabled) +// { +// validateCaptcha(username, registerBody.getCode(), registerBody.getUuid()); +// } if (StringUtils.isEmpty(username)) { msg = "用户名不能为空"; @@ -78,15 +80,20 @@ public class SysRegisterService { msg = "保存用户'" + username + "'失败,注册账号已存在"; } + else if (Validator.isNotEmpty(sysUser.getPhonenumber()) && !userService.checkPhoneUnique(sysUser)) { + msg = "新增用户'" + sysUser.getUserName() + "'失败,手机号码已存在"; + } else { if (!StringUtils.isEmpty(registerBody.getShareUser())) { SysUser sysUserShare = userService.selectUserById(Long.valueOf(registerBody.getShareUser())); Long deptId = sysUserShare.getDeptId(); sysUser.setDeptId(deptId); + if (-1 == deptId) { + sysUser.setDeptId(0L); + } } else { - sysUser.setDeptId(116L); - + sysUser.setDeptId(0L); } sysUser.setPhonenumber(registerBody.getPhonenumber()); sysUser.setUserType("jj"); diff --git a/bs-system/src/main/resources/mapper/system/SysUserMapper.xml b/bs-system/src/main/resources/mapper/system/SysUserMapper.xml index 17c2d30..5063f11 100644 --- a/bs-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/bs-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -187,8 +187,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - INSERT INTO df_user_broker (user_id, broker_id, create_time, tenant_id) - VALUES (#{user.userId}, #{user.brokerId}, #{user.createTime},0) + INSERT INTO df_user_broker (user_id, create_time, tenant_id) + VALUES (#{user.userId}, #{user.createTime},0) diff --git a/bs-ui/.env.development b/bs-ui/.env.development index b574774..8d1543d 100644 --- a/bs-ui/.env.development +++ b/bs-ui/.env.development @@ -5,10 +5,11 @@ VUE_APP_TITLE = 德富金服经纪推广系统 ENV = 'development' # 德富金服经纪推广系统/开发环境 -#VUE_APP_BASE_API = 'http://124.71.134.146:8096/prod-api' -VUE_APP_BASE_API = 'http://localhost:8080' +# VUE_APP_BASE_API = 'http://139.224.49.182:8086/prod-api' +# VUE_APP_BASE_API = 'http://localhost:8080' # VUE_APP_BASE_API = 'http://tanjunwei.test.jiutianda.cn' # VUE_APP_BASE_API = 'http://wangyi.test.jiutianda.cn' +VUE_APP_BASE_API = '/prod-api' # 路由懒加载 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/bs-ui/src/api/system/dept.js b/bs-ui/src/api/system/dept.js index fc943cd..331c4b2 100644 --- a/bs-ui/src/api/system/dept.js +++ b/bs-ui/src/api/system/dept.js @@ -49,4 +49,4 @@ export function delDept(deptId) { url: '/system/dept/' + deptId, method: 'delete' }) -} \ No newline at end of file +} diff --git a/bs-ui/src/views/broker/product/components/BrokerProduct.vue b/bs-ui/src/views/broker/product/components/BrokerProduct.vue index c1ad682..0ad75ab 100644 --- a/bs-ui/src/views/broker/product/components/BrokerProduct.vue +++ b/bs-ui/src/views/broker/product/components/BrokerProduct.vue @@ -327,11 +327,38 @@ - - + + + 全选 + + + + + + @@ -428,6 +455,10 @@ export default { }, data() { return { + checked: false, // 控制是否全选 + options: [], // 存储其他选项 + filteredList: [], // 存储过滤后的产品列表 + filteredOptions: [], // 存储过滤后的其他选项 openByAddAndUser: false, readonly:false, // isReadOnly: false, @@ -559,6 +590,36 @@ export default { this.getAreaList(); }, methods: { + // 过滤方法,更新 filteredList 和 filteredOptions + filterMethod(query) { + this.loading = true; + // 根据 query 过滤 infoListAll 和 options + this.filteredList = this.infoListAll.filter(info => info.productName.includes(query)); + this.filteredOptions = this.options.filter(item => item.name.includes(query)); + this.loading = false; + }, + // 全选方法,只选中过滤出来的选项 + selectAll() { + if (this.checked) { + // 获取过滤后的所有选项并将它们添加到 form.ids 中 + const allSelectedIds = [ + ...this.form.ids, // 保留已有的选中项 + ...this.filteredList.map(info => info.id), // 添加过滤后的选项 + ]; + this.form.ids = Array.from(new Set(allSelectedIds)); // 使用 Set 去重 + } else { + // 取消全选:从 form.ids 中剔除过滤后的选项 + this.form.ids = this.form.ids.filter(id => !this.filteredList.some(info => info.id === id)); + } + this.filteredList = this.infoListAll; + }, + changeSelect(val) { + if (val.length === this.infoListAll.length) { + this.checked = true + } else { + this.checked = false + } + }, tenantIdnormalizer(node, instanceId) { if (node.children && !node.children.length) { delete node.children @@ -599,6 +660,7 @@ export default { } listByBroker(params).then(response => { this.infoListAll = response.data; + this.filteredList = this.infoListAll; }); }, getAllInfoByUser(id) { diff --git a/bs-ui/src/views/broker/product/components/BrokerProductByUserId.vue b/bs-ui/src/views/broker/product/components/BrokerProductByUserId.vue index 3103e73..a0d9d49 100644 --- a/bs-ui/src/views/broker/product/components/BrokerProductByUserId.vue +++ b/bs-ui/src/views/broker/product/components/BrokerProductByUserId.vue @@ -69,13 +69,19 @@ - + + + + + + @@ -247,11 +253,44 @@ - - + + + + + + + + + 全选 + + + + + + @@ -348,6 +387,10 @@ export default { }, data() { return { + checked: false, // 控制是否全选 + options: [], // 存储其他选项 + filteredList: [], // 存储过滤后的产品列表 + filteredOptions: [], // 存储过滤后的其他选项 openByAddAndUser: false, readonly:false, // isReadOnly: false, @@ -471,13 +514,57 @@ export default { filteredCities() { // 根据搜索文本过滤城市列表 return this.cityList.filter(city => city.name.includes(this.searchText)); - } + }, }, created() { this.getList(); this.getAreaList(); }, methods: { + // 过滤方法,更新 filteredList 和 filteredOptions + filterMethod(query) { + this.loading = true; + // 根据 query 过滤 infoListAll 和 options + this.filteredList = this.infoListAll.filter(info => info.productName.includes(query)); + this.filteredOptions = this.options.filter(item => item.name.includes(query)); + this.loading = false; + }, + // 全选方法,只选中过滤出来的选项 + selectAll() { + if (this.checked) { + // 获取过滤后的所有选项并将它们添加到 form.ids 中 + const allSelectedIds = [ + ...this.form.ids, // 保留已有的选中项 + ...this.filteredList.map(info => info.id), // 添加过滤后的选项 + ]; + this.form.ids = Array.from(new Set(allSelectedIds)); // 使用 Set 去重 + } else { + // 取消全选:从 form.ids 中剔除过滤后的选项 + this.form.ids = this.form.ids.filter(id => !this.filteredList.some(info => info.id === id)); + } + this.filteredList = this.infoListAll; + }, + // selectAll() { + // if (this.checked) { + // // 获取过滤后的所有选项并将它们添加到 form.ids 中 + // const allSelectedIds = [ + // ...this.form.ids, // 保留已有的选中项 + // ...this.filteredList.map(info => info.id), // 添加过滤后的选项 + // ]; + // this.form.ids = Array.from(new Set(allSelectedIds)); // 使用 Set 去重 + // } else { + // // 取消全选:从 form.ids 中剔除过滤后的选项 + // this.form.ids = this.form.ids.filter(id => !this.filteredList.some(info => info.id === id)); + // } + // this.filteredList = this.infoListAll; + // }, + changeSelect(val) { + if (val.length === this.infoListAll.length) { + this.checked = true + } else { + this.checked = false + } + }, tenantIdnormalizer(node, instanceId) { if (node.children && !node.children.length) { delete node.children @@ -529,6 +616,7 @@ export default { } listByUserId(params).then(response => { this.infoListAll = response.data; + this.filteredList = this.infoListAll; }); }, getAllIds(data) { diff --git a/bs-ui/src/views/broker/product/components/BrokerProductTwo.vue b/bs-ui/src/views/broker/product/components/BrokerProductTwo.vue index 29a9017..5274343 100644 --- a/bs-ui/src/views/broker/product/components/BrokerProductTwo.vue +++ b/bs-ui/src/views/broker/product/components/BrokerProductTwo.vue @@ -61,13 +61,19 @@ - + + + + + + @@ -239,11 +245,38 @@ - - + + + 全选 + + + + + + @@ -342,6 +375,10 @@ export default { }, data() { return { + checked: false, // 控制是否全选 + options: [], // 存储其他选项 + filteredList: [], // 存储过滤后的产品列表 + filteredOptions: [], // 存储过滤后的其他选项 openByAddAndUser: false, readonly:false, // isReadOnly: false, @@ -462,6 +499,36 @@ export default { this.getAreaList(); }, methods: { + // 过滤方法,更新 filteredList 和 filteredOptions + filterMethod(query) { + this.loading = true; + // 根据 query 过滤 infoListAll 和 options + this.filteredList = this.infoListAll.filter(info => info.productName.includes(query)); + this.filteredOptions = this.options.filter(item => item.name.includes(query)); + this.loading = false; + }, + // 全选方法,只选中过滤出来的选项 + selectAll() { + if (this.checked) { + // 获取过滤后的所有选项并将它们添加到 form.ids 中 + const allSelectedIds = [ + ...this.form.ids, // 保留已有的选中项 + ...this.filteredList.map(info => info.id), // 添加过滤后的选项 + ]; + this.form.ids = Array.from(new Set(allSelectedIds)); // 使用 Set 去重 + } else { + // 取消全选:从 form.ids 中剔除过滤后的选项 + this.form.ids = this.form.ids.filter(id => !this.filteredList.some(info => info.id === id)); + } + this.filteredList = this.infoListAll; + }, + changeSelect(val) { + if (val.length === this.infoListAll.length) { + this.checked = true + } else { + this.checked = false + } + }, tenantIdnormalizer(node, instanceId) { if (node.children && !node.children.length) { delete node.children diff --git a/bs-ui/src/views/broker/product/components/DfBroker.vue b/bs-ui/src/views/broker/product/components/DfBroker.vue index 110dc0b..77c7cfa 100644 --- a/bs-ui/src/views/broker/product/components/DfBroker.vue +++ b/bs-ui/src/views/broker/product/components/DfBroker.vue @@ -349,6 +349,23 @@ export default { this.getList(); }, methods: { + selectAll() { + this.form.ids = [] + if (this.checked) { + this.infoListAll.map((item) => { + this.form.ids.push(item.id) + }) + } else { + this.form.ids = [] + } + }, + changeSelect(val) { + if (val.length === this.infoListAll.length) { + this.checked = true + } else { + this.checked = false + } + }, clearSelection() { this.resetQuery(); }, diff --git a/bs-ui/src/views/product/recommend/components/BrokerProduct.vue b/bs-ui/src/views/product/recommend/components/BrokerProduct.vue index f1e8860..14536ff 100644 --- a/bs-ui/src/views/product/recommend/components/BrokerProduct.vue +++ b/bs-ui/src/views/product/recommend/components/BrokerProduct.vue @@ -318,18 +318,39 @@ - - 全选 - - + + + 全选 + + + + + + - - - - - - @@ -425,6 +446,9 @@ export default { }, data() { return { + options: [], // 存储其他选项 + filteredList: [], // 存储过滤后的产品列表 + filteredOptions: [], // 存储过滤后的其他选项 openByAddAndUser: false, readonly:false, // isReadOnly: false, @@ -557,15 +581,28 @@ export default { this.getAreaList(); }, methods: { + // 过滤方法,更新 filteredList 和 filteredOptions + filterMethod(query) { + this.loading = true; + // 根据 query 过滤 infoListAll 和 options + this.filteredList = this.infoListAll.filter(info => info.productName.includes(query)); + this.filteredOptions = this.options.filter(item => item.name.includes(query)); + this.loading = false; + }, + // 全选方法,只选中过滤出来的选项 selectAll() { - this.form.ids = [] if (this.checked) { - this.infoListAll.map((item) => { - this.form.ids.push(item.id) - }) + // 获取过滤后的所有选项并将它们添加到 form.ids 中 + const allSelectedIds = [ + ...this.form.ids, // 保留已有的选中项 + ...this.filteredList.map(info => info.id), // 添加过滤后的选项 + ]; + this.form.ids = Array.from(new Set(allSelectedIds)); // 使用 Set 去重 } else { - this.form.ids = [] + // 取消全选:从 form.ids 中剔除过滤后的选项 + this.form.ids = this.form.ids.filter(id => !this.filteredList.some(info => info.id === id)); } + this.filteredList = this.infoListAll; }, changeSelect(val) { if (val.length === this.infoListAll.length) { @@ -625,6 +662,7 @@ export default { } listByRecommend(params).then(response => { this.infoListAll = response.data; + this.filteredList = this.infoListAll; }); }, getAllIds(data) { diff --git a/bs-ui/vue.config.js b/bs-ui/vue.config.js index 39737fc..45788c0 100644 --- a/bs-ui/vue.config.js +++ b/bs-ui/vue.config.js @@ -30,12 +30,12 @@ module.exports = { // webpack-dev-server 相关配置 devServer: { host: '0.0.0.0', - port: port, + port: 8086, open: true, proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `http://localhost:8080`, + target: `http://localhost:8089`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: ''