添加商城模块

This commit is contained in:
DB 2023-10-18 17:48:32 +08:00
parent 8e1b539669
commit 8e78c09801
18 changed files with 594 additions and 7 deletions

View File

@ -0,0 +1,59 @@
package com.cpop.core.config;
import com.cpop.common.utils.StringUtils;
import com.cpop.core.filter.XssFilter;
import lombok.Data;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.servlet.DispatcherType;
import java.util.HashMap;
import java.util.Map;
/**
* Filter配置
*
* @author DB
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "xss")
public class FilterConfig {
/**
* 排除链接多个用逗号分隔
*/
private String excludes;
/**
* 匹配链接
*/
private String urlPatterns;
/**
* @Description: xss过滤器
* @param
* @return: FilterRegistrationBean
* @Author: DB
* @Date: 2023/4/17 9:17
**/
@SuppressWarnings({"rawtypes", "unchecked"})
@Bean
@ConditionalOnProperty(value = "xss.enabled", havingValue = "true")
public FilterRegistrationBean xssFilterRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setDispatcherTypes(DispatcherType.REQUEST);
registration.setFilter(new XssFilter());
registration.addUrlPatterns(StringUtils.split(urlPatterns, ","));
registration.setName("xssFilter");
registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE);
Map<String, String> initParameters = new HashMap<String, String>();
initParameters.put("excludes", excludes);
registration.setInitParameters(initParameters);
return registration;
}
}

View File

