From fea651e6ac53fab71950d197dddbf770681b8ead Mon Sep 17 00:00:00 2001 From: Leo Date: Wed, 11 Aug 2021 08:51:53 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=AD=98?= =?UTF-8?q?=E5=8F=96=E6=AC=BE=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/config/SwaggerConfig.java | 9 +++ .../config/proprety/SwaggerProperty.java | 1 + .../src/main/resources/application.yml | 1 + .../controller/SysAccountController.java | 66 ++++++++++++++++++- .../system/controller/SysNewsController.java | 2 +- .../system/mapper/SysAccountMapper.java | 7 ++ .../system/mapper/xml/SysAccountMapper.xml | 25 +++++++ .../system/service/ISysAccountService.java | 21 ++++-- .../service/impl/SysAccountServiceImpl.java | 5 ++ 9 files changed, 128 insertions(+), 9 deletions(-) diff --git a/pear-common/src/main/java/com/pearadmin/common/config/SwaggerConfig.java b/pear-common/src/main/java/com/pearadmin/common/config/SwaggerConfig.java index 456f1fd..603b363 100644 --- a/pear-common/src/main/java/com/pearadmin/common/config/SwaggerConfig.java +++ b/pear-common/src/main/java/com/pearadmin/common/config/SwaggerConfig.java @@ -6,6 +6,8 @@ import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.RequestHandlerSelectors; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import springfox.documentation.swagger.web.UiConfiguration; +import springfox.documentation.swagger.web.UiConfigurationBuilder; import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.spi.DocumentationType; @@ -41,6 +43,13 @@ public class SwaggerConfig { .apis(RequestHandlerSelectors.basePackage(documentAutoProperties.getScanPackage())) .build(); } +// +// @Bean +// public UiConfiguration uiConfiguration(SwaggerProperty swaggerProperty) { +// return UiConfigurationBuilder.builder() +// .tagsSorter(swaggerProperty.getUiConfig().getTagsSorter()) +// .build(); +// } private ApiInfo apiInfo(){ return new ApiInfo( diff --git a/pear-common/src/main/java/com/pearadmin/common/config/proprety/SwaggerProperty.java b/pear-common/src/main/java/com/pearadmin/common/config/proprety/SwaggerProperty.java index b0030b5..27e7324 100644 --- a/pear-common/src/main/java/com/pearadmin/common/config/proprety/SwaggerProperty.java +++ b/pear-common/src/main/java/com/pearadmin/common/config/proprety/SwaggerProperty.java @@ -3,6 +3,7 @@ package com.pearadmin.common.config.proprety; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import springfox.documentation.service.Contact; +import springfox.documentation.swagger.web.UiConfiguration; /** * Describe: 接 口 文 档 配 置 类 diff --git a/pear-entrance/src/main/resources/application.yml b/pear-entrance/src/main/resources/application.yml index a18e22c..68e0b21 100644 --- a/pear-entrance/src/main/resources/application.yml +++ b/pear-entrance/src/main/resources/application.yml @@ -71,6 +71,7 @@ pear: open-api: - /login/** # 开放登录接口 - /system/captcha/** # 开放验证码接口 + - /system/account/** # 开放账户接口 - /assets/** # 开放静态资源 - /admin/** # 开放静态资源 - /component/** # 开放静态资源 diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysAccountController.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysAccountController.java index 6bf7d38..754080c 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysAccountController.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysAccountController.java @@ -23,7 +23,7 @@ import javax.annotation.Resource; * @date 2021/8/10 */ @RestController -@Api(tags = {"系统账户"}) +@Api(tags = {"1.系统账户"}) @RequestMapping(ControllerConstant.API_SYSTEM_PREFIX + "account") public class SysAccountController extends BaseController { @@ -137,4 +137,68 @@ public class SysAccountController extends BaseController { return decide(sysAccountService.batchRemove(ids.split(","))); } + /** + * 存款 + * @param userId 用户编号 + * @param money 金额 + * @return Result + */ + @PostMapping("deposit") + @ApiOperation(value = "存款", tags = "1.金融系统") +// @PreAuthorize("hasPermission('/system/account/edit','sys:account:edit')") + public Result deposit(String userId, String money) { + System.out.println("存款"); + return addMoney(userId, money, true); + } + + /** + * 取款 + * @param userId 用户编号 + * @param money 金额 + * @return Result + */ + @PostMapping("withdrawal") + @ApiOperation(value = "取款", tags = "1.金融系统") +// @PreAuthorize("hasPermission('/system/account/edit','sys:account:edit')") + public Result withdrawal(String userId, String money) { + System.out.println("取款"); + return addMoney(userId, money, false); + } + + /** + * 用户账户余额操作 + * @param userId 用户编号 + * @param money 金额 + * @return Result + */ + private Result addMoney(String userId, String money, boolean add) { + long realMoney = 0; + try { + realMoney = Integer.parseInt(money); + } catch (Exception e) { + return failure("金额错误"); + } + +// SysAccount account = sysAccountService.getByUserId(userId); + SysAccount account = sysAccountService.getByUserId(userId); + if (account == null) { + return failure("不存在该账户"); + } + + // TODO: 2021/8/10 交易记录 - 事务 + + realMoney = add(account.getBalance(), realMoney, add); + + if (realMoney < 0) { + return failure("账户余额不足"); + } + + account.setBalance(realMoney); + return decide(sysAccountService.update(account)); + } + + private long add(long n1, long n2, boolean add) { + return add ? n1 + n2 : n1 - n2; + } + } diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysNewsController.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysNewsController.java index c4c419b..72030b5 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysNewsController.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysNewsController.java @@ -23,7 +23,7 @@ import javax.annotation.Resource; * @date 2021/8/9 */ @RestController -@Api(tags = {"新闻"}) +@Api(tags = {"2.新闻"}) @RequestMapping(ControllerConstant.API_SYSTEM_PREFIX + "news") public class SysNewsController extends BaseController { diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/SysAccountMapper.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/SysAccountMapper.java index e74e1ae..6a784a8 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/SysAccountMapper.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/SysAccountMapper.java @@ -36,6 +36,13 @@ public interface SysAccountMapper { */ SysAccount selectById(@Param("id") String id); + /** + * 根据 userId 用户编号查询账户 + * @param userId 用户编号 + * @return SysAccount 实体类 + */ + SysAccount selectByUserId(String userId); + /** * 根据 id 编号修改账户 * @param sysAccount 实体类 diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/SysAccountMapper.xml b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/SysAccountMapper.xml index 8dc2079..5f5877e 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/SysAccountMapper.xml +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/SysAccountMapper.xml @@ -31,6 +31,11 @@ select * from sys_account where id = #{id} + + + insert into sys_account @@ -75,6 +80,26 @@ + + + + update sys_account + + + balance = #{balance}, + + + enable = #{enable}, + + + deleted = #{deleted}, + + + remark = #{remark}, + + + where id = #{id} + diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysAccountService.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysAccountService.java index 51177e7..e4cef9a 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysAccountService.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysAccountService.java @@ -15,14 +15,14 @@ import java.util.List; public interface ISysAccountService { /** - * Describe: 查询新闻数据 + * Describe: 查询账户数据 * Param: queryNewsParam * Return: 操作结果 */ List list(SysAccount queryNewsParam); /** - * Describe: 分页查询新闻数据 + * Describe: 分页查询账户数据 * Param: queryNewsParam * Param: pageDomain * Return: 操作结果 @@ -30,35 +30,42 @@ public interface ISysAccountService { PageInfo page(SysAccount queryNewsParam, PageDomain pageDomain); /** - * Describe: 保存新闻数据 + * Describe: 保存账户数据 * Param: SysAccount * Return: 操作结果 */ boolean save(SysAccount sysAccount); /** - * Describe: 根据 id 获取新闻信息 + * Describe: 根据 id 获取账户信息 * Param: id * Return: 操作结果 */ SysAccount getById(String id); /** - * Describe: 根据 id 修改新闻数据 + * Describe: 根据 userId 获取账户信息 + * Param: id + * Return: 操作结果 + */ + SysAccount getByUserId(String id); + + /** + * Describe: 根据 id 修改账户数据 * Param: id * Return: 操作结果 */ boolean update(SysAccount sysAccount); /** - * Describe: 根据 id 删除新闻数据 + * Describe: 根据 id 删除账户数据 * Param: id * Return: 操作结果 */ Boolean remove(String id); /** - * Describe: 根据 id 删除新闻数据 + * Describe: 根据 id 删除账户数据 * Param: ids * Return: 操作结果 */ diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysAccountServiceImpl.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysAccountServiceImpl.java index c0f4cc1..032a10b 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysAccountServiceImpl.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysAccountServiceImpl.java @@ -69,6 +69,11 @@ public class SysAccountServiceImpl implements ISysAccountService { return sysAccountMapper.selectById(id); } + @Override + public SysAccount getByUserId(String userId) { + return sysAccountMapper.selectByUserId(userId); + } + /** * 修改账户数据 * @param sysAccount 实体类 -- Gitee From 9fc66950ff1dcb19bf94d64d705f9006d665f937 Mon Sep 17 00:00:00 2001 From: Leo Date: Thu, 12 Aug 2021 09:31:17 +0800 Subject: [PATCH 2/3] feat: add deposit and balance pages --- .../templates/system/account/balance.html | 60 +++++++++++++++++ .../templates/system/account/deposit.html | 64 +++++++++++++++++++ .../controller/SysAccountController.java | 62 ++++++++++++++---- 3 files changed, 174 insertions(+), 12 deletions(-) create mode 100644 pear-entrance/src/main/resources/templates/system/account/balance.html create mode 100644 pear-entrance/src/main/resources/templates/system/account/deposit.html diff --git a/pear-entrance/src/main/resources/templates/system/account/balance.html b/pear-entrance/src/main/resources/templates/system/account/balance.html new file mode 100644 index 0000000..43da107 --- /dev/null +++ b/pear-entrance/src/main/resources/templates/system/account/balance.html @@ -0,0 +1,60 @@ + + + + + + + +
+
+ 我的余额 +
+
+
+

