diff --git a/Cpop-Common/src/main/java/com/cpop/common/constant/Constants.java b/Cpop-Common/src/main/java/com/cpop/common/constant/Constants.java index 6617db5..fdf4d80 100644 --- a/Cpop-Common/src/main/java/com/cpop/common/constant/Constants.java +++ b/Cpop-Common/src/main/java/com/cpop/common/constant/Constants.java @@ -192,7 +192,7 @@ public interface Constants { /** * 隐藏菜单 */ - String HIDE_MENU = "Menu,Brand"; + String HIDE_MENU = "Menu"; /** * 用户类型 diff --git a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MallLoginStrategy.java b/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MallLoginStrategy.java index da79f39..443f1da 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MallLoginStrategy.java +++ b/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MallLoginStrategy.java @@ -1,10 +1,12 @@ package com.cpop.core.strategy.login; import com.cpop.common.constant.Constants; +import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.Permission; import com.cpop.core.base.entity.loginInfo.MallStaffLoginInfo; +import com.cpop.core.base.enums.InitRoleEnum; import com.cpop.core.base.enums.SourceType; import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.CpopAuthenticationException; @@ -14,10 +16,7 @@ import com.mybatisflex.core.row.Row; import com.mybatisflex.core.row.RowUtil; import org.springframework.stereotype.Component; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; /** @@ -83,12 +82,9 @@ public class MallLoginStrategy implements LoginStrategy{ private Set getPermissionSet(String username, String roleId) { //获取权限 Set permissionSet = new HashSet<>(); - if (Constants.SUPER_ADMIN.equals(username)) { + if (Constants.SUPER_ADMIN.equals(username) || StringUtils.equals(InitRoleEnum.SUPER_MALL_ROLE.getId(), roleId)) { permissionSet.add(Constants.ALL_PERMISSION); - } - else { - permissionSet.add(Constants.ALL_PERMISSION); - //TODO:测试中所有新建用户都是超级管理员 + } else { //查询员工信息 List list = DbChain.table("cp_sys_menu") .select("pom.permission") diff --git a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/OamLoginStrategy.java b/Cpop-Core/src/main/java/com/cpop/core/strategy/login/OamLoginStrategy.java index f9e30ba..53bf25a 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/OamLoginStrategy.java +++ b/Cpop-Core/src/main/java/com/cpop/core/strategy/login/OamLoginStrategy.java @@ -1,10 +1,12 @@ package com.cpop.core.strategy.login; import com.cpop.common.constant.Constants; +import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.Permission; import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; +import com.cpop.core.base.enums.InitRoleEnum; import com.cpop.core.base.enums.UserType; import com.cpop.core.base.table.SysUser; import com.mybatisflex.core.row.DbChain; @@ -74,10 +76,9 @@ public class OamLoginStrategy implements LoginStrategy{ private Set getPermissionSet(String username, String roleId) { //获取权限 Set permissionSet = new HashSet<>(); - if (Constants.SUPER_ADMIN.equals(username)) { + if (Constants.SUPER_ADMIN.equals(username) || StringUtils.equals(InitRoleEnum.SUPER_OAM_ROLE.getId(), roleId)) { permissionSet.add(Constants.ALL_PERMISSION); } else { - permissionSet.add(Constants.ALL_PERMISSION); //查询员工信息 List list = DbChain.table("cp_sys_menu") .select("pom.permission") diff --git a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-prod.yml b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-prod.yml index eb7120f..5c92f0e 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-prod.yml +++ b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/application-prod.yml @@ -24,7 +24,7 @@ spring: #端口 port: 6333 #数据库 - database: 10 + database: 0 #密码 password: Jambox.123* #连接超时 @@ -60,11 +60,11 @@ mybatis-flex: log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl datasource: mall: - url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop_union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: Customer0401 jambox: - url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/jambox_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/jambox_association?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: Customer0401 @@ -86,8 +86,8 @@ wx: # 私钥文件 privateCertPath: /root/cpop-union/cpop-mall/script/secretKey/wxPay_cert.pem #支付通知地址 - notifyUrl: https://test.cpopsz.com/onlineShop/wxPay/callback/notify/order + notifyUrl: https://api.jamboxsys.com/Cpop-Mall/wxPay/callback/notify/order #退款通知地址 - notifyRefund: https://test.cpopsz.com/onlineShop/wxPay/callback/notify/refund + notifyRefund: https://api.jamboxsys.com/Cpop-Mall/wxPay/callback/notify/refund #分账通知地址 - notifySharing: https://test.cpopsz.com/onlineShop/wxPay/callback/notify/profitSharing \ No newline at end of file + notifySharing: https://api.jamboxsys.com/Cpop-Mall/wxPay/callback/notify/profitSharing \ No newline at end of file diff --git a/Cpop-Mall/Cpop-Mall-Web/src/test/java/com/cpop/mall/web/CpopWxPayTests.java b/Cpop-Mall/Cpop-Mall-Web/src/test/java/com/cpop/mall/web/CpopWxPayTests.java index 2203147..3dd5df1 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/test/java/com/cpop/mall/web/CpopWxPayTests.java +++ b/Cpop-Mall/Cpop-Mall-Web/src/test/java/com/cpop/mall/web/CpopWxPayTests.java @@ -82,10 +82,10 @@ public class CpopWxPayTests { //ProfitSharing profitSharing = SpringUtils.getBean(ProfitSharingService.class).getById("77860920238751744"); //profitSharingReturnRequest.setOrderId(profitSharing.getOutProfitSharingId()); //profitSharingReturnRequest.setOutReturnNo(profitSharing.getId()); - profitSharingReturnRequest.setOrderId("30001200512023110656192114311"); - profitSharingReturnRequest.setOutReturnNo("4200002030202311064693113248"); + profitSharingReturnRequest.setOrderId("30000600822023111456560002430"); + profitSharingReturnRequest.setOutReturnNo("1724352351424733184"); profitSharingReturnRequest.setDescription("分账退款"); - profitSharingReturnRequest.setSubMchId("1650816616"); + profitSharingReturnRequest.setSubMchId("1618925571"); profitSharingReturnRequest.setReturnMchid("1618884922"); //profitSharingReturnRequest.setAmount(profitSharing.getAmount()); profitSharingReturnRequest.setAmount(1L); @@ -96,7 +96,6 @@ public class CpopWxPayTests { * @descriptions 添加分账接收方 * @author DB * @date 2023/11/03 10:17 - * @param * @return: void */ @Test @@ -104,14 +103,14 @@ public class CpopWxPayTests { //固定商户信息 Map mapReceiver = new HashMap<>(4); mapReceiver.put("type", "MERCHANT_ID"); - //mapReceiver.put("sub_mchid", "1650816616"); - mapReceiver.put("sub_mchid", "1618884922"); mapReceiver.put("account", "1618884922"); mapReceiver.put("relation_type", "SERVICE_PROVIDER"); mapReceiver.put("name","果酱盒子"); //添加分账接收方 ProfitSharingReceiverRequest profitSharingReceiver = new ProfitSharingReceiverRequest(); profitSharingReceiver.setReceiver(JSONObject.toJSONString(mapReceiver)); + WxPayConfig config = wxPayService.getConfig(); + config.setSubMchId("1618925571"); wxPayService.getProfitSharingService().addReceiver(profitSharingReceiver); } } diff --git a/Cpop-Oam/Cpop-Oam-Web/pom.xml b/Cpop-Oam/Cpop-Oam-Web/pom.xml index ce0b101..f6e07cf 100644 --- a/Cpop-Oam/Cpop-Oam-Web/pom.xml +++ b/Cpop-Oam/Cpop-Oam-Web/pom.xml @@ -27,6 +27,7 @@ + Cpop-Oam-Web org.springframework.boot diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-prod.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-prod.yml index 316b6dc..f03b9f0 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-prod.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-prod.yml @@ -1,7 +1,7 @@ # 项目相关配置 cpop: # 文件路径 示例( Windows配置W:/WorkSpace/java/uploadPath,Linux配置 /home/baseFramework/uploadPath) - profile: /root/jambox-union/jambox-oam/uploadPath/upload + profile: /root/cpop-union/cpop-oam/upload jwt: #白名单 whiteList: /login,/getCaptcha,/profile/**,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/* @@ -9,18 +9,14 @@ cpop: gateway: rsa-keypair: # 公钥文件 - publicKeyFile: /root/jambox-union/jambox-oam/script/secretKey/publicKey + publicKeyFile: /root/cpop-union/cpop-oam/script/secretKey/publicKey # 公钥文件 - privateKeyFile: /root/jambox-union/jambox-oam/script/secretKey/privateKey + privateKeyFile: /root/cpop-union/cpop-oam/script/secretKey/privateKey # DataSource Config spring: application: name: Cpop-Oam-Prod - datasource: - url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: root - password: Customer0401 #redis配置 redis: #地址 @@ -28,7 +24,7 @@ spring: #端口 port: 6333 #数据库 - database: 5 + database: 0 #密码 password: Jambox.123* #连接超时 @@ -57,4 +53,13 @@ server: #Mybatis-Flex mybatis-flex: configuration: - log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl \ No newline at end of file + log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl + datasource: + mall: + url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop_union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: root + password: Customer0401 + jambox: + url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/jambox_association?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true + username: root + password: Customer0401 \ No newline at end of file diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-test.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-test.yml index e890337..dfea3c3 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-test.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-test.yml @@ -1,7 +1,7 @@ # 项目相关配置 cpop: # 文件路径 示例( Windows配置W:/WorkSpace/java/uploadPath,Linux配置 /home/baseFramework/uploadPath) - profile: /root/jambox-union/jambox-oam/uploadPath/upload + profile: /root/cpop-union/cpop-mall/upload jwt: #白名单 whiteList: /login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/* @@ -17,10 +17,6 @@ cpop: spring: application: name: Cpop-Oam-Test - datasource: - url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: root - password: Customer0401 #redis配置 redis: #地址 @@ -58,6 +54,15 @@ server: mybatis-flex: configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + datasource: + mall: + url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: root + password: Customer0401 + jambox: + url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/jambox_test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true + username: root + password: Customer0401 # springdoc-openapi项目配置 knife4j: diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/logback.xml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/logback.xml new file mode 100644 index 0000000..ae60909 --- /dev/null +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/logback.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] %level [%thread] %file:%line - %msg%n + UTF-8 + + + + + + ${LOG_HOME}/${LOG_PREFIX}-info.log + true + + + INFO + ACCEPT + DENY + + + ${LOG_HOME}/${LOG_PREFIX}-info-%d{yyyyMMdd}.log.%d + 7 + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] %level [%thread] %file:%line - %msg%n + UTF-8 + + + + + ${LOG_HOME}/${LOG_PREFIX}-error.log + true + + + ERROR + ACCEPT + DENY + + + ${LOG_HOME}/${LOG_PREFIX}-error-%d{yyyyMMdd}.log.%d + 7 + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] %level [%thread] %file:%line - %msg%n + UTF-8 + + + + + + + + + + + + + + diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/OamMallServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/OamMallServiceImpl.java index b4a2c4b..d046775 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/OamMallServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/OamMallServiceImpl.java @@ -108,22 +108,26 @@ public class OamMallServiceImpl implements OamMallService { Row roleBrand = Row.ofKey(RowKey.SNOW_FLAKE_ID); roleBrand.set("brand_id", bo.getBrandId()) .set("role_id", InitRoleEnum.SUPER_MALL_ROLE.getId()) - .set("source_type", SourceType.JAMBOX.toString()) .set("create_time", now) .set("update_time", now) .set("create_user_id", 1) .set("update_user_id", 1); Db.insert("cp_mall_role_brand",roleBrand); - DbChain.table("cp_mall_staff") - .setId(RowKey.SNOW_FLAKE_ID) - .set("name", bo.getName()) + Row mallStaff = Row.ofKey(RowKey.SNOW_FLAKE_ID); + mallStaff.set("name", bo.getName()) .set("role_brand_id", roleBrand.getString("id")) .set("user_id", sysUser.getId()) .set("create_time", now) .set("update_time", now) .set("create_user_id", 1) - .set("update_user_id", 1) - .save(); + .set("update_user_id", 1); + long count = DbChain.table("cp_j_brand_extend").where("brand_id = ?", bo.getBrandId()).count(); + if (count > 0) { + mallStaff.set("source_type", SourceType.JAMBOX.toString()); + } else { + mallStaff.set("source_type", SourceType.COMMON.toString()); + } + Db.insert("cp_mall_staff", mallStaff); } /** diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/RoleController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/RoleController.java index 710fc13..9096688 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/RoleController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/RoleController.java @@ -70,7 +70,6 @@ public class RoleController { * @return: com.cpop.core.base.R */ @PreAuthorize("@aps.hasPermission('system:role:insert')") - @OperationLog(operationLogEnumType = OperationLogEnum.INSERT_OAM_ROLE) @ApiOperation("新增角色") @PostMapping("/insertSysRole") public R insertSysRole(@RequestBody @Validated RoleBo bo) { @@ -100,7 +99,6 @@ public class RoleController { * @return com.jambox.core.base.R */ @PreAuthorize("@aps.hasPermission('system:role:update')") - @OperationLog(operationLogEnumType = OperationLogEnum.UPDATE_OAM_ROLE) @ApiOperation("修改角色") @PutMapping("/updateSysRole") public R updateSysRole(@RequestBody @Validated RoleBo bo) { @@ -112,7 +110,6 @@ public class RoleController { * 删除系统角色表 */ @PreAuthorize("@aps.hasPermission('system:role:remove')") - @OperationLog(operationLogEnumType = OperationLogEnum.REMOVE_OAM_ROLE) @ApiOperation("删除系统角色表") @DeleteMapping("/removeSysRole/{id}") public R removeSysRole(@PathVariable String id) { @@ -128,7 +125,6 @@ public class RoleController { * @Date: 2023/5/9 14:13 **/ @PreAuthorize("@aps.hasPermission('system:role:update')") - @OperationLog(operationLogEnumType = OperationLogEnum.UPDATE_OAM_ROLE) @ApiOperation("设置角色状态") @PutMapping("/setSysRoleStatus") public R setSysRoleStatus(@RequestBody @Validated RoleStatusBo bo) { diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/MenuServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/MenuServiceImpl.java index 624cf98..ef6eff2 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/MenuServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/MenuServiceImpl.java @@ -95,7 +95,8 @@ public class MenuServiceImpl extends ServiceImpl implements Me //标题不为空 .and(MENU.TITLE.like(bo.getTitle())) //构建公共菜单与特有菜单 - .and(MENU.USER_TYPE.in("COMMON", user.getUserType())) + .and(MENU.USER_TYPE.eq(user.getUserType())) + .and(MENU.NAME.notIn(Constants.HIDE_MENU.split(","))) .orderBy(MENU.ORDER_NO.asc()), MenuVo.class)); } diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/RoleServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/RoleServiceImpl.java index f42ffef..0a0fea6 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/RoleServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/RoleServiceImpl.java @@ -5,6 +5,7 @@ import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; +import com.cpop.core.base.enums.InitRoleEnum; import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.sql.SqlUtils; @@ -54,7 +55,7 @@ public class RoleServiceImpl extends ServiceImpl implements Ro Page page = this.mapper.paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(), QueryWrapper.create() .select(ROLE.ALL_COLUMNS) - .where(ROLE.ROLE_VALUE.ne(Constants.SUPER_ADMIN_VALUE)) + .where(ROLE.ID.ne(InitRoleEnum.SUPER_OAM_ROLE.getId())) .and(ROLE.ROLE_NAME.like(bo.getRoleName())) .and(ROLE.STATUS.eq(bo.getStatus())) .and(ROLE.USER_TYPE.eq(loginUser.getUserType()))