@ -47,6 +47,7 @@ public class CoreServiceImpl implements CoreService {
.setCode(operationLogEnum.getCode())
.setInfo(MessageUtils.message(operationLogEnum.getInfo()))
.setDevIp(loginUser.getIpAddr())
.setOperationUserType(loginUser.getUserType())
.setOperationUserName(loginUser.getUsername());
if (200 == status) {
operationLog.setOperationUserId(loginUser.getUserId())

View File

@ -1,8 +1,6 @@
package com.cpop.jambox.business.service.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.core.base.exception.ServiceException;
import com.cpop.core.utils.SpringUtils;
@ -13,6 +11,8 @@ import com.cpop.jambox.business.mapper.CardTemplateMapper;
import com.cpop.jambox.business.service.CardTemplateService;
import com.cpop.jambox.business.vo.CardTemplateListVo;
import com.cpop.sdk.framework.handler.qCloudCos.QCloudCosHandler;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.cpop</groupId>
<artifactId>Cpop-Union</artifactId>
<version>1.0.0</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<artifactId>Cpop-Mall-Web</artifactId>
<name>Cpop-Mall-Web</name>
<description>Cpop-Mall-Web</description>
<packaging>jar</packaging>
<dependencies>
<!--核心宝-->
<dependency>
<groupId>com.cpop</groupId>
<artifactId>Cpop-Mall</artifactId>
</dependency>
<!--Mysql-->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,13 @@
package com.cpop.mall.web;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CpopMallWebApplication {
public static void main(String[] args) {
SpringApplication.run(CpopMallWebApplication.class, args);
}
}

View File

@ -0,0 +1,80 @@
# 项目相关配置
cpop:
# 文件路径 示例( Windows配置W:/WorkSpace/java/uploadPathLinux配置 /home/baseFramework/uploadPath
profile: E:/Cpop/uploadPath
jwt:
#白名单
whiteList: /login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources
gateway:
rsa-keypair:
# 公钥文件
publicKeyFile: E:\Cpop\Cpop-Union\Cpop-Core\src\main\resources\static\keyPair\publicKey
# 公钥文件
privateKeyFile: E:\Cpop\Cpop-Union\Cpop-Core\src\main\resources\static\keyPair\privateKey
# DataSource Config
spring:
application:
name: Cpop-Mall-Dev
datasource:
url: jdbc:mysql://localhost:3306/cpop-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: root
#redis配置
redis:
#地址
host: localhost
#端口
port: 6379
#数据库
database: 0
#密码
password:
#连接超时
timeout: 5000
lettuce:
pool:
#
min-idle: 0
#
max-idle: 8
#
max-active: 8
#
max-wait: -1ms
data:
mongodb:
host: localhost
port: 27017
database: cpop-union
server:
port: 9420
servlet:
context-path: /Cpop-Mall
#Mybatis-Flex
mybatis-flex:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# springdoc-openapi项目配置
knife4j:
enable: true
openapi:
title: Cpop-Mall开发API
description: Cpop-Mall开发API
email:
concat: DB
url: https://api.jamboxsys.com
version: 1.0.0
license: Apache 2.0
license-url: https://stackoverflow.com/
terms-of-service-url: https://api.jamboxsys.com
group:
#系统
system:
group-name: Mall
api-rule: package
api-rule-resources:
- com.cpop.mall

View File

@ -0,0 +1,60 @@
# 项目相关配置
cpop:
# 文件路径 示例( Windows配置W:/WorkSpace/java/uploadPathLinux配置 /home/baseFramework/uploadPath
profile: /root/jambox-union/jambox-oam/uploadPath/upload
jwt:
#白名单
whiteList: /login,/getCaptcha,/profile/**,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/*
#拦截
gateway:
rsa-keypair:
# 公钥文件
publicKeyFile: /root/jambox-union/jambox-oam/script/secretKey/publicKey
# 公钥文件
privateKeyFile: /root/jambox-union/jambox-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:
#地址
host: 106.52.49.102
#端口
port: 6333
#数据库
database: 5
#密码
password: Jambox.123*
#连接超时
timeout: 5000
lettuce:
pool:
#
min-idle: 0
#
max-idle: 8
#
max-active: 8
#
max-wait: -1ms
data:
mongodb:
host: localhost
port: 27017
database: rock-blade
server:
port: 9420
servlet:
context-path: /Cpop-Oam
#Mybatis-Flex
mybatis-flex:
configuration:
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl

View File

@ -0,0 +1,81 @@
# 项目相关配置
cpop:
# 文件路径 示例( Windows配置W:/WorkSpace/java/uploadPathLinux配置 /home/baseFramework/uploadPath
profile: /root/jambox-union/jambox-oam/uploadPath/upload
jwt:
#白名单
whiteList: /login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/*
#拦截
gateway:
rsa-keypair:
# 公钥文件
publicKeyFile: /root/jambox-union/jambox-oam/script/secretKey/publicKey
# 公钥文件
privateKeyFile: /root/jambox-union/jambox-oam/script/secretKey/privateKey
# DataSource Config
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:
#地址
host: 106.52.49.102
#端口
port: 6333
#数据库
database: 5
#密码
password: Jambox.123*
#连接超时
timeout: 5000
lettuce:
pool:
#
min-idle: 0
#
max-idle: 8
#
max-active: 8
#
max-wait: -1ms
data:
mongodb:
host: localhost
port: 27017
database: rock-blade
server:
port: 9420
servlet:
context-path: /Cpop-Oam
#Mybatis-Flex
mybatis-flex:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# springdoc-openapi项目配置
knife4j:
enable: true
openapi:
title: Cpop-OAM开发API
description: PuPu-OAM开发API
email:
concat: DB
url: https://api.jamboxsys.com
version: 1.0.0
license: Apache 2.0
license-url: https://stackoverflow.com/
terms-of-service-url: https://api.jamboxsys.com
group:
#系统
system:
group-name: Oam
api-rule: package
api-rule-resources:
- com.cpop.oam

View File

@ -0,0 +1,127 @@
# 项目相关配置
cpop:
# 名称
name: Cpop-Mall
# 版本
version: 1.0.0
#JWT
jwt:
#密钥
secret: abcdefghijklmnopqrstuvwxyz
#过期时间
expire: 604800
#token头
header: Authorization
#拦截
gateway:
rsa-keypair:
# 加密方式
algorithm: RSA
# 初始化大小
keySize: 2048
#Spring
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
servlet:
multipart:
#文件最大传输
max-file-size: 1024MB
max-request-size: 300MB
profiles:
active: dev,mall
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
#hikari数据源特性配置
hikari:
#最大连接数,默认值10.
maximum-pool-size: 10
#最小空闲连接默认值10.
minimum-idle: 10
#连接超时时间(毫秒),默认值30秒.
connection-timeout: 30000
#空闲连接超时时间默认值600000(10分钟),只有空闲连接数大于最大连接数且空闲时间超过该值,才会被释放;如果大于等于 max-lifetime 且 max-lifetime>0,则会被重置为0.
idle-timeout: 600000
#连接最大存活时间,默认值30分钟.设置应该比mysql设置的超时时间短
max-lifetime: 3000000
#连接测试查询
connection-test-query: select 1
messages:
#i18n
basename: static/i18n/messages
encoding: UTF-8
cacheDuration: 3600
quartz:
job-store-type: jdbc
jdbc:
initialize-schema: embedded
#定时任务启动开关true-开 false-关
auto-startup: true
#延迟1秒启动定时任务
startup-delay: 1s
#启动时更新己存在的Job
overwrite-existing-jobs: true
properties:
org:
quartz:
scheduler:
instanceName: CpopMallScheduler
instanceId: AUTO
jobStore:
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
tablePrefix: QRTZ_
isClustered: false
misfireThreshold: 12000
clusterCheckinInterval: 15000
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 1
threadPriority: 5
threadsInheritContextClassLoaderOfInitializingThread: true
#Mybatis-Flex
mybatis-flex:
global-config:
key-config:
key-type: generator
value: snowFlakeId
# 逻辑删除数据存在标记值 默认值:0
normal-value-of-logic-delete: 0
# 逻辑删除数据删除标记值 默认值:0
deleted-value-of-logic-delete: 1
# 全局逻辑删除默认字段
logic-delete-column: is_delete
# 线程池配置参数
task:
pool:
# 设置核心线程数
corePoolSize: 10
# 设置最大线程数
maxPoolSize: 20
# 设置空闲线程存活时间(秒
keepAliveSeconds: 300
# 设置队列容量
queueCapacity: 100
# 设置线程名称前缀
threadNamePrefix: "Cpop-Mall-AsyncNotify-"
# 设置线程池等待终止时间(秒)
awaitTerminationSeconds: 60
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes:
# 匹配链接
urlPatterns: /mall/*
logging:
level:
#swagger日志
springfox: error

View File

@ -0,0 +1,33 @@
#\u767B\u5F55\u4FE1\u606F
i18n_login_success=Login Success
i18n_loginOut_success=Login Out Success
#\u64CD\u4F5C\u65E5\u5FD7\u4FE1\u606F
i18n_operationLog_systemLogin=System User Login
i18n_operationLog_systemLogout=System User Logout
i18n_operationLog_updateOamConfig=Update System Config
i18n_operationLog_insertOamMenu=Insert Oam Menu
i18n_operationLog_updateOamMenu=Update Oam Menu
i18n_operationLog_removeOamMenu=Remove Oam Menu
i18n_operationLog_insertOamRole=Insert Oam Role
i18n_operationLog_updateOamRole=Update Oam Role
i18n_operationLog_removeOamRole=Remove Oam Role
i18n_operationLog_insertOamDept=Insert Oam Dept
i18n_operationLog_updateOamDept=Update Oam Dept
i18n_operationLog_removeOamDept=Remove Oam Dept
i18n_operationLog_insertOamStaff=Insert Oam User
i18n_operationLog_updateOamStaff=Update Oam User
i18n_operationLog_removeOamStaff=Remove Oam User
i18n_operationLog_updateOamStaffPassword=Update Oam Staff Password
#\u7CFB\u7EDF\u63D0\u793A\u4FE1\u606F
i18n_alert_accountOrPwdError=Username or password is wrong!
i18n_alert_peopleUnderTheDepartmentError=There are people under the department, it is not allowed to delete the department!
i18n_alert_departmentNotDeactivatedError=The current department is not deactivated, deletion is not allowed\uFF01
i18n_alert_userOrPhoneOrEmailIsExist=Username or mobile phone number or email address already exists
i18n_alert_userIsExist=User already exists
i18n_alert_oldPasswordIsWrong=The old password was entered incorrectly, please try again
#\u7CFB\u7EDF\u57FA\u7840\u4FE1\u606F
i18n_baseInfo_success=Success
i18n_baseInfo_failed=Failed

View File

@ -0,0 +1,33 @@
#\u767B\u5F55\u4FE1\u606F
i18n_login_success=\u767B\u5F55\u6210\u529F
i18n_loginOut_success=\u767B\u51FA\u6210\u529F
#\u64CD\u4F5C\u65E5\u5FD7\u4FE1\u606F
i18n_operationLog_systemLogin=\u7CFB\u7EDF\u7528\u6237\u767B\u5F55
i18n_operationLog_systemLogout=\u7CFB\u7EDF\u7528\u6237\u9000\u51FA
i18n_operationLog_updateOamConfig=\u4FEE\u6539\u7CFB\u7EDF\u914D\u7F6E
i18n_operationLog_insertOamMenu=\u6DFB\u52A0OAM\u83DC\u5355
i18n_operationLog_updateOamMenu=\u4FEE\u6539OAM\u83DC\u5355
i18n_operationLog_removeOamMenu=\u5220\u9664OAM\u83DC\u5355
i18n_operationLog_insertOamRole=\u6DFB\u52A0OAM\u89D2\u8272
i18n_operationLog_updateOamRole=\u4FEE\u6539OAM\u89D2\u8272
i18n_operationLog_removeOamRole=\u5220\u9664OAM\u89D2\u8272
i18n_operationLog_insertOamDept=\u6DFB\u52A0OAM\u90E8\u95E8
i18n_operationLog_updateOamDept=\u4FEE\u6539OAM\u90E8\u95E8
i18n_operationLog_removeOamDept=\u5220\u9664OAM\u90E8\u95E8
i18n_operationLog_insertOamStaff=\u6DFB\u52A0OAM\u7528\u6237
i18n_operationLog_updateOamStaff=\u4FEE\u6539OAM\u7528\u6237
i18n_operationLog_removeOamStaff=\u5220\u9664OAM\u7528\u6237
i18n_operationLog_updateOamStaffPassword=\u4FEE\u6539OAM\u7528\u6237\u5BC6\u7801
#\u7CFB\u7EDF\u63D0\u793A\u4FE1\u606F
i18n_alert_accountOrPwdError=\u8D26\u53F7\u6216\u5BC6\u7801\u9519\u8BEF\uFF01
i18n_alert_peopleUnderTheDepartmentError=\u5F53\u524D\u90E8\u95E8\u4E0B\u6709\u4EBA\u5458\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664\u90E8\u95E8\uFF01
i18n_alert_departmentNotDeactivatedError=\u5F53\u524D\u90E8\u95E8\u672A\u505C\u7528\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664\u90E8\u95E8\uFF01
i18n_alert_userOrPhoneOrEmailIsExist=\u7528\u6237\u540D\u6216\u624B\u673A\u53F7\u6216\u90AE\u7BB1\u5DF2\u5B58\u5728
i18n_alert_userIsExist=\u7528\u6237\u5DF2\u5B58\u5728
i18n_alert_oldPasswordIsWrong=\u65E7\u5BC6\u7801\u8F93\u5165\u9519\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165
#\u7CFB\u7EDF\u57FA\u7840\u4FE1\u606F
i18n_baseInfo_success=\u6210\u529F
i18n_baseInfo_failed=\u5931\u8D25

View File

@ -0,0 +1,13 @@
package com.cpop.mall.web;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CpopMallWebApplicationTests {
@Test
void contextLoads() {
}
}

24
Cpop-Mall/pom.xml Normal file
View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.cpop</groupId>
<artifactId>Cpop-Union</artifactId>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<artifactId>Cpop-Mall</artifactId>
<name>Cpop-Mall</name>
<description>Cpop-商城</description>
<packaging>jar</packaging>
<dependencies>
<!--核心包-->
<dependency>
<groupId>com.cpop</groupId>
<artifactId>Cpop-Core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1 @@

View File

@ -112,6 +112,15 @@ task:
# 设置线程池等待终止时间(秒)
awaitTerminationSeconds: 60
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes:
# 匹配链接
urlPatterns: /oam/*
logging:
level:
#swagger日志

View File

@ -1,7 +1,5 @@
package com.cpop.oam.business.service.impl;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cpop.common.utils.StringUtils;
import com.cpop.common.utils.bean.BeanUtils;
import com.cpop.core.base.exception.ServiceException;
@ -12,8 +10,10 @@ import com.cpop.oam.business.bo.DeptListBo;
import com.cpop.oam.business.entity.Dept;
import com.cpop.oam.business.mapper.DeptMapper;
import com.cpop.oam.business.service.DeptService;
import com.cpop.oam.business.service.StaffService;
import com.cpop.oam.business.service.StaffMidDeptService;
import com.cpop.oam.business.vo.DeptVo;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -21,7 +21,7 @@ import java.util.List;
import java.util.stream.Collectors;
import static com.cpop.oam.business.entity.table.DeptTableDef.DEPT;
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
import static com.cpop.oam.business.entity.table.StaffMidDeptTableDef.STAFF_MID_DEPT;
/**
* 部门表 服务层实现
@ -159,7 +159,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
//递归获取当前部门与子部门
List<String> deptIds = filterSonDept(list, id);
//删除部门首先要查询员工
if (SpringUtils.getBean(StaffService.class).count(QueryWrapper.create().where(STAFF.DEPT_ID.in(deptIds))) > 0) {
if (SpringUtils.getBean(StaffMidDeptService.class).count(QueryWrapper.create().where(STAFF_MID_DEPT.DEPT_ID.in(deptIds))) > 0) {
throw new ServiceException(MessageUtils.message("i18n_alert_peopleUnderTheDepartmentError"));
} else {
//当部门人员及其子部门人员为空时才允许删除部门

View File

@ -25,6 +25,7 @@
<module>Cpop-Oam/Cpop-Oam-Web</module>
<module>Cpop-Jambox</module>
<module>Cpop-Jambox/Cpop-Jambox-Web</module>
<module>Cpop-Mall</module>
</modules>
<properties>
@ -110,6 +111,11 @@
<artifactId>Cpop-Jambox</artifactId>
<version>${cpop.version}</version>
</dependency>
<dependency>
<groupId>com.cpop</groupId>
<artifactId>Cpop-Mall</artifactId>
<version>${cpop.version}</version>
</dependency>
<!--HikariCP-->
<dependency>
<groupId>com.zaxxer</groupId>