+
+ +
+ + +
+
+
+
+ + + + diff --git a/pear-entrance/src/main/resources/templates/system/account/deposit.html b/pear-entrance/src/main/resources/templates/system/account/deposit.html new file mode 100644 index 0000000..26e6fb5 --- /dev/null +++ b/pear-entrance/src/main/resources/templates/system/account/deposit.html @@ -0,0 +1,64 @@ + + + + + + +
+
+
+
+
+ +
+ + +
+
+
+
+
+
+
+ + +
+
+
+ + + + \ No newline at end of file diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysAccountController.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysAccountController.java index 754080c..1d705d9 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysAccountController.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysAccountController.java @@ -2,15 +2,18 @@ package com.pearadmin.system.controller; import com.github.pagehelper.PageInfo; import com.pearadmin.common.constant.ControllerConstant; +import com.pearadmin.common.tools.secure.SecurityUtil; import com.pearadmin.common.web.base.BaseController; import com.pearadmin.common.web.domain.request.PageDomain; import com.pearadmin.common.web.domain.response.Result; import com.pearadmin.common.web.domain.response.module.ResultTable; import com.pearadmin.system.domain.SysAccount; +import com.pearadmin.system.domain.SysUser; import com.pearadmin.system.service.ISysAccountService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -137,41 +140,69 @@ public class SysAccountController extends BaseController { return decide(sysAccountService.batchRemove(ids.split(","))); } + /** + * 获取我的余额视图 + * @return 账户修改视图 + */ + @GetMapping("balance") + @ApiOperation(value = "获取我的余额视图") + @PreAuthorize("hasPermission('/system/account/balance','sys:account:balance')") + public ModelAndView balance(Model model) { + SysUser sysUser = (SysUser) SecurityUtil.currentUserObj(); + model.addAttribute("accountInfo", sysAccountService.getByUserId(sysUser.getUserId())); + return jumpPage(MODULE_PATH + "balance"); + } + + /** + * 获取账户存款视图 + * @return 存款视图 + */ + @GetMapping("deposit") + @ApiOperation(value = "获取账户存款视图") + public ModelAndView deposit() { + return jumpPage(MODULE_PATH + "deposit"); + } + + /** + * 获取账户取款视图 + * @return 取款视图 + */ + @GetMapping("withdrawal") + @ApiOperation(value = "获取账户取款视图") + public ModelAndView withdrawal() { + return jumpPage(MODULE_PATH + "withdrawal"); + } + /** * 存款 - * @param userId 用户编号 * @param money 金额 * @return Result */ @PostMapping("deposit") @ApiOperation(value = "存款", tags = "1.金融系统") -// @PreAuthorize("hasPermission('/system/account/edit','sys:account:edit')") - public Result deposit(String userId, String money) { + public Result deposit(String money) { System.out.println("存款"); - return addMoney(userId, money, true); + return addMoney(money, true); } /** * 取款 - * @param userId 用户编号 * @param money 金额 * @return Result */ @PostMapping("withdrawal") @ApiOperation(value = "取款", tags = "1.金融系统") -// @PreAuthorize("hasPermission('/system/account/edit','sys:account:edit')") - public Result withdrawal(String userId, String money) { + public Result withdrawal(String money) { System.out.println("取款"); - return addMoney(userId, money, false); + return addMoney(money, false); } /** * 用户账户余额操作 - * @param userId 用户编号 * @param money 金额 * @return Result */ - private Result addMoney(String userId, String money, boolean add) { + private Result addMoney(String money, boolean add) { long realMoney = 0; try { realMoney = Integer.parseInt(money); @@ -180,8 +211,15 @@ public class SysAccountController extends BaseController { } // SysAccount account = sysAccountService.getByUserId(userId); - SysAccount account = sysAccountService.getByUserId(userId); - if (account == null) { + SysUser sysUser = (SysUser) SecurityUtil.currentUserObj(); + if (sysUser == null) { + return failure("未登陆"); + } + + SysAccount account = null; + try { + account = sysAccountService.getByUserId(sysUser.getUserId()); + } catch (NullPointerException e) { return failure("不存在该账户"); } -- Gitee From df06c05e3e88f5c5b904a621db1e76579a68c3e5 Mon Sep 17 00:00:00 2001 From: Leo Date: Thu, 12 Aug 2021 16:53:35 +0800 Subject: [PATCH 3/3] feat: sync --- .../common/constant/AccountConstant.java | 25 +++ .../common/constant/ControllerConstant.java | 20 +- .../com/pearadmin/common/domain/DealType.java | 45 +++++ .../capital/account/AccountException.java | 15 ++ .../AccountInsufficientBalanceException.java | 15 ++ .../account/AccountNotFoundException.java | 15 ++ .../capital/account/MoneyErrorException.java | 15 ++ .../common/tools/secure/SecurityUtil.java | 4 +- .../capital/ApiCapitalAccountController.java | 189 ++++++++++++++++++ .../api/capital/ApiSysNewsController.java | 52 +++++ .../api/capital/ApiSysUserController.java | 50 +++++ .../SecureAuthenticationSuccessHandler.java | 2 +- .../secure/support/SecureCaptchaSupport.java | 4 + .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application.yml | 17 +- pear-entrance/src/test/java/PWD.java | 2 + ...ler.java => CapitalAccountController.java} | 66 +++--- .../controller/CapitalHistoryController.java | 138 +++++++++++++ ...roller.java => CapitalNewsController.java} | 48 ++--- .../{SysAccount.java => CapitalAccount.java} | 20 +- .../system/domain/CapitalHistory.java | 42 ++++ .../domain/{SysNews.java => CapitalNews.java} | 27 +-- ...tMapper.java => CapitalAccountMapper.java} | 21 +- .../system/mapper/CapitalHistoryMapper.java | 60 ++++++ ...NewsMapper.java => CapitalNewsMapper.java} | 16 +- .../system/mapper/xml/CapitaHistoryMapper.xml | 79 ++++++++ .../mapper/xml/CapitalAccountMapper.xml | 81 ++++++++ .../system/mapper/xml/CapitalNewsMapper.xml | 76 +++++++ .../system/mapper/xml/SysAccountMapper.xml | 117 ----------- .../system/mapper/xml/SysNewsMapper.xml | 96 --------- .../service/ICapitalAccountService.java | 82 ++++++++ .../service/ICapitalHistoryService.java | 74 +++++++ .../system/service/ICapitalNewsService.java | 74 +++++++ .../system/service/ISysAccountService.java | 74 ------- .../system/service/ISysNewsService.java | 67 ------- .../system/service/ISysUserService.java | 7 + ...pl.java => CapitalAccountServiceImpl.java} | 68 ++++--- .../service/impl/CapitalHistoryImpl.java | 102 ++++++++++ ...eImpl.java => CapitalNewsServiceImpl.java} | 40 ++-- .../service/impl/SysUserServiceImpl.java | 31 ++- sql/capital-account-boot.sql | 68 ------- ...ear-admin-boot.sql => capital-account.sql} | 105 +++++++++- 42 files changed, 1537 insertions(+), 614 deletions(-) create mode 100644 pear-common/src/main/java/com/pearadmin/common/constant/AccountConstant.java create mode 100644 pear-common/src/main/java/com/pearadmin/common/domain/DealType.java create mode 100644 pear-common/src/main/java/com/pearadmin/common/exception/capital/account/AccountException.java create mode 100644 pear-common/src/main/java/com/pearadmin/common/exception/capital/account/AccountInsufficientBalanceException.java create mode 100644 pear-common/src/main/java/com/pearadmin/common/exception/capital/account/AccountNotFoundException.java create mode 100644 pear-common/src/main/java/com/pearadmin/common/exception/capital/account/MoneyErrorException.java create mode 100755 pear-entrance/src/main/java/com/pearadmin/api/capital/ApiCapitalAccountController.java create mode 100755 pear-entrance/src/main/java/com/pearadmin/api/capital/ApiSysNewsController.java create mode 100644 pear-entrance/src/main/java/com/pearadmin/api/capital/ApiSysUserController.java rename pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/{SysAccountController.java => CapitalAccountController.java} (70%) create mode 100755 pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/CapitalHistoryController.java rename pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/{SysNewsController.java => CapitalNewsController.java} (64%) rename pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/{SysAccount.java => CapitalAccount.java} (58%) create mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/CapitalHistory.java rename pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/{SysNews.java => CapitalNews.java} (50%) rename pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/{SysAccountMapper.java => CapitalAccountMapper.java} (66%) create mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/CapitalHistoryMapper.java rename pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/{SysNewsMapper.java => CapitalNewsMapper.java} (71%) create mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/CapitaHistoryMapper.xml create mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/CapitalAccountMapper.xml create mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/CapitalNewsMapper.xml delete mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/SysAccountMapper.xml delete mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/SysNewsMapper.xml create mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ICapitalAccountService.java create mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ICapitalHistoryService.java create mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ICapitalNewsService.java delete mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysAccountService.java delete mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysNewsService.java rename pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/{SysAccountServiceImpl.java => CapitalAccountServiceImpl.java} (42%) create mode 100644 pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/CapitalHistoryImpl.java rename pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/{SysNewsServiceImpl.java => CapitalNewsServiceImpl.java} (58%) delete mode 100644 sql/capital-account-boot.sql rename sql/{pear-admin-boot.sql => capital-account.sql} (91%) diff --git a/pear-common/src/main/java/com/pearadmin/common/constant/AccountConstant.java b/pear-common/src/main/java/com/pearadmin/common/constant/AccountConstant.java new file mode 100644 index 0000000..77502da --- /dev/null +++ b/pear-common/src/main/java/com/pearadmin/common/constant/AccountConstant.java @@ -0,0 +1,25 @@ +package com.pearadmin.common.constant; + +/** + * 账 户 常 量 + * + * @author alin + * @date 2021/8/12 + */ +public class AccountConstant { + + public static String ACCOUNT_INSUFFICIENT_BALANCE= "账户余额不足"; + + public static String MONEY_ERROR = "金额错误"; + + public static String PAY_SUCCESS = "支付成功"; + + public static String PAY_FAILURE = "支付失败"; + + public static String ACCOUNT_NOT_FOUND = "账户不存在"; + + public static String CURRENT_ACCOUNT_NOT_FOUND = "当前账户不存在"; + + public static String TRANSFER_ACCOUNT_NOT_FOUND = "转账账户不存在"; + +} diff --git a/pear-common/src/main/java/com/pearadmin/common/constant/ControllerConstant.java b/pear-common/src/main/java/com/pearadmin/common/constant/ControllerConstant.java index d4f80a7..4afcbf8 100644 --- a/pear-common/src/main/java/com/pearadmin/common/constant/ControllerConstant.java +++ b/pear-common/src/main/java/com/pearadmin/common/constant/ControllerConstant.java @@ -4,26 +4,36 @@ package com.pearadmin.common.constant; * Describe: 接 口 静 态 常 量 * Author: 就 眠 仪 式 * CreateTime: 2019/10/23 - * */ + */ public class ControllerConstant { /** * 系统业务基础路径 - * */ + */ public final static String API_SYSTEM_PREFIX = "/system/"; /** * 代码生成基础路径 - * */ + */ public final static String API_GENERATOR_PREFIX = "/generate/"; /** * 定时任务基础路径 - * */ + */ public final static String API_SCHEDULE_PREFIX = "/schedule/"; /** * 工作流程基础路径 - * */ + */ public final static String API_PROCESS_PREFIX = "/process/"; + + /** + * 金融系统基础路径 + */ + public final static String API_CAPITAL_PREFIX = "/capital/"; + + /** + * API 基础路径 + */ + public final static String API_PREFIX = "/api/"; } diff --git a/pear-common/src/main/java/com/pearadmin/common/domain/DealType.java b/pear-common/src/main/java/com/pearadmin/common/domain/DealType.java new file mode 100644 index 0000000..160b010 --- /dev/null +++ b/pear-common/src/main/java/com/pearadmin/common/domain/DealType.java @@ -0,0 +1,45 @@ +package com.pearadmin.common.domain; + +import lombok.Getter; + +/** + * 交 易 类 型 + * + * @author 阿 林 + * @date 2021/8/12 + */ +public enum DealType { + + /** + * 存款 + */ + DEPOSIT(0, "存款"), + + /** + * 取款 + */ + WITHDRAWAL(1, "取款"), + + /** + * 转账 + */ + TRANSFER(2, "转账"); + + /** + * 类型代码 + */ + @Getter + private final int code; + + /** + * 交易类型 + */ + @Getter + private final String type; + + DealType(int code, String type) { + this.code = code; + this.type = type; + } + +} diff --git a/pear-common/src/main/java/com/pearadmin/common/exception/capital/account/AccountException.java b/pear-common/src/main/java/com/pearadmin/common/exception/capital/account/AccountException.java new file mode 100644 index 0000000..d94a9c5 --- /dev/null +++ b/pear-common/src/main/java/com/pearadmin/common/exception/capital/account/AccountException.java @@ -0,0 +1,15 @@ +package com.pearadmin.common.exception.capital.account; + +/** + * 账 户 异 常 基 类 + * + * @author 阿 林 + * @date 2021/8/12 + */ +public class AccountException extends RuntimeException { + + public AccountException(String message) { + super(message); + } + +} diff --git a/pear-common/src/main/java/com/pearadmin/common/exception/capital/account/AccountInsufficientBalanceException.java b/pear-common/src/main/java/com/pearadmin/common/exception/capital/account/AccountInsufficientBalanceException.java new file mode 100644 index 0000000..edc9458 --- /dev/null +++ b/pear-common/src/main/java/com/pearadmin/common/exception/capital/account/AccountInsufficientBalanceException.java @@ -0,0 +1,15 @@ +package com.pearadmin.common.exception.capital.account; + +/** + * 账 户 余 额 不 足 异 常 + * + * @author 阿 林 + * @date 2021/8/12 + */ +public class AccountInsufficientBalanceException extends AccountException { + + public AccountInsufficientBalanceException(String message) { + super(message); + } + +} diff --git a/pear-common/src/main/java/com/pearadmin/common/exception/capital/account/AccountNotFoundException.java b/pear-common/src/main/java/com/pearadmin/common/exception/capital/account/AccountNotFoundException.java new file mode 100644 index 0000000..716fa0b --- /dev/null +++ b/pear-common/src/main/java/com/pearadmin/common/exception/capital/account/AccountNotFoundException.java @@ -0,0 +1,15 @@ +package com.pearadmin.common.exception.capital.account; + +/** + * 账 户 未 找 到 异 常 + * + * @author 阿 林 + * @date 2021/8/12 + */ +public class AccountNotFoundException extends AccountException { + + public AccountNotFoundException(String message) { + super(message); + } + +} diff --git a/pear-common/src/main/java/com/pearadmin/common/exception/capital/account/MoneyErrorException.java b/pear-common/src/main/java/com/pearadmin/common/exception/capital/account/MoneyErrorException.java new file mode 100644 index 0000000..e75ea01 --- /dev/null +++ b/pear-common/src/main/java/com/pearadmin/common/exception/capital/account/MoneyErrorException.java @@ -0,0 +1,15 @@ +package com.pearadmin.common.exception.capital.account; + +/** + * 金 额 错 误 异 常 + * + * @author 阿 林 + * @date 2021/8/12 + */ +public class MoneyErrorException extends NullPointerException { + + public MoneyErrorException(String s) { + super(s); + } + +} diff --git a/pear-common/src/main/java/com/pearadmin/common/tools/secure/SecurityUtil.java b/pear-common/src/main/java/com/pearadmin/common/tools/secure/SecurityUtil.java index ec9b25d..11e607e 100644 --- a/pear-common/src/main/java/com/pearadmin/common/tools/secure/SecurityUtil.java +++ b/pear-common/src/main/java/com/pearadmin/common/tools/secure/SecurityUtil.java @@ -14,7 +14,7 @@ public class SecurityUtil { /** * 获取当前登录用户的信息 - * return Authentication 权鉴对象 + * @return Authentication 权鉴对象 * */ public static Authentication currentUser(){ Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); @@ -35,7 +35,7 @@ public class SecurityUtil { } /** * 获取当前登录用户对象 - * retrun SysUser + * @retrun SysUser * */ public static Object currentUserObj(){ return SecurityUtil.currentUser().getPrincipal(); diff --git a/pear-entrance/src/main/java/com/pearadmin/api/capital/ApiCapitalAccountController.java b/pear-entrance/src/main/java/com/pearadmin/api/capital/ApiCapitalAccountController.java new file mode 100755 index 0000000..e5984de --- /dev/null +++ b/pear-entrance/src/main/java/com/pearadmin/api/capital/ApiCapitalAccountController.java @@ -0,0 +1,189 @@ +package com.pearadmin.api.capital; + +import com.pearadmin.common.constant.AccountConstant; +import com.pearadmin.common.constant.ControllerConstant; +import com.pearadmin.common.domain.DealType; +import com.pearadmin.common.exception.capital.account.AccountException; +import com.pearadmin.common.exception.capital.account.AccountInsufficientBalanceException; +import com.pearadmin.common.exception.capital.account.AccountNotFoundException; +import com.pearadmin.common.exception.capital.account.MoneyErrorException; +import com.pearadmin.common.web.base.BaseController; +import com.pearadmin.common.web.domain.response.Result; +import com.pearadmin.system.domain.CapitalAccount; +import com.pearadmin.system.domain.CapitalHistory; +import com.pearadmin.system.domain.SysUser; +import com.pearadmin.system.service.ICapitalAccountService; +import com.pearadmin.system.service.ICapitalHistoryService; +import com.pearadmin.system.service.ISysUserService; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 账户 API + * + * @author 阿 林 + * @date 2021/8/11 + */ +@RestController +@RequestMapping(ControllerConstant.API_PREFIX + "account") +public class ApiCapitalAccountController extends BaseController { + + /** + * 账户模块服务 + */ + @Resource + private ICapitalAccountService accountService; + + /** + * 用户模块服务 + */ + @Resource + private ISysUserService sysUserService; + + + /** + * 交易记录模块服务 + */ + @Resource + private ICapitalHistoryService capitalHistoryService; + + /** + * 存款 + * + * @param userId 用户编号 + * @param money 金额 + * @return Result + */ + @PostMapping("deposit") + @ApiOperation(value = "存款", tags = "1.金融系统") + public Result deposit(String userId, String money) { + try { + boolean success = setMoney(userId, money, true) && + // 添加交易记录 + insertCapitalHistory(userId, DealType.DEPOSIT, new BigDecimal(money), null); + + return pay(success); + } catch (Exception e) { + return failure(e.getMessage()); + } + } + + /** + * 取款 + * + * @param userId 用户编号 + * @param money 金额 + * @return Result + */ + @PostMapping("withdrawal") + @ApiOperation(value = "取款", tags = "1.金融系统") + public Result withdrawal(String userId, String money) { + try { + boolean success = setMoney(userId, money, false) && + // 添加交易记录 + insertCapitalHistory(userId, DealType.WITHDRAWAL, new BigDecimal(money), null); + + return pay(success); + } catch (Exception e) { + return failure(e.getMessage()); + } + } + + /** + * 转账 + * + * @param curUserId 当前用户编号 + * @param transferUsername 转账用户编号 + * @param money 金额 + * @return Result + */ + @PostMapping("transfer") + @ApiOperation(value = "转账", tags = "1.金融系统") + public Result transfer(String curUserId, String transferUsername, String money) { + try { + SysUser user = sysUserService.getByUsername(transferUsername); + if (user == null) throw new AccountNotFoundException(AccountConstant.TRANSFER_ACCOUNT_NOT_FOUND); + + String byAccountId = accountService.getByUserId(user.getUserId()).getAccountId(); + boolean success = setMoney(curUserId, money, false) + && setMoney(user.getUserId(), money, true) + && insertCapitalHistory(curUserId, DealType.TRANSFER, new BigDecimal(money), byAccountId); + + return pay(success); + } catch (Exception e) { + return failure(e.getMessage()); + } + } + + /** + * 查询账户 + * + * @param userId 用户编号 + * @return 账户实体类 + */ + @GetMapping("info") + public Result info(String userId) { + CapitalAccount account = accountService.getByUserId(userId); + return account == null ? failure(AccountConstant.ACCOUNT_NOT_FOUND) : success(account); + } + + /** + * 设置账户余额 + * + * @param userId 用户编号 + * @param money 金额 + * @param add 是否增加 + * @return boolean + */ + private boolean setMoney(String userId, String money, boolean add) throws MoneyErrorException, AccountException { + // 验证数据有效性 + if (money == null) throw new MoneyErrorException(AccountConstant.MONEY_ERROR); + if (userId == null) throw new AccountException(AccountConstant.ACCOUNT_NOT_FOUND); + + BigDecimal realMoney = new BigDecimal(money); + CapitalAccount account = accountService.getByUserId(userId); + + // 验证用户是否为空 + if (account == null) throw new AccountException(AccountConstant.ACCOUNT_NOT_FOUND); + + // 进行余额增加或减少 + realMoney = add ? account.getMoney().add(realMoney) : account.getMoney().subtract(realMoney); + + // 验证余额 + if (realMoney.compareTo(new BigDecimal(0)) < 0) + throw new AccountInsufficientBalanceException(AccountConstant.ACCOUNT_INSUFFICIENT_BALANCE); + + // 设置余额 + account.setMoney(realMoney); + + return accountService.update(account); + } + + private Result pay(Boolean b) { + return decide(b, AccountConstant.PAY_SUCCESS, AccountConstant.PAY_FAILURE); + } + + /** + * 插入交易记录 + * + * @param accountId 账户编号 + * @param type 交易类型 + * @param money 交易金额 + * @param byAccountId 转账接受账户编号 + * @return boolean + */ + private boolean insertCapitalHistory(String accountId, DealType type, BigDecimal money, String byAccountId) { + CapitalHistory history = new CapitalHistory(); + history.setAccountId(accountId); + history.setType(type.getCode()); + history.setMoney(money); + history.setCreateTime(LocalDateTime.now()); + history.setByAccount(byAccountId); + return capitalHistoryService.save(history); + } + +} diff --git a/pear-entrance/src/main/java/com/pearadmin/api/capital/ApiSysNewsController.java b/pear-entrance/src/main/java/com/pearadmin/api/capital/ApiSysNewsController.java new file mode 100755 index 0000000..5683dc5 --- /dev/null +++ b/pear-entrance/src/main/java/com/pearadmin/api/capital/ApiSysNewsController.java @@ -0,0 +1,52 @@ +package com.pearadmin.api.capital; + +import com.pearadmin.common.constant.ControllerConstant; +import com.pearadmin.common.web.base.BaseController; +import com.pearadmin.common.web.domain.response.Result; +import com.pearadmin.system.domain.CapitalNews; +import com.pearadmin.system.service.ICapitalNewsService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 新闻 API + * + * @author 阿 林 + * @date 2021/8/12 + */ +@RestController +@RequestMapping(ControllerConstant.API_PREFIX + "news") +public class ApiSysNewsController extends BaseController { + + @Resource + private ICapitalNewsService capitalNewsService; + + /** + * 查询新闻列表 + * + * @param capitalNews 新闻实体类 + * @return Result + */ + @GetMapping("list") + public Result list(CapitalNews capitalNews) { + List capitalNewsList = capitalNewsService.list(capitalNews); + return success(capitalNewsList); + } + + /** + * 查看新闻详情 + * + * @param id 新闻编号 + * @return SysNews + */ + @GetMapping("info") + public Result info(String id) { + CapitalNews capitalNews = capitalNewsService.getById(id); + return success(capitalNews); + } + +} diff --git a/pear-entrance/src/main/java/com/pearadmin/api/capital/ApiSysUserController.java b/pear-entrance/src/main/java/com/pearadmin/api/capital/ApiSysUserController.java new file mode 100644 index 0000000..cd6c264 --- /dev/null +++ b/pear-entrance/src/main/java/com/pearadmin/api/capital/ApiSysUserController.java @@ -0,0 +1,50 @@ +package com.pearadmin.api.capital; + +import com.pearadmin.common.constant.ControllerConstant; +import com.pearadmin.common.web.base.BaseController; +import com.pearadmin.common.web.domain.response.Result; +import com.pearadmin.system.domain.SysUser; +import com.pearadmin.system.service.ISysUserService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * 系统用户 API + * + * @author 阿 林 + * @date 2021/8/12 + */ +@RestController +//@CrossOrigin //解决跨域问题 +@RequestMapping(ControllerConstant.API_PREFIX + "user") +public class ApiSysUserController extends BaseController { + + /** + * Describe: 用户模块服务 + */ + @Resource + private ISysUserService sysUserService; + + /** + * Describe: 获取用户详细信息 + * Param id + * Return 用户详细信息 + */ + @GetMapping("info") + public Result info(String id) { + SysUser sysUser = sysUserService.getById(id); + return success(sysUser); + } + + /** + * Describe: 修改用户信息 + * Param id + * Return 用户详细信息 + */ + @PostMapping("update") + public Result update(SysUser sysUser) { + return Result.decide(sysUserService.update(sysUser)); + } + +} diff --git a/pear-entrance/src/main/java/com/pearadmin/secure/process/SecureAuthenticationSuccessHandler.java b/pear-entrance/src/main/java/com/pearadmin/secure/process/SecureAuthenticationSuccessHandler.java index d2ad873..d829552 100644 --- a/pear-entrance/src/main/java/com/pearadmin/secure/process/SecureAuthenticationSuccessHandler.java +++ b/pear-entrance/src/main/java/com/pearadmin/secure/process/SecureAuthenticationSuccessHandler.java @@ -54,7 +54,7 @@ public class SecureAuthenticationSuccessHandler implements AuthenticationSuccess SysUser currentUser = (SysUser) authentication.getPrincipal(); currentUser.setLastTime(LocalDateTime.now()); request.getSession().setAttribute("currentUser", authentication.getPrincipal()); - Result result = Result.success("登录成功"); + Result result = Result.success("登录成功", ((SysUser) SecurityUtil.currentUser().getPrincipal()).getUserId()); ServletUtil.write(JSON.toJSONString(result)); } } diff --git a/pear-entrance/src/main/java/com/pearadmin/secure/support/SecureCaptchaSupport.java b/pear-entrance/src/main/java/com/pearadmin/secure/support/SecureCaptchaSupport.java index 6dbdb64..5111c0e 100644 --- a/pear-entrance/src/main/java/com/pearadmin/secure/support/SecureCaptchaSupport.java +++ b/pear-entrance/src/main/java/com/pearadmin/secure/support/SecureCaptchaSupport.java @@ -32,6 +32,10 @@ public class SecureCaptchaSupport extends OncePerRequestFilter implements Filter protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { if (method.equalsIgnoreCase(request.getMethod()) && defaultFilterProcessUrl.equals(request.getServletPath())) { String Captcha = ServletUtil.getRequest().getParameter("captcha"); + + // FIXME: 2021/8/12 APP 验证码接受不到,手动设置 + request.getSession().setAttribute("captcha",Captcha); + response.setContentType("application/json;charset=UTF-8"); if (StringUtil.isEmpty(Captcha)){ response.getWriter().write(JSON.toJSONString(Result.failure("验证码不能为空!"))); diff --git a/pear-entrance/src/main/resources/application-dev.yml b/pear-entrance/src/main/resources/application-dev.yml index 35653d2..1c1ea3a 100644 --- a/pear-entrance/src/main/resources/application-dev.yml +++ b/pear-entrance/src/main/resources/application-dev.yml @@ -30,7 +30,7 @@ spring: datasource: # 主 库 配 置 master: - url: jdbc:mysql://127.0.0.1:3306/pear-admin?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true + url: jdbc:mysql://127.0.0.1:3306/capital-account?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true username: root password: root druid: diff --git a/pear-entrance/src/main/resources/application.yml b/pear-entrance/src/main/resources/application.yml index 68e0b21..2c7edcd 100644 --- a/pear-entrance/src/main/resources/application.yml +++ b/pear-entrance/src/main/resources/application.yml @@ -1,7 +1,7 @@ # Tomcat server: # 端 口 - port: 8080 + port: 9750 # Servlet servlet: # Session @@ -69,13 +69,14 @@ pear: remember-key: PEAR_REMEMBER # 不 需 要 权 限 拦 截 的 接 口 配 置 open-api: - - /login/** # 开放登录接口 - - /system/captcha/** # 开放验证码接口 - - /system/account/** # 开放账户接口 - - /assets/** # 开放静态资源 - - /admin/** # 开放静态资源 - - /component/** # 开放静态资源 - - /favicon.ico # 开放FAVICON + - /login/** # 开放登录接口 + - /system/captcha/** # 开放验证码接口 + - /system/account/** # 开放账户接口 + - /assets/** # 开放静态资源 + - /admin/** # 开放静态资源 + - /component/** # 开放静态资源 + - /favicon.ico # 开放FAVICON + - /api/** # 开放 api # 上传配置 upload: diff --git a/pear-entrance/src/test/java/PWD.java b/pear-entrance/src/test/java/PWD.java index e1ba8e3..8f9652e 100644 --- a/pear-entrance/src/test/java/PWD.java +++ b/pear-entrance/src/test/java/PWD.java @@ -18,6 +18,8 @@ public class PWD { users.add("ykl"); users.add("myy"); users.add("wxx"); + users.add("wrl"); + users.add("leo"); BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysAccountController.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/CapitalAccountController.java similarity index 70% rename from pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysAccountController.java rename to pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/CapitalAccountController.java index 1d705d9..aeff8a9 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysAccountController.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/CapitalAccountController.java @@ -7,9 +7,9 @@ import com.pearadmin.common.web.base.BaseController; import com.pearadmin.common.web.domain.request.PageDomain; import com.pearadmin.common.web.domain.response.Result; import com.pearadmin.common.web.domain.response.module.ResultTable; -import com.pearadmin.system.domain.SysAccount; +import com.pearadmin.system.domain.CapitalAccount; import com.pearadmin.system.domain.SysUser; -import com.pearadmin.system.service.ISysAccountService; +import com.pearadmin.system.service.ICapitalAccountService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; @@ -27,19 +27,19 @@ import javax.annotation.Resource; */ @RestController @Api(tags = {"1.系统账户"}) -@RequestMapping(ControllerConstant.API_SYSTEM_PREFIX + "account") -public class SysAccountController extends BaseController { +@RequestMapping(ControllerConstant.API_CAPITAL_PREFIX + "account") +public class CapitalAccountController extends BaseController { /** * Describe: 基础路径 */ - private static String MODULE_PATH = "system/account/"; + private static final String MODULE_PATH = "capital/account/"; /** * Describe: 账户模块服务 */ @Resource - private ISysAccountService sysAccountService; + private ICapitalAccountService capitalAccountService; /** * Describe: 获取账户列表视图 @@ -48,7 +48,7 @@ public class SysAccountController extends BaseController { */ @GetMapping("main") @ApiOperation(value = "获取账户列表视图") - @PreAuthorize("hasPermission('/system/account/main','sys:account:main')") + @PreAuthorize("hasPermission('/capital/account/main','capital:account:main')") public ModelAndView main() { return jumpPage(MODULE_PATH + "main"); } @@ -60,9 +60,9 @@ public class SysAccountController extends BaseController { */ @GetMapping("data") @ApiOperation(value = "获取账户列表数据") - @PreAuthorize("hasPermission('/system/account/data','sys:account:data')") - public ResultTable data(PageDomain pageDomain, SysAccount param) { - PageInfo pageInfo = sysAccountService.page(param, pageDomain); + @PreAuthorize("hasPermission('/capital/account/data','capital:account:data')") + public ResultTable data(PageDomain pageDomain, CapitalAccount param) { + PageInfo pageInfo = capitalAccountService.page(param, pageDomain); return pageTable(pageInfo.getList(), pageInfo.getTotal()); } @@ -73,7 +73,7 @@ public class SysAccountController extends BaseController { */ @GetMapping("add") @ApiOperation(value = "获取账户新增视图") - @PreAuthorize("hasPermission('/system/account/add','sys:account:add')") + @PreAuthorize("hasPermission('/capital/account/add','capital:account:add')") public ModelAndView add() { return jumpPage(MODULE_PATH + "add"); } @@ -85,9 +85,9 @@ public class SysAccountController extends BaseController { */ @PostMapping("save") @ApiOperation(value = "保存账户数据") - @PreAuthorize("hasPermission('/system/account/add','sys:account:add')") - public Result save(@RequestBody SysAccount sysAccount) { - return decide(sysAccountService.save(sysAccount)); + @PreAuthorize("hasPermission('/capital/account/add','capital:account:add')") + public Result save(@RequestBody CapitalAccount capitalAccount) { + return decide(capitalAccountService.save(capitalAccount)); } /** @@ -97,9 +97,9 @@ public class SysAccountController extends BaseController { */ @GetMapping("edit") @ApiOperation(value = "获取账户修改视图") - @PreAuthorize("hasPermission('/system/account/edit','sys:account:edit')") + @PreAuthorize("hasPermission('/capital/account/edit','capital:account:edit')") public ModelAndView edit(ModelAndView modelAndView, String accountId) { - modelAndView.addObject("sysAccount", sysAccountService.getById(accountId)); + modelAndView.addObject("capitalAccount", capitalAccountService.getByAccountId(accountId)); modelAndView.setViewName(MODULE_PATH + "edit"); return modelAndView; } @@ -111,9 +111,9 @@ public class SysAccountController extends BaseController { */ @PutMapping("update") @ApiOperation(value = "修改账户数据") - @PreAuthorize("hasPermission('/system/account/edit','sys:account:edit')") - public Result update(@RequestBody SysAccount sysAccount) { - return decide(sysAccountService.update(sysAccount)); + @PreAuthorize("hasPermission('/capital/account/edit','capital:account:edit')") + public Result update(@RequestBody CapitalAccount capitalAccount) { + return decide(capitalAccountService.update(capitalAccount)); } /** @@ -123,9 +123,9 @@ public class SysAccountController extends BaseController { */ @DeleteMapping("remove/{id}") @ApiOperation(value = "删除账户数据") - @PreAuthorize("hasPermission('/system/account/remove','sys:account:remove')") + @PreAuthorize("hasPermission('/capital/account/remove','capital:account:remove')") public Result remove(@PathVariable String id) { - return decide(sysAccountService.remove(id)); + return decide(capitalAccountService.remove(id)); } /** @@ -135,9 +135,9 @@ public class SysAccountController extends BaseController { */ @DeleteMapping("batchRemove/{ids}") @ApiOperation(value = "批量删除账户数据") - @PreAuthorize("hasPermission('/system/account/remove','sys:account:remove')") + @PreAuthorize("hasPermission('/capital/account/remove','capital:account:remove')") public Result batchRemove(@PathVariable String ids) { - return decide(sysAccountService.batchRemove(ids.split(","))); + return decide(capitalAccountService.batchRemove(ids.split(","))); } /** @@ -146,10 +146,10 @@ public class SysAccountController extends BaseController { */ @GetMapping("balance") @ApiOperation(value = "获取我的余额视图") - @PreAuthorize("hasPermission('/system/account/balance','sys:account:balance')") + @PreAuthorize("hasPermission('/capital/account/balance','capital:account:balance')") public ModelAndView balance(Model model) { SysUser sysUser = (SysUser) SecurityUtil.currentUserObj(); - model.addAttribute("accountInfo", sysAccountService.getByUserId(sysUser.getUserId())); + model.addAttribute("accountInfo", capitalAccountService.getByUserId(sysUser.getUserId())); return jumpPage(MODULE_PATH + "balance"); } @@ -210,33 +210,29 @@ public class SysAccountController extends BaseController { return failure("金额错误"); } -// SysAccount account = sysAccountService.getByUserId(userId); +// SysAccount account = capitalAccountService.getByUserId(userId); SysUser sysUser = (SysUser) SecurityUtil.currentUserObj(); if (sysUser == null) { return failure("未登陆"); } - SysAccount account = null; + CapitalAccount account = null; try { - account = sysAccountService.getByUserId(sysUser.getUserId()); + account = capitalAccountService.getByUserId(sysUser.getUserId()); } catch (NullPointerException e) { return failure("不存在该账户"); } // TODO: 2021/8/10 交易记录 - 事务 - realMoney = add(account.getBalance(), realMoney, add); +// realMoney = add(account.getMoney(), realMoney, add); if (realMoney < 0) { return failure("账户余额不足"); } - account.setBalance(realMoney); - return decide(sysAccountService.update(account)); - } - - private long add(long n1, long n2, boolean add) { - return add ? n1 + n2 : n1 - n2; +// account.getMoney(realMoney); + return decide(capitalAccountService.update(account)); } } diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/CapitalHistoryController.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/CapitalHistoryController.java new file mode 100755 index 0000000..66fb9db --- /dev/null +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/CapitalHistoryController.java @@ -0,0 +1,138 @@ +package com.pearadmin.system.controller; + +import com.github.pagehelper.PageInfo; +import com.pearadmin.common.constant.ControllerConstant; +import com.pearadmin.common.web.base.BaseController; +import com.pearadmin.common.web.domain.request.PageDomain; +import com.pearadmin.common.web.domain.response.Result; +import com.pearadmin.common.web.domain.response.module.ResultTable; +import com.pearadmin.system.domain.CapitalHistory; +import com.pearadmin.system.service.ICapitalHistoryService; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.annotation.Resource; + +/** + * 交 易 记 录 控 制 器 + * + * @author 阿 林 + * @date 2021/8/12 + */ +@RestController +@RequestMapping(ControllerConstant.API_CAPITAL_PREFIX + "history") +public class CapitalHistoryController extends BaseController { + + /** + * Describe: 基础路径 + */ + private static final String MODULE_PATH = "capital/news/"; + + /** + * Describe: 交易记录模块服务 + */ + @Resource + private ICapitalHistoryService capitalHistoryService; + + /** + * Describe: 获取交易记录列表视图 + * Param ModelAndView + * Return 用户列表视图 + */ + @GetMapping("main") + @ApiOperation(value = "获取交易记录列表视图") + @PreAuthorize("hasPermission('/capital/news/main','capital:news:main')") + public ModelAndView main() { + return jumpPage(MODULE_PATH + "main"); + } + + /** + * Describe: 获取交易记录列表数据 + * Param SysNews PageDomain + * Return 交易记录列表数据 + */ + @GetMapping("data") + @ApiOperation(value = "获取交易记录列表数据") + @PreAuthorize("hasPermission('/capital/news/data','capital:news:data')") + public ResultTable data(PageDomain pageDomain, CapitalHistory param) { + PageInfo pageInfo = capitalHistoryService.page(param, pageDomain); + return pageTable(pageInfo.getList(), pageInfo.getTotal()); + } + + /** + * Describe: 获取交易记录新增视图 + * Param ModelAndView + * Return 交易记录新增视图 + */ + @GetMapping("add") + @ApiOperation(value = "获取交易记录新增视图") + @PreAuthorize("hasPermission('/capital/news/add','capital:news:add')") + public ModelAndView add() { + return jumpPage(MODULE_PATH + "add"); + } + + /** + * Describe: 保存交易记录信息 + * Param SysNews + * Return 执行结果 + */ + @PostMapping("save") + @ApiOperation(value = "保存交易记录数据") + @PreAuthorize("hasPermission('/capital/news/add','capital:news:add')") + public Result save(@RequestBody CapitalHistory capitalHistory) { + return decide(capitalHistoryService.save(capitalHistory)); + } + + /** + * Describe: 获取交易记录修改视图 + * Param ModelAndView + * Return 交易记录修改视图 + */ + @GetMapping("edit") + @ApiOperation(value = "获取交易记录修改视图") + @PreAuthorize("hasPermission('/capital/news/edit','capital:news:edit')") + public ModelAndView edit(ModelAndView modelAndView, String newsId) { + modelAndView.addObject("capitalHistory", capitalHistoryService.getById(newsId)); + modelAndView.setViewName(MODULE_PATH + "edit"); + return modelAndView; + } + + /** + * Describe: 修改交易记录信息 + * Param SysNews + * Return 执行结果 + */ + @PutMapping("update") + @ApiOperation(value = "修改交易记录数据") + @PreAuthorize("hasPermission('/capital/news/edit','capital:news:edit')") + public Result update(@RequestBody CapitalHistory capitalHistory) { + return decide(capitalHistoryService.update(capitalHistory)); + } + + /** + * Describe: 用户删除接口 + * Param: id + * Return: Result + */ + @DeleteMapping("remove/{id}") + @ApiOperation(value = "删除交易记录数据") + @PreAuthorize("hasPermission('/capital/news/remove','capital:news:remove')") + public Result remove(@PathVariable String id) { + return decide(capitalHistoryService.remove(id)); + } + + /** + * Describe: 用户批量删除接口 + * Param: ids + * Return: Result + */ + @DeleteMapping("batchRemove/{ids}") + @ApiOperation(value = "批量删除交易记录数据") + @PreAuthorize("hasPermission('/capital/news/remove','capital:news:remove')") + public Result batchRemove(@PathVariable String ids) { + return decide(capitalHistoryService.batchRemove(ids.split(","))); + } + +} diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysNewsController.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/CapitalNewsController.java similarity index 64% rename from pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysNewsController.java rename to pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/CapitalNewsController.java index 72030b5..17739b4 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/SysNewsController.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/controller/CapitalNewsController.java @@ -6,8 +6,8 @@ import com.pearadmin.common.web.base.BaseController; import com.pearadmin.common.web.domain.request.PageDomain; import com.pearadmin.common.web.domain.response.Result; import com.pearadmin.common.web.domain.response.module.ResultTable; -import com.pearadmin.system.domain.SysNews; -import com.pearadmin.system.service.ISysNewsService; +import com.pearadmin.system.domain.CapitalNews; +import com.pearadmin.system.service.ICapitalNewsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; @@ -20,23 +20,23 @@ import javax.annotation.Resource; * 新 闻 控 制 器 * * @author 阿 林 - * @date 2021/8/9 + * @date 2021/8/9 */ @RestController @Api(tags = {"2.新闻"}) -@RequestMapping(ControllerConstant.API_SYSTEM_PREFIX + "news") -public class SysNewsController extends BaseController { +@RequestMapping(ControllerConstant.API_CAPITAL_PREFIX + "news") +public class CapitalNewsController extends BaseController { /** * Describe: 基础路径 */ - private static String MODULE_PATH = "system/news/"; + private static final String MODULE_PATH = "capital/news/"; /** * Describe: 新闻模块服务 */ @Resource - private ISysNewsService sysNewsService; + private ICapitalNewsService capitalNewsService; /** * Describe: 获取新闻列表视图 @@ -45,7 +45,7 @@ public class SysNewsController extends BaseController { */ @GetMapping("main") @ApiOperation(value = "获取新闻列表视图") - @PreAuthorize("hasPermission('/system/news/main','sys:news:main')") + @PreAuthorize("hasPermission('/capital/news/main','capital:news:main')") public ModelAndView main() { return jumpPage(MODULE_PATH + "main"); } @@ -57,9 +57,9 @@ public class SysNewsController extends BaseController { */ @GetMapping("data") @ApiOperation(value = "获取新闻列表数据") - @PreAuthorize("hasPermission('/system/news/data','sys:news:data')") - public ResultTable data(PageDomain pageDomain, SysNews param) { - PageInfo pageInfo = sysNewsService.page(param, pageDomain); + @PreAuthorize("hasPermission('/capital/news/data','capital:news:data')") + public ResultTable data(PageDomain pageDomain, CapitalNews param) { + PageInfo pageInfo = capitalNewsService.page(param, pageDomain); return pageTable(pageInfo.getList(), pageInfo.getTotal()); } @@ -70,7 +70,7 @@ public class SysNewsController extends BaseController { */ @GetMapping("add") @ApiOperation(value = "获取新闻新增视图") - @PreAuthorize("hasPermission('/system/news/add','sys:news:add')") + @PreAuthorize("hasPermission('/capital/news/add','capital:news:add')") public ModelAndView add() { return jumpPage(MODULE_PATH + "add"); } @@ -82,9 +82,9 @@ public class SysNewsController extends BaseController { */ @PostMapping("save") @ApiOperation(value = "保存新闻数据") - @PreAuthorize("hasPermission('/system/news/add','sys:news:add')") - public Result save(@RequestBody SysNews sysNews) { - return decide(sysNewsService.save(sysNews)); + @PreAuthorize("hasPermission('/capital/news/add','capital:news:add')") + public Result save(@RequestBody CapitalNews capitalNews) { + return decide(capitalNewsService.save(capitalNews)); } /** @@ -94,9 +94,9 @@ public class SysNewsController extends BaseController { */ @GetMapping("edit") @ApiOperation(value = "获取新闻修改视图") - @PreAuthorize("hasPermission('/system/news/edit','sys:news:edit')") + @PreAuthorize("hasPermission('/capital/news/edit','capital:news:edit')") public ModelAndView edit(ModelAndView modelAndView, String newsId) { - modelAndView.addObject("sysNews", sysNewsService.getById(newsId)); + modelAndView.addObject("capitalNews", capitalNewsService.getById(newsId)); modelAndView.setViewName(MODULE_PATH + "edit"); return modelAndView; } @@ -108,9 +108,9 @@ public class SysNewsController extends BaseController { */ @PutMapping("update") @ApiOperation(value = "修改新闻数据") - @PreAuthorize("hasPermission('/system/news/edit','sys:news:edit')") - public Result update(@RequestBody SysNews sysNews) { - return decide(sysNewsService.update(sysNews)); + @PreAuthorize("hasPermission('/capital/news/edit','capital:news:edit')") + public Result update(@RequestBody CapitalNews capitalNews) { + return decide(capitalNewsService.update(capitalNews)); } /** @@ -120,9 +120,9 @@ public class SysNewsController extends BaseController { */ @DeleteMapping("remove/{id}") @ApiOperation(value = "删除新闻数据") - @PreAuthorize("hasPermission('/system/news/remove','sys:news:remove')") + @PreAuthorize("hasPermission('/capital/news/remove','capital:news:remove')") public Result remove(@PathVariable String id) { - return decide(sysNewsService.remove(id)); + return decide(capitalNewsService.remove(id)); } /** @@ -132,9 +132,9 @@ public class SysNewsController extends BaseController { */ @DeleteMapping("batchRemove/{ids}") @ApiOperation(value = "批量删除新闻数据") - @PreAuthorize("hasPermission('/system/news/remove','sys:news:remove')") + @PreAuthorize("hasPermission('/capital/news/remove','capital:news:remove')") public Result batchRemove(@PathVariable String ids) { - return decide(sysNewsService.batchRemove(ids.split(","))); + return decide(capitalNewsService.batchRemove(ids.split(","))); } } diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/SysAccount.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/CapitalAccount.java similarity index 58% rename from pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/SysAccount.java rename to pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/CapitalAccount.java index a557db9..4e0ec5f 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/SysAccount.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/CapitalAccount.java @@ -4,6 +4,8 @@ import com.pearadmin.common.web.base.BaseDomain; import lombok.Data; import org.apache.ibatis.type.Alias; +import java.math.BigDecimal; + /** * 账 户 实 体 类 * @@ -11,13 +13,13 @@ import org.apache.ibatis.type.Alias; * @date 2021/8/9 */ @Data -@Alias("SysAccount") -public class SysAccount extends BaseDomain { +@Alias("CapitalAccount") +public class CapitalAccount extends BaseDomain { /** * 账户编号 */ - private String id; + private String accountId; /** * 用户编号 @@ -27,16 +29,6 @@ public class SysAccount extends BaseDomain { /** * 余额 */ - private Long balance; - - /** - * 账户开启状态 - */ - private String enable; + private BigDecimal money; - /** - * 逻辑删除 - */ - private boolean deleted; - } diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/CapitalHistory.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/CapitalHistory.java new file mode 100644 index 0000000..4cfe5c1 --- /dev/null +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/CapitalHistory.java @@ -0,0 +1,42 @@ +package com.pearadmin.system.domain; + +import com.pearadmin.common.web.base.BaseDomain; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 交易记录实体类 + * + * @author 阿 林 + * @date 2021/8/12 + */ +@Data +public class CapitalHistory extends BaseDomain { + + /** + * 交易流水号 + */ + private Long id; + + /** + * 交易账户 + */ + private String accountId; + + /** + * 交易类型(0-存款1-取款2-转账) + */ + private int type; + + /** + * 交易金额 + */ + private BigDecimal money; + + /** + * 转账接受账户号 + */ + private String byAccount; + +} diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/SysNews.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/CapitalNews.java similarity index 50% rename from pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/SysNews.java rename to pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/CapitalNews.java index d972cde..83632b6 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/SysNews.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/domain/CapitalNews.java @@ -11,37 +11,32 @@ import org.apache.ibatis.type.Alias; * @date 2021/8/9 */ @Data -@Alias("SysNews") -public class SysNews extends BaseDomain { +@Alias("CapitalNews") +public class CapitalNews extends BaseDomain { /** - * 账户编号 + * 新闻编号 */ - private String id; + private Long id; /** - * 标题 + * 新闻标题 */ private String title; /** - * 摘要 + * 新闻图片 */ - private String newsAbstract; + private String img; /** - * 内容 + * 浏览人数 */ - private String mainText; + private int browseNum; /** - * 发布日期 + * 新闻内容 */ - private String releaseDate; - - /** - * 逻辑删除 - */ - private boolean deleted; + private String content; } diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/SysAccountMapper.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/CapitalAccountMapper.java similarity index 66% rename from pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/SysAccountMapper.java rename to pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/CapitalAccountMapper.java index 6a784a8..af7f14a 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/SysAccountMapper.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/CapitalAccountMapper.java @@ -1,6 +1,6 @@ package com.pearadmin.system.mapper; -import com.pearadmin.system.domain.SysAccount; +import com.pearadmin.system.domain.CapitalAccount; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -13,49 +13,50 @@ import java.util.List; * @date 2021/8/10 */ @Mapper -public interface SysAccountMapper { +public interface CapitalAccountMapper { /** * 查询账户列表 * @param param 参数实体类 * @return List */ - List selectList(SysAccount param); + List selectList(CapitalAccount param); /** * 添加账户数据 * @param sysAccount 实体类 * @return 执行结果 */ - Integer insert(SysAccount sysAccount); + Integer insert(CapitalAccount sysAccount); /** - * 根据 id 编号查询账户 - * @param id 编号 + * 根据 账户编号 获取账户信息 + * + * @param accountId 账户编号 * @return SysAccount 实体类 */ - SysAccount selectById(@Param("id") String id); + CapitalAccount selectByAccountId(@Param("accountId") String accountId); /** * 根据 userId 用户编号查询账户 * @param userId 用户编号 * @return SysAccount 实体类 */ - SysAccount selectByUserId(String userId); + CapitalAccount selectByUserId(String userId); /** * 根据 id 编号修改账户 * @param sysAccount 实体类 * @return 执行结果 */ - Integer updateById(SysAccount sysAccount); + Integer updateById(CapitalAccount sysAccount); /** * 根据 id 编号删除账户 * @param id 编号 * @return 执行结果 */ - Integer deleteById(String id); + Integer deleteByAccountId(String id); /** * 根据 id 编号批量删除账户 diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/CapitalHistoryMapper.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/CapitalHistoryMapper.java new file mode 100644 index 0000000..13070b7 --- /dev/null +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/CapitalHistoryMapper.java @@ -0,0 +1,60 @@ +package com.pearadmin.system.mapper; + +import com.pearadmin.system.domain.CapitalHistory; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 交易信息接口 + * + * @author 阿 林 + * @date 2021/8/12 + */ +@Mapper +public interface CapitalHistoryMapper { + + /** + * 查询交易信息列表 + * @param param 参数实体类 + * @return List + */ + List selectList(CapitalHistory param); + + /** + * 添加交易信息数据 + * @param capitalHistory 实体类 + * @return 执行结果 + */ + Integer insert(CapitalHistory capitalHistory); + + /** + * 根据 id 编号查询交易信息 + * @param id 编号 + * @return SysNews 实体类 + */ + CapitalHistory selectById(@Param("id") String id); + + /** + * 根据 id 编号修改交易信息 + * @param capitalHistory 实体类 + * @return 执行结果 + */ + Integer updateById(CapitalHistory capitalHistory); + + /** + * 根据 id 编号删除交易信息 + * @param id 编号 + * @return 执行结果 + */ + Integer deleteById(String id); + + /** + * 根据 id 编号批量删除交易信息 + * @param ids 编号数组 + * @return 执行结果 + */ + Integer deleteByIds(String[] ids); + +} diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/SysNewsMapper.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/CapitalNewsMapper.java similarity index 71% rename from pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/SysNewsMapper.java rename to pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/CapitalNewsMapper.java index 4aee01d..7e9e86b 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/SysNewsMapper.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/CapitalNewsMapper.java @@ -1,6 +1,6 @@ package com.pearadmin.system.mapper; -import com.pearadmin.system.domain.SysNews; +import com.pearadmin.system.domain.CapitalNews; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -13,35 +13,35 @@ import java.util.List; * @date 2021/8/9 */ @Mapper -public interface SysNewsMapper { +public interface CapitalNewsMapper { /** * 查询新闻列表 * @param param 参数实体类 * @return List */ - List selectList(SysNews param); + List selectList(CapitalNews param); /** * 添加新闻数据 - * @param sysNews 实体类 + * @param capitalNews 实体类 * @return 执行结果 */ - Integer insert(SysNews sysNews); + Integer insert(CapitalNews capitalNews); /** * 根据 id 编号查询新闻 * @param id 编号 * @return SysNews 实体类 */ - SysNews selectById(@Param("id") String id); + CapitalNews selectById(@Param("id") String id); /** * 根据 id 编号修改新闻 - * @param sysNews 实体类 + * @param capitalNews 实体类 * @return 执行结果 */ - Integer updateById(SysNews sysNews); + Integer updateById(CapitalNews capitalNews); /** * 根据 id 编号删除新闻 diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/CapitaHistoryMapper.xml b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/CapitaHistoryMapper.xml new file mode 100644 index 0000000..f3f62ff --- /dev/null +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/CapitaHistoryMapper.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + select`id`,`account_id`,`type`,`create_time`,`by_account`,`remark` from `capital_history` + + + + + + + + insert into `capital_history` + + `account_id`, + `type`, + `create_time`, + `by_account`, + `money`, + `remark`, + + + #{accountId}, + #{type}, + #{createTime}, + #{byAccount}, + #{money}, + #{remark}, + + + + + update `capital_history` + + `account_id` = #{accountId}, + `type` = #{type}, + `create_time` = #{createTime}, + `by_account` = #{byAccount}, + `by_account` = #{money}, + `remark` = #{remark}, + + where `id` = #{id} + + + + + delete from `capital_history` where `id` = #{id} + + + + + delete from `capital_history` where `id` in + + #{id} + + + + \ No newline at end of file diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/CapitalAccountMapper.xml b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/CapitalAccountMapper.xml new file mode 100644 index 0000000..def8e62 --- /dev/null +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/CapitalAccountMapper.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + select`account_id`,`user_id`,`create_time`,`money`,`remark` from `capital_account` + + + + + + + + + + + + + insert into `capital_account` + + `account_id`, + `user_id`, + `create_time`, + `money`, + `remark`, + + + #{accountId}, + #{userId}, + #{createTime}, + #{money}, + #{remark}, + + + + + + update `capital_account` + + `user_id` = #{userId}, + `create_time` = #{createTime}, + `money` = #{money}, + `remark` = #{remark}, + + where `account_id` = #{accountId} + + + + + delete from `capital_account` where `account_id` = #{accountId} + + + + + delete from `capital_account` where `account_id` in + + #{accountId} + + + + \ No newline at end of file diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/CapitalNewsMapper.xml b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/CapitalNewsMapper.xml new file mode 100644 index 0000000..db49483 --- /dev/null +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/CapitalNewsMapper.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + select`id`,`title`,`img`,`create_time`,`browse_num`,`content` from `capital_news` + + + + + + + + insert into `capital_news` + + `title`, + `img`, + `create_time`, + `browse_num`, + `content`, + + + #{title}, + #{img}, + #{createTime}, + #{browseNum}, + #{content}, + + + + + update `capital_news` + + `title` = #{title}, + `img` = #{img}, + `create_time` = #{createTime}, + `browse_num` = #{browseNum}, + `content` = #{content}, + + where `id` = #{id} + + + + + delete from `capital_news` where `id` = #{id} + + + + + delete from `capital_news` where `id` in + + #{id} + + + + \ No newline at end of file diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/SysAccountMapper.xml b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/SysAccountMapper.xml deleted file mode 100644 index 5f5877e..0000000 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/SysAccountMapper.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - insert into sys_account - - - id, - - - user_id, - - - balance, - - - enable, - - - deleted, - - - remark, - - - - - #{id}, - - - #{userId}, - - - #{balance}, - - - #{enable}, - - - #{deleted}, - - - #{remark}, - - - - - - - update sys_account - - - balance = #{balance}, - - - enable = #{enable}, - - - deleted = #{deleted}, - - - remark = #{remark}, - - - where id = #{id} - - - - - delete from sys_account where id = #{id} - - - - - delete from sys_account where id in - - #{id} - - - - \ No newline at end of file diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/SysNewsMapper.xml b/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/SysNewsMapper.xml deleted file mode 100644 index a7de866..0000000 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/mapper/xml/SysNewsMapper.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - insert into sys_news - - - id, - - - title, - - - news_abstract, - - - main_text, - - - release_date, - - - deleted, - - - remark, - - - - - #{id}, - - - #{title}, - - - #{newsAbstract}, - - - #{mainText}, - - - #{releaseDate}, - - - #{deleted}, - - - #{remark}, - - - - - - - delete from sys_news where id = #{id} - - - - - delete from sys_news where id in - - #{id} - - - - \ No newline at end of file diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ICapitalAccountService.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ICapitalAccountService.java new file mode 100644 index 0000000..1930b23 --- /dev/null +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ICapitalAccountService.java @@ -0,0 +1,82 @@ +package com.pearadmin.system.service; + +import com.github.pagehelper.PageInfo; +import com.pearadmin.common.web.domain.request.PageDomain; +import com.pearadmin.system.domain.CapitalAccount; + +import java.util.List; + +/** + * 账户服务接口类 + * + * @author 阿 林 + * @date 2021/8/10 + */ +public interface ICapitalAccountService { + + /** + * 查询账户数据 + * + * @param queryParam 查询实体类参数 + * @return 操作结果 + */ + List list(CapitalAccount queryParam); + + /** + * 分页查询账户数据 + * + * @param queryParam 查询实体类参数 + * @param pageDomain 分页参数实体类 + * @return 操作结果 + */ + PageInfo page(CapitalAccount queryParam, PageDomain pageDomain); + + /** + * 保存账户数据 + * + * @param capitalAccount 账户实体类 + * @return 操作结果 + */ + boolean save(CapitalAccount capitalAccount); + + /** + * 根据 账户编号 获取账户信息 + * + * @param accountId 账户编号 + * @return 操作结果 + */ + CapitalAccount getByAccountId(String accountId); + + /** + * 根据 用户编号 获取账户信息 + * + * @param userId 用户编号 + * @return 操作结果 + */ + CapitalAccount getByUserId(String userId); + + /** + * 根据 id 修改账户数据 + * + * @param capitalAccount 账户实体类 + * @return 操作结果 + */ + boolean update(CapitalAccount capitalAccount); + + /** + * 根据 id 删除账户数据 + * + * @param accountId 账户编号 + * @return 操作结果 + */ + boolean remove(String accountId); + + /** + * 根据 id 删除账户数据 + * + * @param ids 账户编号数组 + * @return 操作结果 + */ + boolean batchRemove(String[] ids); + +} diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ICapitalHistoryService.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ICapitalHistoryService.java new file mode 100644 index 0000000..d1e966b --- /dev/null +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ICapitalHistoryService.java @@ -0,0 +1,74 @@ +package com.pearadmin.system.service; + +import com.github.pagehelper.PageInfo; +import com.pearadmin.common.web.domain.request.PageDomain; +import com.pearadmin.system.domain.CapitalHistory; + +import java.util.List; + +/** + * 交易信息接口类 + * + * @author 阿 林 + * @date 2021/8/12 + */ +public interface ICapitalHistoryService { + + /** + * 查询交易信息数据 + * + * @param queryParam 查询实体类参数 + * @return 操作结果 + */ + List list(CapitalHistory queryParam); + + /** + * 分页查询交易信息数据 + * + * @param queryParam 查询实体类参数 + * @param pageDomain 分页参数实体类 + * @return 操作结果 + */ + PageInfo page(CapitalHistory queryParam, PageDomain pageDomain); + + /** + * 保存交易信息数据 + * + * @param capitalHistory 交易信息实体类 + * @return 操作结果 + */ + boolean save(CapitalHistory capitalHistory); + + /** + * 根据 交易信息编号 获取交易信息信息 + * + * @param id 交易信息编号 + * @return 操作结果 + */ + CapitalHistory getById(String id); + + /** + * 根据 交易信息编号 修改交易信息数据 + * + * @param capitalHistory 交易信息实体类 + * @return 操作结果 + */ + boolean update(CapitalHistory capitalHistory); + + /** + * 根据 id 删除交易信息数据 + * + * @param id 交易信息编号 + * @return 操作结果 + */ + boolean remove(String id); + + /** + * 根据 id 删除交易信息数据 + * + * @param ids 交易信息编号数组 + * @return 操作结果 + */ + boolean batchRemove(String[] ids); + +} diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ICapitalNewsService.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ICapitalNewsService.java new file mode 100644 index 0000000..86757fa --- /dev/null +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ICapitalNewsService.java @@ -0,0 +1,74 @@ +package com.pearadmin.system.service; + +import com.github.pagehelper.PageInfo; +import com.pearadmin.common.web.domain.request.PageDomain; +import com.pearadmin.system.domain.CapitalNews; + +import java.util.List; + +/** + * 新闻服务接口类 + * + * @author 阿 林 + * @date 2021/8/9 + */ +public interface ICapitalNewsService { + + /** + * 查询新闻数据 + * + * @param queryParam 查询实体类参数 + * @return 操作结果 + */ + List list(CapitalNews queryParam); + + /** + * 分页查询新闻数据 + * + * @param queryParam 查询实体类参数 + * @param pageDomain 分页参数实体类 + * @return 操作结果 + */ + PageInfo page(CapitalNews queryParam, PageDomain pageDomain); + + /** + * 保存新闻数据 + * + * @param capitalNews 新闻实体类 + * @return 操作结果 + */ + boolean save(CapitalNews capitalNews); + + /** + * 根据 新闻编号 获取新闻信息 + * + * @param id 新闻编号 + * @return 操作结果 + */ + CapitalNews getById(String id); + + /** + * 根据 新闻编号 修改新闻数据 + * + * @param capitalNews 新闻实体类 + * @return 操作结果 + */ + boolean update(CapitalNews capitalNews); + + /** + * 根据 id 删除新闻数据 + * + * @param id 新闻编号 + * @return 操作结果 + */ + boolean remove(String id); + + /** + * 根据 id 删除新闻数据 + * + * @param ids 新闻编号数组 + * @return 操作结果 + */ + boolean batchRemove(String[] ids); + +} diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysAccountService.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysAccountService.java deleted file mode 100644 index e4cef9a..0000000 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysAccountService.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.pearadmin.system.service; - -import com.github.pagehelper.PageInfo; -import com.pearadmin.common.web.domain.request.PageDomain; -import com.pearadmin.system.domain.SysAccount; - -import java.util.List; - -/** - * 账户服务接口类 - * - * @author 阿 林 - * @date 2021/8/10 - */ -public interface ISysAccountService { - - /** - * Describe: 查询账户数据 - * Param: queryNewsParam - * Return: 操作结果 - */ - List list(SysAccount queryNewsParam); - - /** - * Describe: 分页查询账户数据 - * Param: queryNewsParam - * Param: pageDomain - * Return: 操作结果 - */ - PageInfo page(SysAccount queryNewsParam, PageDomain pageDomain); - - /** - * Describe: 保存账户数据 - * Param: SysAccount - * Return: 操作结果 - */ - boolean save(SysAccount sysAccount); - - /** - * Describe: 根据 id 获取账户信息 - * Param: id - * Return: 操作结果 - */ - SysAccount getById(String id); - - /** - * Describe: 根据 userId 获取账户信息 - * Param: id - * Return: 操作结果 - */ - SysAccount getByUserId(String id); - - /** - * Describe: 根据 id 修改账户数据 - * Param: id - * Return: 操作结果 - */ - boolean update(SysAccount sysAccount); - - /** - * Describe: 根据 id 删除账户数据 - * Param: id - * Return: 操作结果 - */ - Boolean remove(String id); - - /** - * Describe: 根据 id 删除账户数据 - * Param: ids - * Return: 操作结果 - */ - boolean batchRemove(String[] ids); - -} diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysNewsService.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysNewsService.java deleted file mode 100644 index a7854e1..0000000 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysNewsService.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.pearadmin.system.service; - -import com.github.pagehelper.PageInfo; -import com.pearadmin.common.web.domain.request.PageDomain; -import com.pearadmin.system.domain.SysNews; - -import java.util.List; - -/** - * 新闻服务接口类 - * - * @author 阿 林 - * @date 2021/8/9 - */ -public interface ISysNewsService { - - /** - * Describe: 查询新闻数据 - * Param: queryNewsParam - * Return: 操作结果 - */ - List list(SysNews queryNewsParam); - - /** - * Describe: 分页查询新闻数据 - * Param: queryNewsParam - * Param: pageDomain - * Return: 操作结果 - */ - PageInfo page(SysNews queryNewsParam, PageDomain pageDomain); - - /** - * Describe: 保存新闻数据 - * Param: SysNews - * Return: 操作结果 - */ - boolean save(SysNews sysNews); - - /** - * Describe: 根据 id 获取新闻信息 - * Param: id - * Return: 操作结果 - */ - SysNews getById(String id); - - /** - * Describe: 根据 id 修改新闻数据 - * Param: id - * Return: 操作结果 - */ - boolean update(SysNews sysNews); - - /** - * Describe: 根据 id 删除新闻数据 - * Param: id - * Return: 操作结果 - */ - Boolean remove(String id); - - /** - * Describe: 根据 id 删除新闻数据 - * Param: ids - * Return: 操作结果 - */ - boolean batchRemove(String[] ids); - -} diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysUserService.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysUserService.java index 5fe92ad..db46246 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysUserService.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/ISysUserService.java @@ -35,6 +35,13 @@ public interface ISysUserService { * */ SysUser getById(String id); + /** + * 根据 用户名 获取用户数据 + * @param username 用户名 + * @return SysUser + */ + SysUser getByUsername(String username); + /** * Describe: 根据 id 删除用户数据 * Param: id diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysAccountServiceImpl.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/CapitalAccountServiceImpl.java similarity index 42% rename from pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysAccountServiceImpl.java rename to pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/CapitalAccountServiceImpl.java index 032a10b..f2148e6 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysAccountServiceImpl.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/CapitalAccountServiceImpl.java @@ -3,9 +3,9 @@ package com.pearadmin.system.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.pearadmin.common.web.domain.request.PageDomain; -import com.pearadmin.system.domain.SysAccount; -import com.pearadmin.system.mapper.SysAccountMapper; -import com.pearadmin.system.service.ISysAccountService; +import com.pearadmin.system.domain.CapitalAccount; +import com.pearadmin.system.mapper.CapitalAccountMapper; +import com.pearadmin.system.service.ICapitalAccountService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -18,13 +18,13 @@ import java.util.List; * @date 2021/8/9 */ @Service -public class SysAccountServiceImpl implements ISysAccountService { +public class CapitalAccountServiceImpl implements ICapitalAccountService { /** * 注入账户服务 */ @Resource - private SysAccountMapper sysAccountMapper; + private CapitalAccountMapper capitalAccountMapper; /** * 查询账户列表 @@ -32,76 +32,88 @@ public class SysAccountServiceImpl implements ISysAccountService { * @return List */ @Override - public List list(SysAccount param) { - return sysAccountMapper.selectList(param); + public List list(CapitalAccount param) { + return capitalAccountMapper.selectList(param); } /** * 查询账户数据 分页 + * * @param param 参数实体类 * @param pageDomain 分页参数实体类 - * @return PageInfo 分页数据 + * @return PageInfo 分页数据 */ @Override - public PageInfo page(SysAccount param, PageDomain pageDomain) { + public PageInfo page(CapitalAccount param, PageDomain pageDomain) { PageHelper.startPage(pageDomain.getPage(),pageDomain.getLimit()); - List list = sysAccountMapper.selectList(param); + List list = capitalAccountMapper.selectList(param); return new PageInfo<>(list); } /** * 添加账户数据 - * @param sysAccount 实体类 + * + * @param capitalAccount 实体类 * @return 执行结果 */ @Override - public boolean save(SysAccount sysAccount) { - return sysAccountMapper.insert(sysAccount) > 0; + public boolean save(CapitalAccount capitalAccount) { + return capitalAccountMapper.insert(capitalAccount) > 0; } /** - * 根据 id编号 查询账户数据 - * @param id 编号 - * @return SysAccount 实体类 + * 根据 账户编号 获取账户信息 + * + * @param accountId 账户编号 + * @return CapitalAccount 实体类 */ @Override - public SysAccount getById(String id) { - return sysAccountMapper.selectById(id); + public CapitalAccount getByAccountId(String accountId) { + return capitalAccountMapper.selectByAccountId(accountId); } + /** + * 根据 用户编号 获取账户信息 + * + * @param userId 用户编号 + * @return CapitalAccount 实体类 + */ @Override - public SysAccount getByUserId(String userId) { - return sysAccountMapper.selectByUserId(userId); + public CapitalAccount getByUserId(String userId) { + return capitalAccountMapper.selectByUserId(userId); } /** * 修改账户数据 - * @param sysAccount 实体类 - * @return 操作结果 + * + * @param capitalAccount 实体类 + * @return CapitalAccount 实体类 */ @Override - public boolean update(SysAccount sysAccount) { - return sysAccountMapper.updateById(sysAccount) > 0; + public boolean update(CapitalAccount capitalAccount) { + return capitalAccountMapper.updateById(capitalAccount) > 0; } /** * 根据 id 编号删除账户 - * @param id 编号 + * + * @param accountId 账户编号 * @return 执行结果 */ @Override - public Boolean remove(String id) { - return sysAccountMapper.deleteById(id) > 0; + public boolean remove(String accountId) { + return capitalAccountMapper.deleteByAccountId(accountId) > 0; } /** * 根据 id 编号批量删除账户 + * * @param ids 编号数组 * @return 执行结果 */ @Override public boolean batchRemove(String[] ids) { - return sysAccountMapper.deleteByIds(ids) > 0; + return capitalAccountMapper.deleteByIds(ids) > 0; } } diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/CapitalHistoryImpl.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/CapitalHistoryImpl.java new file mode 100644 index 0000000..f0f8c9c --- /dev/null +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/CapitalHistoryImpl.java @@ -0,0 +1,102 @@ +package com.pearadmin.system.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.pearadmin.common.web.domain.request.PageDomain; +import com.pearadmin.system.domain.CapitalHistory; +import com.pearadmin.system.mapper.CapitalHistoryMapper; +import com.pearadmin.system.service.ICapitalHistoryService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 交易信息服务实现类 + * + * @author 阿 林 + * @date 2021/8/12 + */ +@Service +public class CapitalHistoryImpl implements ICapitalHistoryService { + + /** + * 注入交易信息服务 + */ + @Resource + private CapitalHistoryMapper capitalHistoryMapper; + + /** + * 查询交易信息列表 + * @param param 参数实体类 + * @return List + */ + @Override + public List list(CapitalHistory param) { + return capitalHistoryMapper.selectList(param); + } + + /** + * 查询交易信息数据 分页 + * @param param 参数实体类 + * @param pageDomain 分页参数实体类 + * @return PageInfo 分页数据 + */ + @Override + public PageInfo page(CapitalHistory param, PageDomain pageDomain) { + PageHelper.startPage(pageDomain.getPage(),pageDomain.getLimit()); + List list = capitalHistoryMapper.selectList(param); + return new PageInfo<>(list); + } + + /** + * 添加交易信息数据 + * @param capitalHistory 实体类 + * @return 执行结果 + */ + @Override + public boolean save(CapitalHistory capitalHistory) { + return capitalHistoryMapper.insert(capitalHistory) > 0; + } + + /** + * 根据 id编号 查询交易信息数据 + * @param id 编号 + * @return SysNews 实体类 + */ + @Override + public CapitalHistory getById(String id) { + return capitalHistoryMapper.selectById(id); + } + + /** + * 修改交易信息数据 + * @param capitalHistory 实体类 + * @return 操作结果 + */ + @Override + public boolean update(CapitalHistory capitalHistory) { + return capitalHistoryMapper.updateById(capitalHistory) > 0; + } + + /** + * 根据 id 编号删除交易信息 + * @param id 编号 + * @return 执行结果 + */ + @Override + public boolean remove(String id) { + return capitalHistoryMapper.deleteById(id) > 0; + } + + /** + * 根据 id 编号批量删除交易信息 + * @param ids 编号数组 + * @return 执行结果 + */ + @Override + public boolean batchRemove(String[] ids) { + return capitalHistoryMapper.deleteByIds(ids) > 0; + } + +} diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysNewsServiceImpl.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/CapitalNewsServiceImpl.java similarity index 58% rename from pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysNewsServiceImpl.java rename to pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/CapitalNewsServiceImpl.java index fe24f19..aa1e897 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysNewsServiceImpl.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/CapitalNewsServiceImpl.java @@ -3,9 +3,9 @@ package com.pearadmin.system.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.pearadmin.common.web.domain.request.PageDomain; -import com.pearadmin.system.domain.SysNews; -import com.pearadmin.system.mapper.SysNewsMapper; -import com.pearadmin.system.service.ISysNewsService; +import com.pearadmin.system.domain.CapitalNews; +import com.pearadmin.system.mapper.CapitalNewsMapper; +import com.pearadmin.system.service.ICapitalNewsService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -18,13 +18,13 @@ import java.util.List; * @date 2021/8/9 */ @Service -public class SysNewsServiceImpl implements ISysNewsService { +public class CapitalNewsServiceImpl implements ICapitalNewsService { /** * 注入新闻服务 */ @Resource - private SysNewsMapper sysNewsMapper; + private CapitalNewsMapper capitalNewsMapper; /** * 查询新闻列表 @@ -32,8 +32,8 @@ public class SysNewsServiceImpl implements ISysNewsService { * @return List */ @Override - public List list(SysNews param) { - return sysNewsMapper.selectList(param); + public List list(CapitalNews param) { + return capitalNewsMapper.selectList(param); } /** @@ -43,20 +43,20 @@ public class SysNewsServiceImpl implements ISysNewsService { * @return PageInfo 分页数据 */ @Override - public PageInfo page(SysNews param, PageDomain pageDomain) { + public PageInfo page(CapitalNews param, PageDomain pageDomain) { PageHelper.startPage(pageDomain.getPage(),pageDomain.getLimit()); - List list = sysNewsMapper.selectList(param); + List list = capitalNewsMapper.selectList(param); return new PageInfo<>(list); } /** * 添加新闻数据 - * @param sysNews 实体类 + * @param capitalNews 实体类 * @return 执行结果 */ @Override - public boolean save(SysNews sysNews) { - return sysNewsMapper.insert(sysNews) > 0; + public boolean save(CapitalNews capitalNews) { + return capitalNewsMapper.insert(capitalNews) > 0; } /** @@ -65,18 +65,18 @@ public class SysNewsServiceImpl implements ISysNewsService { * @return SysNews 实体类 */ @Override - public SysNews getById(String id) { - return sysNewsMapper.selectById(id); + public CapitalNews getById(String id) { + return capitalNewsMapper.selectById(id); } /** * 修改新闻数据 - * @param sysNews 实体类 + * @param capitalNews 实体类 * @return 操作结果 */ @Override - public boolean update(SysNews sysNews) { - return sysNewsMapper.updateById(sysNews) > 0; + public boolean update(CapitalNews capitalNews) { + return capitalNewsMapper.updateById(capitalNews) > 0; } /** @@ -85,8 +85,8 @@ public class SysNewsServiceImpl implements ISysNewsService { * @return 执行结果 */ @Override - public Boolean remove(String id) { - return sysNewsMapper.deleteById(id) > 0; + public boolean remove(String id) { + return capitalNewsMapper.deleteById(id) > 0; } /** @@ -96,7 +96,7 @@ public class SysNewsServiceImpl implements ISysNewsService { */ @Override public boolean batchRemove(String[] ids) { - return sysNewsMapper.deleteByIds(ids) > 0; + return capitalNewsMapper.deleteByIds(ids) > 0; } } diff --git a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysUserServiceImpl.java b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysUserServiceImpl.java index 6fadf6a..87012b7 100644 --- a/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysUserServiceImpl.java +++ b/pear-modules/pear-system/src/main/java/com/pearadmin/system/service/impl/SysUserServiceImpl.java @@ -10,12 +10,14 @@ import com.pearadmin.system.mapper.SysPowerMapper; import com.pearadmin.system.mapper.SysRoleMapper; import com.pearadmin.system.mapper.SysUserMapper; import com.pearadmin.system.mapper.SysUserRoleMapper; -import com.pearadmin.system.service.ISysAccountService; +import com.pearadmin.system.service.ICapitalAccountService; import com.pearadmin.system.service.ISysUserService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -61,7 +63,7 @@ public class SysUserServiceImpl implements ISysUserService { * 账户模块服务 */ @Resource - private ISysAccountService sysAccountService; + private ICapitalAccountService sysAccountService; /** * Describe: 根据条件查询用户列表数据 @@ -96,6 +98,16 @@ public class SysUserServiceImpl implements ISysUserService { return sysUserMapper.selectById(id); } + /** + * 根据 用户名 获取用户数据 + * @param username 用户名 + * @return SysUser + */ + @Override + public SysUser getByUsername(String username) { + return sysUserMapper.selectByUsername(username); + } + /** * Describe: 根据 id 删除用户数据 * Param: id @@ -216,14 +228,13 @@ public class SysUserServiceImpl implements ISysUserService { * @return boolean */ private boolean createAccount(String id) { - SysAccount sysAccount = new SysAccount(); - sysAccount.setId(SequenceUtil.makeStringId()); - sysAccount.setUserId(id); - sysAccount.setBalance(0L); - sysAccount.setEnable("1"); - sysAccount.setDeleted(false); - sysAccount.setRemark(""); - return sysAccountService.save(sysAccount); + CapitalAccount account = new CapitalAccount(); + account.setAccountId(SequenceUtil.makeStringId()); + account.setUserId(id); + account.setMoney(new BigDecimal(0)); + account.setCreateTime(LocalDateTime.now()); + account.setRemark(""); + return sysAccountService.save(account); } } diff --git a/sql/capital-account-boot.sql b/sql/capital-account-boot.sql deleted file mode 100644 index 54072ae..0000000 --- a/sql/capital-account-boot.sql +++ /dev/null @@ -1,68 +0,0 @@ -DROP TABLE IF EXISTS `sys_transaction_log`; -DROP TABLE IF EXISTS `sys_account`; -CREATE TABLE IF NOT EXISTS `sys_account` -( - `id` char(19) PRIMARY KEY COMMENT '账户编号', - `user_id` char(19) NOT NULL COMMENT '用户编号 - sys_user.user_id', - `balance` bigint NOT NULL COMMENT '余额', - `enable` char(1) NULL COMMENT '账户状态', - `deleted` bit NULL COMMENT '逻辑删除', - `remark` text NULL COMMENT '备注' -# FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`) -) COMMENT='账户'; - -INSERT INTO `sys_account` VALUES (1, 1, 99999999, true, false, 'admin account'); - -CREATE TABLE IF NOT EXISTS `sys_transaction_log` -( - `id` bigint PRIMARY KEY, - `money` bigint NULL COMMENT '交易金额' , - `datetime` datetime NULL COMMENT '交易时间', - `type` int NULL COMMENT '交易类型, 0-存款, 1-取款, 2-转账' , - `account_id` char(19) NULL COMMENT '账户编号 - sys_account.id', - `deleted` bit NULL COMMENT '逻辑删除', - `remark` text NULL COMMENT '备注', - CONSTRAINT `FK_166` FOREIGN KEY `fkIdx_167` (`account_id`) REFERENCES `sys_account` (`id`) -) COMMENT='交易记录'; - -DROP TABLE IF EXISTS `sys_news`; -CREATE TABLE IF NOT EXISTS `sys_news` -( - `id` bigint PRIMARY KEY AUTO_INCREMENT, - `title` varchar(15) NULL COMMENT '标题', - `news_abstract` varchar(50) NULL COMMENT '摘要', - `main_text` text NULL COMMENT '内容', - `release_date` date NULL COMMENT '发布日期', - `deleted` bit NULL COMMENT '逻辑删除', - `remark` text NULL COMMENT '备注' -) COMMENT='新闻'; - - - -# patch --- role -DELETE FROM `sys_role` WHERE `role_code`='user'; -DELETE FROM `sys_role` WHERE `role_code`='test'; -INSERT INTO `sys_role` VALUES ('1356112133691015223', '用户', 'user', '0', NULL, NULL, NULL, NULL, NULL, '普通用户', 3); -INSERT INTO `sys_role` VALUES ('1356112133691015256', '测试', 'test', '0', NULL, NULL, NULL, NULL, NULL, '测试角色', 3); - --- power - account -DELETE FROM `sys_power` WHERE `power_id`=5; -DELETE FROM `sys_power` WHERE `parent_id`=5; -INSERT INTO `sys_power` VALUES ('5', '账户管理', '1', 'sys:account:main', '/system/account/main', '_iframe', '0', 'layui-icon layui-icon-user', 1, NULL, NULL, NULL, NULL, NULL, '1'); -INSERT INTO `sys_power` VALUES ('51', '账户新增', '2', 'sys:account:add', '', '', '5', '', 5, NULL, NULL, NULL, NULL, NULL, '1'); -INSERT INTO `sys_power` VALUES ('52', '账户删除', '2', 'sys:account:remove', '', '', '5', '', 5, NULL, NULL, NULL, NULL, NULL, '1'); -INSERT INTO `sys_power` VALUES ('53', '账户修改', '2', 'sys:account:edit', '', '', '5', '', 5, NULL, NULL, NULL, NULL, NULL, '1'); -INSERT INTO `sys_power` VALUES ('54', '账户列表', '2', 'sys:account:data', '', '', '5', '', 5, NULL, NULL, NULL, NULL, NULL, '1'); - --- power - news -DELETE from `sys_power` WHERE `power_id`=6; -DELETE FROM `sys_power` WHERE `parent_id`=6; -INSERT INTO `sys_power` VALUES ('6', '新闻管理', '1', 'sys:news:main', '/system/news/main', '_iframe', '0', 'layui-icon layui-icon-user', 1, NULL, NULL, NULL, NULL, NULL, '1'); -INSERT INTO `sys_power` VALUES ('61', '新闻新增', '2', 'sys:news:add', '', '', '6', '', 6, NULL, NULL, NULL, NULL, NULL, '1'); -INSERT INTO `sys_power` VALUES ('62', '新闻删除', '2', 'sys:news:remove', '', '', '6', '', 6, NULL, NULL, NULL, NULL, NULL, '1'); -INSERT INTO `sys_power` VALUES ('63', '新闻修改', '2', 'sys:news:edit', '', '', '6', '', 6, NULL, NULL, NULL, NULL, NULL, '1'); -INSERT INTO `sys_power` VALUES ('64', '新闻列表', '2', 'sys:news:data', '', '', '6', '', 6, NULL, NULL, NULL, NULL, NULL, '1'); - --- power - -# INSERT INTO `sys_power` VALUES ('7', '账户管理', '1', 'sys:role:main', '/system/role/main', '_iframe', '1', 'layui-icon layui-icon-user', 1, NULL, NULL, NULL, NULL, NULL, '1'); \ No newline at end of file diff --git a/sql/pear-admin-boot.sql b/sql/capital-account.sql similarity index 91% rename from sql/pear-admin-boot.sql rename to sql/capital-account.sql index 4a204c5..84764af 100644 --- a/sql/pear-admin-boot.sql +++ b/sql/capital-account.sql @@ -5,7 +5,7 @@ Source Server Type : MySQL Source Server Version : 80019 Source Host : localhost:3306 - Source Schema : pear-admin + Source Schema : capital-account Target Server Type : MySQL Target Server Version : 80019 @@ -17,6 +17,73 @@ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; +-- ---------------------------- +-- Table structure for capital_account +-- ---------------------------- +DROP TABLE IF EXISTS `capital_account`; +CREATE TABLE `capital_account` +( + `account_id` VARCHAR(19) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '账户id', + `user_id` VARCHAR(19) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '用户id', + `create_time` TIMESTAMP NULL DEFAULT NULL COMMENT '账户创建时间', + `money` DECIMAL(10, 2) NOT NULL COMMENT '账户金额', + `remark` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`account_id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; + +-- ---------------------------- +-- Records of capital_account +-- ---------------------------- +INSERT INTO `capital_account` VALUES ('1', '1309861917694623744', now(), 0, ''); +INSERT INTO `capital_account` VALUES ('2', '1306230031168569344', now(), 0, ''); +INSERT INTO `capital_account` VALUES ('3', '1310409555649232897', now(), 0, ''); +INSERT INTO `capital_account` VALUES ('4', '1355967204012589057', now(), 0, ''); +INSERT INTO `capital_account` VALUES ('5', '1355966975355912193', now(), 0, ''); +INSERT INTO `capital_account` VALUES ('6', '1349021166525743105', now(), 0, ''); +INSERT INTO `capital_account` VALUES ('7', '1349016976730619905', now(), 0, ''); + +-- ---------------------------- +-- Table structure for capital_history +-- ---------------------------- +DROP TABLE IF EXISTS `capital_history`; +CREATE TABLE `capital_history` +( + `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '交易流水号', + `account_id` VARCHAR(19) NOT NULL COMMENT '交易账户', + `type` INT NOT NULL COMMENT '交易类型(0-存款1-取款2-转账)', + `money` DECIMAL(10, 2) NOT NULL COMMENT '交易金额', + `create_time` TIMESTAMP NOT NULL COMMENT '交易创建时间', + `by_account` VARCHAR(19) DEFAULT NULL COMMENT '转账接受账户号', + `remark` VARCHAR(255) DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; + +-- ---------------------------- +-- Records of capital_history +-- ---------------------------- + +-- ---------------------------- +-- Table structure for capital_news +-- ---------------------------- +DROP TABLE IF EXISTS `capital_news`; +CREATE TABLE `capital_news` +( + `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '新闻ID', + `title` VARCHAR(100) NOT NULL COMMENT '新闻标题', + `img` VARCHAR(500) DEFAULT NULL COMMENT '新闻图片', + `browse_num` INT DEFAULT NULL COMMENT '浏览人数', + `content` VARCHAR(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '新闻内容', + `create_time` TIMESTAMP NULL DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) +) ENGINE = InnoDB AUTO_INCREMENT = 4 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; + +-- ---------------------------- +-- Records of capital_news +-- ---------------------------- +INSERT INTO `capital_news` VALUES (1, '测试', 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fp3-dy.byteimg.com%2Faweme%2F720x720%2F2d1f70004e823d3ec007e.jpeg&refer=http%3A%2F%2Fp3-dy.byteimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1631069153&t=fa63b18bc3adefed7e0fe61855d96789', 232, ' 春风吹绿了柳条,吹开了两当县漫山的花苞。\n\n春天来临的时候,一则令人悲痛的消息却在英雄的家乡迅速传开。2020年6月,面对生与死的考验,卫国戍边英雄陈红军英勇战斗,壮烈牺牲,年仅33岁的他和战友用生命捍卫祖国山河。', '2021-03-14 13:42:34'); +INSERT INTO `capital_news` VALUES (2, '测试', 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fp3-dy.byteimg.com%2Faweme%2F720x720%2F2d1f70004e823d3ec007e.jpeg&refer=http%3A%2F%2Fp3-dy.byteimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1631069153&t=fa63b18bc3adefed7e0fe61855d96789', 89, ' 春风吹绿了柳条,吹开了两当县漫山的花苞。\n\n春天来临的时候,一则令人悲痛的消息却在英雄的家乡迅速传开。2020年6月,面对生与死的考验,卫国戍边英雄陈红军英勇战斗,壮烈牺牲,年仅33岁的他和战友用生命捍卫祖国山河。', '2021-03-14 13:42:34'); +INSERT INTO `capital_news` VALUES (3, '新闻联播开始了', 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fp3-dy.byteimg.com%2Faweme%2F720x720%2F2d1f70004e823d3ec007e.jpeg&refer=http%3A%2F%2Fp3-dy.byteimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1631069153&t=fa63b18bc3adefed7e0fe61855d96789', 111, ' 春风吹绿了柳条,吹开了两当县漫山的花苞。\n春天来临的时候,一则令人悲痛的消息却在英雄的家乡迅速传开。2020年6月,面对生与死的考验,卫国戍边英雄陈红军英勇战斗,壮烈牺牲,年仅33岁的他和战友用生命捍卫祖国山河。', '2021-08-09 15:23:36'); + -- ---------------------------- -- Table structure for gen_table -- ---------------------------- @@ -758,6 +825,21 @@ INSERT INTO `sys_power` VALUES ('1370412169610395650', '消息新增', '2', 'sys INSERT INTO `sys_power` VALUES ('1370412169610395651', '消息修改', '2', 'system:notice:edit', '', NULL, '1370412169610395648', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); INSERT INTO `sys_power` VALUES ('1370412169610395652', '消息删除', '2', 'system:notice:remove', '', NULL, '1370412169610395648', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); INSERT INTO `sys_power` VALUES ('1370974716822552576', '修改设置', '2', 'sys:setup:add', '', '', '1355962888132493312', 'layui-icon layui-icon-vercode', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424572533981577216', '新闻管理', '1', 'capital:news:main', '/capital/news/main', '_iframe', '1', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424566847209996289', '新闻列表', '2', 'capital:news:data', '', NULL, '1424566847209996288', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424566847209996290', '新闻新增', '2', 'capital:news:add', '', NULL, '1424566847209996288', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424566847209996291', '新闻修改', '2', 'capital:news:edit', '', NULL, '1424566847209996288', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424566847209996292', '新闻删除', '2', 'capital:news:remove', '', NULL, '1424566847209996288', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424670309004345344', '交易记录', '1', 'capital:history:main', '/capital/history/main', '_iframe', '1', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424670309004345345', '交易记录列表', '2', 'capital:history:data', '', NULL, '1424670309004345344', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424670309004345346', '交易记录新增', '2', 'capital:history:add', '', NULL, '1424670309004345344', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424670309004345347', '交易记录修改', '2', 'capital:history:edit', '', NULL, '1424670309004345344', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424670309004345348', '交易记录删除', '2', 'capital:history:remove', '', NULL, '1424670309004345344', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424903881883648000', '资金账户', '1', 'capital:account:main', '/capital/account/main', '_iframe', '1', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424903881883648001', '账户列表', '2', 'capital:account:data', '', NULL, '1424903881883648000', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424903881883648002', '账户新增', '2', 'capital:account:add', '', NULL, '1424903881883648000', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424903881883648003', '账户修改', '2', 'capital:account:edit', '', NULL, '1424903881883648000', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('1424903881883648004', '账户删除', '2', 'capital:account:remove', '', NULL, '1424903881883648000', 'layui-icon layui-icon-set-fill', 1, NULL, NULL, NULL, NULL, NULL, '1'); INSERT INTO `sys_power` VALUES ('2', '用户管理', '2', '', '', '_iframe', '1320969572051845120', 'layui-icon layui-icon layui-icon-username', 0, NULL, NULL, NULL, NULL, NULL, '1'); INSERT INTO `sys_power` VALUES ('3', '角色管理', '1', 'sys:role:main', '/system/role/main', '_iframe', '1', 'layui-icon layui-icon-user', 1, NULL, NULL, NULL, NULL, NULL, '1'); INSERT INTO `sys_power` VALUES ('4', '权限管理', '1', 'sys:power:main', '/system/power/main', '_iframe', '1', 'layui-icon layui-icon-vercode', 2, NULL, NULL, NULL, NULL, NULL, '1'); @@ -772,6 +854,11 @@ INSERT INTO `sys_power` VALUES ('451003242072117248', '项目总览', '1', 'proc INSERT INTO `sys_power` VALUES ('474356363552755712', '项目介绍', '1', 'home', '/console', '_iframe', '474356044148117504', 'layui-icon layui-icon-home', 1, NULL, NULL, NULL, NULL, NULL, '0'); INSERT INTO `sys_power` VALUES ('694203021537574912', '系统监控', '0', '', '', '', '0', 'layui-icon layui-icon-console', 3, NULL, NULL, NULL, NULL, NULL, '1'); INSERT INTO `sys_power` VALUES ('694203311615639552', '接口文档', '1', 'sys:doc:main', '/system/doc/main', '_iframe', '442417411065516032', 'layui-icon layui-icon layui-icon layui-icon layui-icon-chart', 9, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('7', '我的余额', '1', 'capital:account:balance', '/capital/account/balance', '_iframe', '0', 'layui-icon layui-icon-user', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('71', '存款', '1', 'capital:account:deposit', '/capital/account/deposit', '_iframe', '7', 'layui-icon layui-icon-user', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('72', '取款', '1', 'capital:account:withdrawal', '/capital/account/withdrawal', '_iframe', '7', 'layui-icon layui-icon-user', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('73', '转账', '1', 'capital:account:transfer', '/capital/account/transfer', '_iframe', '7', 'layui-icon layui-icon-user', 1, NULL, NULL, NULL, NULL, NULL, '1'); +INSERT INTO `sys_power` VALUES ('8', '个人信息', '1', '', '/system/user/center', '_iframe', '0', 'layui-icon layui-icon-user', 1, NULL, NULL, NULL, NULL, NULL, '1'); -- ---------------------------- -- Table structure for sys_role @@ -798,6 +885,7 @@ CREATE TABLE `sys_role` ( INSERT INTO `sys_role` VALUES ('1309851245195821056', '超级管理员', 'admin', '0', NULL, NULL, NULL, NULL, NULL, '超级管理员', 1); INSERT INTO `sys_role` VALUES ('1313761100243664896', '普通管理员', 'manager', '0', NULL, NULL, NULL, NULL, NULL, '普通管理员', 2); INSERT INTO `sys_role` VALUES ('1356112133691015168', '应急管理员', 'users', '0', NULL, NULL, NULL, NULL, NULL, '应急管理员', 2); +INSERT INTO `sys_role` VALUES ('1356112133814138969', '普通用户', 'user', '0', NULL, NULL, NULL, NULL, NULL, '应急管理员', 2); -- ---------------------------- -- Table structure for sys_role_power @@ -1084,16 +1172,13 @@ CREATE TABLE `sys_user` ( -- ---------------------------- -- Records of sys_user -- ---------------------------- -INSERT INTO `sys_user` VALUES ('1306230031168569344', 'feng', '$2a$10$jjf2h8Cx2lkFMKy3NY9pguADYAMewyPr2IJw8YAI5zSH2/0R/9Kra', NULL, '1', '风筝', 'feng@gmail.com', NULL, '0', '15553726531', '2000-02-09 00:00:00', NULL, NULL, NULL, '被岁月镂空,亦受其雕琢', '1', NULL, '1', NULL); +INSERT INTO `sys_user` VALUES ('1306230031168569344', 'leo', '$2a$10$M2JJqnkuO/MA78qDvKCi/eBS0FSqP2rKU2KElqOEloEvqRp4fyaEi', NULL, '1', '风筝', 'feng@gmail.com', NULL, '0', '15553726531', '2000-02-09 00:00:00', NULL, NULL, NULL, '被岁月镂空,亦受其雕琢', '1', NULL, '1', NULL); INSERT INTO `sys_user` VALUES ('1309861917694623744', 'admin', '$2a$10$6T.NGloFO.mD/QOAUelMTOcjAH8N49h34TsXduDVlnNMrASIGBNz6', NULL, '1', '管理', 'Jmys1992@qq.com', '1417168309870133248', '0', '15553726531', '2020-09-26 22:26:32', NULL, NULL, NULL, '被岁月镂空,亦受其雕琢', '1', NULL, '1', '2021-07-25 02:03:56'); -INSERT INTO `sys_user` VALUES ('1310409555649232897', 'ruhua', '$2a$10$pkvLdCLdFp2sXZpmK34wveekbWvHinW2ldBnic4SqjiKO8jK4Etka', NULL, '1', '如花', 'ruhua@gmail.com', NULL, '0', '15553726531', '2020-09-28 10:42:39', NULL, NULL, NULL, NULL, '1', NULL, '1', NULL); -INSERT INTO `sys_user` VALUES ('1349016976730619905', 'mwj', '$2a$10$mD0pnwOGjmOKihboidaTveUdrqcDYoluzfCOA0Ho87iwr9PKrDA6i', NULL, '1', '风筝', '', NULL, '1', '666666666', '2021-01-12 23:34:45', NULL, NULL, NULL, NULL, '1', NULL, '6', '2021-01-12 23:35:12'); -INSERT INTO `sys_user` VALUES ('1349021166525743105', 'xiana', '$2a$10$6VuyGmiEbIix/gPDU8oe3O7DZSxGVByjXCHQGtyEMoRAt74M/daee', NULL, '1', '夏娜', 'xiana@gmail.com', NULL, '0', '15553726531', '2021-01-12 23:51:24', NULL, NULL, NULL, NULL, '1', NULL, '1', NULL); -INSERT INTO `sys_user` VALUES ('1355966975355912193', 'sanman', '$2a$10$AD3QnQMRhYY7RUDHd1EEL.KHaDW8/S66SsESwh.9ta8bLiUXrZcJe', NULL, '1', '散漫', 'sanman@gmail.com', NULL, '0', '15553726531', '2021-02-01 03:51:34', NULL, NULL, NULL, NULL, '1', NULL, '1', NULL); -INSERT INTO `sys_user` VALUES ('1355967204012589057', 'langhua', '$2a$10$MNbf6dSvvncpoPsNFyMW6ObPwfj3jCKsZa7LvVAiXco1DWtgA46he', NULL, '1', '浪花', 'langhua@gmail.com', NULL, '0', '15553726531', '2021-02-01 03:52:29', NULL, NULL, NULL, NULL, '1', NULL, '1', NULL); -INSERT INTO `sys_user` VALUES ('1355967579994193921', 'zidian', '$2a$10$c9OatFOMGnj37A6UJTwfGOKqCwCx50K8eZsjV5YoBRlpYHcz8WfyW', NULL, '1', '字典', 'zidian', NULL, '0', '15553726531', '2021-02-01 03:53:58', NULL, NULL, NULL, NULL, '1', NULL, '1', NULL); -INSERT INTO `sys_user` VALUES ('1370973608502886401', 'duanlang', '$2a$10$XNcKlX3AnXR/Gh2g8aLX5OFtLD69Yjl1O8PDLmITH4WCQT.shsrWe', NULL, '1', '断浪', 'duanlang@gmail.com', NULL, '0', '15553726531', '2021-03-14 13:42:34', NULL, NULL, NULL, NULL, '1', NULL, '1', '2021-03-14 13:47:28'); -INSERT INTO `sys_user` VALUES ('1417395546586349569', 'jmys', '$2a$10$0HzindahrO8KyTSOrDt7A.0FkDN.6A4JkLf4FdYvhaArFHBsOh4uO', NULL, '1', '柏良', '854085467@qq.com', NULL, '0', '15553726531', '2021-07-20 16:06:47', NULL, NULL, NULL, NULL, '1', NULL, '1', '2021-07-20 16:08:48'); +INSERT INTO `sys_user` VALUES ('1310409555649232897', 'wzh', '$2a$10$5ekg2KhhU52wJqIjNTeISuWAil/Wjx0TKh5QghjYi2ZFHYZ6AYn8S', NULL, '1', '如花', 'ruhua@gmail.com', NULL, '0', '15553726531', '2020-09-28 10:42:39', NULL, NULL, NULL, NULL, '1', NULL, '1', NULL); +INSERT INTO `sys_user` VALUES ('1349016976730619905', 'ykl', '$2a$10$DnH90qOnukXOv4t9fQ5FZOaT46FfsDSqMe8x0lxsr3lMazA.3Hc8K', NULL, '1', '风筝', '', NULL, '1', '666666666', '2021-01-12 23:34:45', NULL, NULL, NULL, NULL, '1', NULL, '6', '2021-01-12 23:35:12'); +INSERT INTO `sys_user` VALUES ('1349021166525743105', 'cl', '$2a$10$GstSUH8qVwg8fsO9F.LSc.GeQ9G32Wtaa9AM65YcuYy9ahfSW0ztG', NULL, '1', '夏娜', 'xiana@gmail.com', NULL, '0', '15553726531', '2021-01-12 23:51:24', NULL, NULL, NULL, NULL, '1', NULL, '1', NULL); +INSERT INTO `sys_user` VALUES ('1355966975355912193', 'myy', '$2a$10$WkYbk1cLh.uvReqZvXMYC.K7YB9ysE.JcSqm/HAe.IWt3MN8B3BZS', NULL, '1', '散漫', 'sanman@gmail.com', NULL, '0', '15553726531', '2021-02-01 03:51:34', NULL, NULL, NULL, NULL, '1', NULL, '1', NULL); +INSERT INTO `sys_user` VALUES ('1355967204012589057', 'wxx', '$2a$10$IMaGzQ80//6OEbOfpZnR..3ryWRO4bSkKOYm5Y2Y5sFJ9vkV/NvTm', NULL, '1', '浪花', 'langhua@gmail.com', NULL, '0', '15553726531', '2021-02-01 03:52:29', NULL, NULL, NULL, NULL, '1', NULL, '1', NULL); -- ---------------------------- -- Table structure for sys_user_role -- Gitee