Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
8ea97c30e8
|
|
@ -0,0 +1,128 @@
|
|||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-modules</artifactId>
|
||||
<version>24.12.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>bonus-bmw</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--加密依赖包-->
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>${jasypt-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- bonus Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- bonus Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- bonus Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- bonus Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>30.0-jre</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>6.0.18</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.bonus.bmw;
|
||||
|
||||
import com.bonus.common.security.annotation.EnableCustomConfig;
|
||||
import com.bonus.common.security.annotation.EnableRyFeignClients;
|
||||
import com.bonus.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 系统模块
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
@EnableScheduling
|
||||
public class BonusBmwApplication
|
||||
{
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(BonusBmwApplication.class, args);
|
||||
System.err.println("博诺思后端管理模块启动成功\n" +
|
||||
" ____ _ _ _____ \n" +
|
||||
" | _ \\ | \\ | | / ____|\n" +
|
||||
" | |_) || \\| || (___ \n" +
|
||||
" | _ < | . ` | \\___ \\ \n" +
|
||||
" | |_) || |\\ | ____) |\n" +
|
||||
" |____/ |_| \\_||_____/ \n");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.bonus.bmw.config;
|
||||
|
||||
import com.bonus.bmw.interceptor.DataEnDecryptInterceptor;
|
||||
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* mybatis 配置类
|
||||
* @author weiweiwang
|
||||
*/
|
||||
@Configuration
|
||||
public class MyBatisConfig {
|
||||
@Bean
|
||||
public ConfigurationCustomizer configurationCustomizer() {
|
||||
return configuration -> {
|
||||
configuration.addInterceptor(new DataEnDecryptInterceptor());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.bonus.bmw.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 该类用于从 `application.yml` 中加载密码策略的配置项。
|
||||
* 使用 @ConfigurationProperties 注解,前缀为 password-policy。
|
||||
* @author bonus
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "password-policy")
|
||||
@Data
|
||||
public class PasswordPolicyConfig {
|
||||
|
||||
// 密码的最小长度
|
||||
private int minLength;
|
||||
|
||||
// 密码的最大长度
|
||||
private int maxLength;
|
||||
|
||||
// 是否需要包含大写字母
|
||||
private boolean requireUpperCase;
|
||||
|
||||
// 是否需要包含小写字母
|
||||
private boolean requireLowerCase;
|
||||
|
||||
// 是否需要包含数字
|
||||
private boolean requireDigit;
|
||||
|
||||
// 是否需要包含特殊字符
|
||||
private boolean requireSpecialChar;
|
||||
|
||||
// 常见的弱密码列表,禁止使用这些密码
|
||||
private List<String> weakPasswords;
|
||||
|
||||
// 密码历史记录限制
|
||||
private int passwordHistoryLimit;
|
||||
|
||||
// 是否限制连续相同字符
|
||||
private boolean restrictConsecutiveChars;
|
||||
|
||||
// 最大允许的连续字符数
|
||||
private int maxConsecutiveChars;
|
||||
|
||||
// 密码中是否不能包含用户名
|
||||
private boolean excludeUsernameInPassword;
|
||||
|
||||
// 是否在首次登录时强制修改密码
|
||||
private boolean forcePasswordChangeOnFirstLogin;
|
||||
|
||||
// 定期修改密码
|
||||
private int regularlyChangePassword;
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import com.bonus.bmw.service.BmWorkerWageCardService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.InnerAuth;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人员工资卡信息表(bm_worker_wage_card)表控制层
|
||||
*
|
||||
* @author fly
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/workerWageCard")
|
||||
public class BmWorkerWageCardController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private BmWorkerWageCardService service;
|
||||
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @param o
|
||||
* @return
|
||||
* , requiresPermissions = @RequiresPermissions("system:wageCard:list")
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth(isUser = false))
|
||||
@GetMapping("/list")
|
||||
@SysLog(title = "工资卡管理", businessType = OperaType.QUERY, logType = 0, module = "施工人员->红绿灯管理->工资卡管理", details = "查询工资卡列表")
|
||||
public TableDataInfo list(BmWorkerWageCard o) {
|
||||
try {
|
||||
startPage();
|
||||
List<BmWorkerWageCard> list = service.selectWageCardList(o);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:wageCard:edit"))
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "查询工资卡列表", businessType = OperaType.UPDATE, logType = 0, module = "施工人员->红绿灯管理->工资卡管理", details = "修改工资卡")
|
||||
public AjaxResult edit(@Validated @RequestBody BmWorkerWageCard o) {
|
||||
try {
|
||||
return toAjax(service.updateByPrimaryKey(o));
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:remove"))
|
||||
@PostMapping("/delete/{id}")
|
||||
@SysLog(title = "工资卡管理", businessType = OperaType.DELETE, logType = 0, module = "施工人员->红绿灯管理->工资卡管理", details = "删除工资卡")
|
||||
public AjaxResult remove(@PathVariable("id") Integer id) {
|
||||
try {
|
||||
return toAjax(service.deleteByPrimaryKey(id));
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 人员工资卡信息表
|
||||
*/
|
||||
@Data
|
||||
public class BmWorkerWageCard {
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 施工人员id
|
||||
*/
|
||||
private Integer workerId;
|
||||
|
||||
/**
|
||||
* 银行卡号
|
||||
*/
|
||||
private String bankCardCode;
|
||||
|
||||
/**
|
||||
* 银行名称
|
||||
*/
|
||||
private String bankName;
|
||||
|
||||
/**
|
||||
* 银行支行名称
|
||||
*/
|
||||
private String bankBranchName;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String updateUser;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
private String idNumber;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
}
|
||||
|
|
@ -0,0 +1,182 @@
|
|||
package com.bonus.bmw.interceptor;
|
||||
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.system.api.domain.SysDept;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import org.apache.ibatis.executor.parameter.ParameterHandler;
|
||||
import org.apache.ibatis.executor.resultset.ResultSetHandler;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.plugin.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* mybatis 拦截器
|
||||
* 对用户和部门实体里的邮箱和电话号码进行加密存库,并从库里查询后解密
|
||||
* @author weiweiwang
|
||||
*/
|
||||
@Intercepts({
|
||||
@Signature(type = ParameterHandler.class, method = "setParameters", args = {PreparedStatement.class}),
|
||||
@Signature(type = ResultSetHandler.class, method = "handleResultSets", args = {Statement.class})
|
||||
})
|
||||
public class DataEnDecryptInterceptor implements Interceptor {
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
final static String USER_MAPPER_ID = "com.bonus.system.mapper.SysUserMapper";
|
||||
final static String DEPT_MAPPER_ID = "com.bonus.system.mapper.SysDeptMapper";
|
||||
@Override
|
||||
public Object intercept(Invocation invocation) throws Throwable {
|
||||
try {
|
||||
if (invocation.getTarget() instanceof ParameterHandler) {
|
||||
// Handle encryption before setting parameters
|
||||
ParameterHandler parameterHandler = (ParameterHandler) invocation.getTarget();
|
||||
MappedStatement mappedStatement = getMappedStatement(parameterHandler);
|
||||
PreparedStatement preparedStatement = (PreparedStatement) invocation.getArgs()[0];
|
||||
Object parameterObject = parameterHandler.getParameterObject();
|
||||
String sqlId = mappedStatement.getId();
|
||||
if (sqlId.contains(USER_MAPPER_ID)){
|
||||
encryptUserObject(parameterObject);
|
||||
} else if (sqlId.contains(DEPT_MAPPER_ID)){
|
||||
encryptDeptObject(parameterObject);
|
||||
}
|
||||
return invocation.proceed();
|
||||
|
||||
} else if (invocation.getTarget() instanceof ResultSetHandler) {
|
||||
// Handle decryption after result set is obtained
|
||||
ResultSetHandler resultSetHandler = (ResultSetHandler) invocation.getTarget();
|
||||
|
||||
MappedStatement mappedStatement = getMappedStatement(resultSetHandler);
|
||||
Object result = invocation.proceed();
|
||||
|
||||
String sqlId = mappedStatement.getId();
|
||||
if (sqlId.contains(USER_MAPPER_ID))
|
||||
{
|
||||
decryUserObject(result);
|
||||
} else if (sqlId.contains(DEPT_MAPPER_ID)){
|
||||
decryDeptObject(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return invocation.proceed();
|
||||
}
|
||||
catch (Exception e){
|
||||
logger.error("mybatis对敏感数据加解密拦截器异常报错,{}",e.getMessage ());
|
||||
return invocation.proceed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object plugin(Object target) {
|
||||
return Plugin.wrap(target, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperties(Properties properties) {
|
||||
}
|
||||
|
||||
private void encryptUserObject(Object parameterObject){
|
||||
if (parameterObject instanceof SysUser) {
|
||||
SysUser user = (SysUser) parameterObject;
|
||||
// 加密敏感字段
|
||||
if (user.getEmail() != null) {
|
||||
user.setEmail(Sm4Utils.encrypt(user.getEmail()));
|
||||
}
|
||||
if (user.getPhonenumber() != null) {
|
||||
user.setPhonenumber(Sm4Utils.encrypt(user.getPhonenumber()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void encryptDeptObject(Object parameterObject) {
|
||||
if (parameterObject instanceof SysDept) {
|
||||
SysDept dept = (SysDept) parameterObject;
|
||||
// 加密敏感字段
|
||||
if (dept.getEmail() != null) {
|
||||
dept.setEmail(Sm4Utils.encrypt(dept.getEmail()));
|
||||
}
|
||||
if (dept.getPhone() != null) {
|
||||
dept.setPhone(Sm4Utils.encrypt(dept.getPhone()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void decryUserObject(Object result){
|
||||
try {
|
||||
if (result instanceof ArrayList) {
|
||||
List<?> list = (List<?>) result;
|
||||
for (Object obj : list) {
|
||||
if (obj instanceof SysUser) {
|
||||
decryptUser ((SysUser) obj);
|
||||
}
|
||||
}
|
||||
} else if (result instanceof SysUser) {
|
||||
decryptUser ((SysUser) result);
|
||||
}
|
||||
} catch (Exception ingore) {
|
||||
}
|
||||
}
|
||||
private void decryptUser(SysUser user) {
|
||||
if (user.getEmail() != null) {
|
||||
user.setEmail(Sm4Utils.decrypt(user.getEmail()));
|
||||
}
|
||||
if (user.getPhonenumber() != null) {
|
||||
user.setPhonenumber(Sm4Utils.decrypt(user.getPhonenumber()));
|
||||
}
|
||||
}
|
||||
|
||||
private void decryDeptObject(Object result){
|
||||
try {
|
||||
if (result instanceof ArrayList) {
|
||||
List<?> list = (List<?>) result;
|
||||
for (Object obj : list) {
|
||||
if (obj instanceof SysDept) {
|
||||
decryptDept ((SysDept) obj);
|
||||
}
|
||||
}
|
||||
} else if (result instanceof SysDept) {
|
||||
decryptDept ((SysDept) result);
|
||||
}
|
||||
} catch (Exception ingore) {
|
||||
}
|
||||
}
|
||||
|
||||
private void decryptDept(SysDept dept) {
|
||||
if (dept.getEmail() != null) {
|
||||
dept.setEmail(Sm4Utils.decrypt(dept.getEmail()));
|
||||
}
|
||||
if (dept.getPhone() != null) {
|
||||
dept.setPhone(Sm4Utils.decrypt(dept.getPhone()));
|
||||
}
|
||||
}
|
||||
|
||||
private MappedStatement getMappedStatement(ParameterHandler parameterHandler) {
|
||||
try {
|
||||
// Use reflection to access the private field `mappedStatement` (or appropriate field)
|
||||
Field mappedStatementField = parameterHandler.getClass().getDeclaredField("mappedStatement");
|
||||
mappedStatementField.setAccessible(true);
|
||||
return (MappedStatement) mappedStatementField.get(parameterHandler);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to get MappedStatement from ParameterHandler", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private MappedStatement getMappedStatement(ResultSetHandler resultSetHandler) {
|
||||
try {
|
||||
// Use reflection to access the private field `mappedStatement` (or appropriate field)
|
||||
Field mappedStatementField = resultSetHandler.getClass().getDeclaredField("mappedStatement");
|
||||
mappedStatementField.setAccessible(true);
|
||||
return (MappedStatement) mappedStatementField.get(resultSetHandler);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to get MappedStatement from ResultSetHandler", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.bonus.bmw.mapper;
|
||||
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BmWorkerWageCardMapper {
|
||||
/**
|
||||
* delete by primary key
|
||||
*
|
||||
* @param id primaryKey
|
||||
* @return deleteCount
|
||||
*/
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
/**
|
||||
* insert record to table
|
||||
*
|
||||
* @param record the record
|
||||
* @return insert count
|
||||
*/
|
||||
int insert(BmWorkerWageCard record);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<BmWorkerWageCard> selectWageCardList(BmWorkerWageCard o);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BmWorkerWageCardService {
|
||||
|
||||
/**
|
||||
* 修改工资卡
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
int updateByPrimaryKey(BmWorkerWageCard record);
|
||||
|
||||
/**
|
||||
* 查询工资卡列表
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<BmWorkerWageCard> selectWageCardList(BmWorkerWageCard o);
|
||||
|
||||
/**
|
||||
* 删除工资卡
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import com.bonus.bmw.mapper.BmWorkerWageCardMapper;
|
||||
import com.bonus.bmw.service.BmWorkerWageCardService;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class BmWorkerWageCardServiceImpl implements BmWorkerWageCardService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BmWorkerWageCardServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private BmWorkerWageCardMapper mapper;
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKey(BmWorkerWageCard record) {
|
||||
//存在则删除后新增,不存在则新增
|
||||
if(record.getId() != null){
|
||||
deleteByPrimaryKey(record.getId());
|
||||
}
|
||||
record.setCreateUser(SecurityUtils.getUsername());
|
||||
//添加到文件库和minio上 TODO
|
||||
return mapper.insert(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工资卡列表
|
||||
*
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BmWorkerWageCard> selectWageCardList(BmWorkerWageCard o) {
|
||||
return mapper.selectWageCardList(o);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工资卡
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int deleteByPrimaryKey(Integer id) {
|
||||
//删除数据和工资卡图片
|
||||
int i = mapper.deleteByPrimaryKey(id);
|
||||
//删除工资卡图片 TODO
|
||||
//删除minio文件
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
||||
_ _
|
||||
(_) | |
|
||||
_ __ _ _ ___ _ _ _ ______ ___ _ _ ___ | |_ ___ _ __ ___
|
||||
| '__|| | | | / _ \ | | | || ||______|/ __|| | | |/ __|| __| / _ \| '_ ` _ \
|
||||
| | | |_| || (_) || |_| || | \__ \| |_| |\__ \| |_ | __/| | | | | |
|
||||
|_| \__,_| \___/ \__, ||_| |___/ \__, ||___/ \__| \___||_| |_| |_|
|
||||
__/ | __/ |
|
||||
|___/ |___/
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 18082
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 192.168.0.14:8848
|
||||
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 192.168.0.14:8848
|
||||
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 38083
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
username: nacos
|
||||
password: nacos
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 192.168.0.14:8848
|
||||
namespace: huadong_realname_dev
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 192.168.0.14:8848
|
||||
namespace: huadong_realname_dev
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
|
||||
#加密组件
|
||||
jasypt:
|
||||
encryptor:
|
||||
password: Encrypt
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: bonus-bmw
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: local
|
||||
task:
|
||||
scheduling:
|
||||
pool:
|
||||
size: 1 # 定时任务线程池大小
|
||||
thread-name-prefix: scheduled-task- # 定时任务线程名称前缀
|
||||
|
||||
#加密组件
|
||||
jasypt:
|
||||
encryptor:
|
||||
password: Encrypt
|
||||
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/bonus-system" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.bonus" level="debug" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.bmw.mapper.BmWorkerWageCardMapper">
|
||||
<resultMap id="BaseResultMap" type="com.bonus.bmw.domain.vo.BmWorkerWageCard">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table bm_worker_wage_card-->
|
||||
<id column="id" property="id" />
|
||||
<result column="worker_id" property="workerId" />
|
||||
<result column="bank_card_code" property="bankCardCode" />
|
||||
<result column="bank_name" property="bankName" />
|
||||
<result column="bank_branch_name" property="bankBranchName" />
|
||||
<result column="create_user" property="createUser" />
|
||||
<result column="update_user" property="updateUser" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="phone" property="phone" />
|
||||
<result column="name" property="name" />
|
||||
<result column="id_number" property="idNumber" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, worker_id, bank_card_code, bank_name, bank_branch_name, create_user, update_user
|
||||
</sql>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<!--@mbg.generated-->
|
||||
update bm_worker_wage_card set is_active = 0
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.bonus.system.api.domain.BmWorkerWageCard" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into bm_worker_wage_card (worker_id, bank_card_code, bank_name, bank_branch_name, create_user)
|
||||
values (#{workerId}, #{bankCardCode}, #{bankName}, #{bankBranchName}, #{createUser})
|
||||
</insert>
|
||||
|
||||
<select id="selectWageCardList" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
pw.name,
|
||||
pw.id_number,
|
||||
pw.phone,
|
||||
bwwc.id,
|
||||
bwwc.bank_card_code,
|
||||
bwwc.bank_name,
|
||||
bwwc.bank_branch_name,
|
||||
bwwc.update_time
|
||||
FROM
|
||||
pm_worker pw
|
||||
LEFT JOIN `bm_worker_wage_card` bwwc ON pw.id = bwwc.worker_id
|
||||
AND bwwc.is_active = 1
|
||||
WHERE
|
||||
pw.is_active = 1
|
||||
<if test="name != null">
|
||||
AND pw.name LIKE CONCAT('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="idNumber != null">
|
||||
AND pw.id_number LIKE CONCAT('%', #{idNumber}, '%')
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
AND pw.phone LIKE CONCAT('%', #{phone}, '%')
|
||||
</if>
|
||||
<if test="bankCardCode != null">
|
||||
AND bwwc.bank_card_code LIKE CONCAT('%', #{bankCardCode}, '%')
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
|
||||
<configuration>
|
||||
<!-- 其他MyBatis配置 -->
|
||||
|
||||
<!-- 插件配置 -->
|
||||
<plugins>
|
||||
<plugin interceptor="com.bonus.system.Interceptor.DataScopeInterceptor">
|
||||
<property name="someProperty" value="someValue"/>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<!-- 其他配置 -->
|
||||
</configuration>
|
||||
|
|
@ -13,8 +13,7 @@
|
|||
<module>bonus-system</module>
|
||||
<module>bonus-job</module>
|
||||
<module>bonus-file</module>
|
||||
|
||||
|
||||
<module>bonus-bmw</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>bonus-modules</artifactId>
|
||||
|
|
|
|||
Loading…
Reference in New Issue