Commit d382dabf authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents c33c5a9f e1c36c3c
......@@ -99,7 +99,8 @@
<module>yifu-check</module>
<module>yifu-archives</module>
<module>yifu-social</module>
</modules>
<module>yifu-insurances</module>
</modules>
<dependencyManagement>
<dependencies>
......
......@@ -31,7 +31,10 @@ import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeContractConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractUpdateVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants;
......@@ -42,7 +45,6 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -56,9 +58,7 @@ import java.math.BigDecimal;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 员工合同
......@@ -118,22 +118,25 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
if (Common.isEmpty(tEmployeeContractInfo.getEmpId()) || Common.isEmpty(tEmployeeContractInfo.getSettleDomain())) {
return R.failed(EmployeeConstants.EMPID_NOT_EMPTY);
}
return this.setBaseInfo(tEmployeeContractInfo);
return this.setBaseInfo(tEmployeeContractInfo, null);
} catch (Exception e) {
log.error("员工合同保存异常:" + e.getMessage());
return R.failed("员工合同保存系统异常!");
}
}
private R<List<ErrorMessage>> setBaseInfo(TEmployeeContractInfo tEmployeeContractInfo) {
private R<List<ErrorMessage>> setBaseInfo(TEmployeeContractInfo tEmployeeContractInfo, TEmployeeProject tEmployeeProject) {
// 获取人员档案
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(tEmployeeContractInfo.getEmpId());
// 获取项目
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, tEmployeeContractInfo.getEmpId())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
if (tEmployeeProject == null) {
tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, tEmployeeContractInfo.getEmpId())
.eq(TEmployeeProject::getDeptId, tEmployeeContractInfo.getSettleDomain())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
}
if (null == tEmployeeInfo || tEmployeeProject == null) {
return R.failed(EMPINFO_IS_NOT_EXITS_BYID);
}
......@@ -739,7 +742,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
insert.setContractTerm(String.valueOf(b));
}
// 核心保存
R<List<ErrorMessage>> info = this.setBaseInfo(insert);
R<List<ErrorMessage>> info = this.setBaseInfo(insert, project);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), info.getMsg()));
}
} else {
......
......@@ -861,15 +861,18 @@ public class DateUtil {
/**
* @param startDate
* @param endDate
* @Description: 计算年月的月份差值(202205-202205=0)想要1自己+1
* @Description: 计算年月的月份差值(202205-202205=0,202205-202105=12)想要1自己+1 年月差值
* @Author: hgw
* @Date: 2022/7/15 12:16
* @return: int
**/
public static int getMonthDiff(Date startDate, Date endDate) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(DATETIME_YYYYMM);
return Integer.parseInt(sdf.format(endDate)) - Integer.parseInt(sdf.format(startDate));
Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
c1.setTime(startDate);
c2.setTime(endDate);
return 12 * (c2.get(Calendar.YEAR) - c1.get(Calendar.YEAR)) + c2.get(Calendar.MONTH) - c1.get(Calendar.MONTH);
} catch (IllegalFormatException e) {
log.error("计算日期月份差,方法名:getMonthDiff,出错:",e);
return 0;
......
<?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>
<artifactId>yifu</artifactId>
<groupId>com.yifu.cloud.plus.v1</groupId>
<version>1.0.0</version>
</parent>
<artifactId>yifu-insurances</artifactId>
<packaging>pom</packaging>
<!--项目子模块-->
<modules>
<module>yifu-insurances-api</module>
<module>yifu-insurances-biz</module>
</modules>
</project>
\ No newline at end of file
<?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>
<artifactId>yifu</artifactId>
<groupId>com.yifu.cloud.plus.v1</groupId>
<version>1.0.0</version>
</parent>
<artifactId>yifu-insurances-api</artifactId>
<packaging>jar</packaging>
<description>yifu-insurances 接口模块</description>
<dependencies>
<!-- core 工具类 -->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-core</artifactId>
</dependency>
<!--swagger 注解-->
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<!--mybatis 依赖-->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-mybatis</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
FROM moxm/java:1.8-full
RUN mkdir -p /yifu-insurances-biz
WORKDIR yifu-insurances-biz
ARG JAR_FILE=target/yifu-insurances-biz.jar
COPY ${JAR_FILE} app.jar
EXPOSE 5002
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom"
CMD sleep 60; java -jar app.jar $JAVA_OPTS
#!/usr/bin/env bash
mvn clean package -Pprd -Dmaven.test.skip=true docker:build -DpushImage
\ No newline at end of file
#!/usr/bin/env bash
mvn clean package -Ptest -Dmaven.test.skip=true docker:build -DpushImage
\ No newline at end of file
#!/usr/bin/env bash
mvn clean package -Dmaven.test.skip=true docker:build -DpushImage
\ No newline at end of file
<?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>
<artifactId>yifu</artifactId>
<groupId>com.yifu.cloud.plus.v1</groupId>
<version>1.0.0</version>
</parent>
<artifactId>yifu-insurances-biz</artifactId>
<packaging>jar</packaging>
<description>yifu-insurances 业务模块</description>
<dependencies>
<!-- seata 依赖 -->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-seata</artifactId>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-insurances-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<!--选配: orm 模块-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!--必备:安全模块-->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-security</artifactId>
</dependency>
<!--必备:日志处理-->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-log</artifactId>
</dependency>
<!--必备:swagger-->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-swagger</artifactId>
</dependency>
<!--必备:undertow容器-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<version>5.8.0</version>
<artifactId>hutool-all</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<serverId>docker-hub</serverId>
<!--指定生成的镜像名-->
<imageName>${my.hub.host}/${map.group.name}/${project.artifactId}:${project.version}</imageName>
<dockerDirectory>${project.basedir}/</dockerDirectory>
<!--指定远程 docker api地址-->
<!--<dockerHost>http://172.16.66.232:2375</dockerHost>-->
<!-- 这里是复制 jar 包到 docker 容器指定目录配置-->
<resources>
<resource>
<targetPath>/</targetPath>
<!--jar 包所在的路径 此处配置的 即对应 target 目录-->
<directory>${project.build.directory}</directory>
<!-- 需要包含的 jar包 ,这里对应的是 Dockerfile中添加的文件名 -->
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<forceTags>true</forceTags>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.xlsx</exclude>
<exclude>**/*.xls</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.xlsx</include>
<include>**/*.xls</include>
</includes>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.insurances;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.EnableYifuResourceServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author licancan
* @description 项目启动类
* @date 2022-07-18 10:20:44
*/
@EnableYifuResourceServer
@SpringBootApplication
public class YifuInsurancesApplication {
public static void main(String[] args) {
SpringApplication.run(YifuInsurancesApplication.class, args);
}
}
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
config:
activate:
on-profile: dev
redis:
host: 127.0.0.1
port: 6379
password: '@yf_2017'
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: yf_zsk
url: jdbc:mysql://192.168.1.65:22306/mvp_insurances?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
config:
activate:
on-profile: test
redis:
host: 192.168.1.65
port: 22379
password: '@yf_2017'
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: yf_zsk
url: jdbc:mysql://192.168.1.65:22306/mvp_insurances?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
server:
port: 5005
# 加解密根密码
jasypt:
encryptor:
password: yifu #根密码
# 暴露监控端点
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
# mybaits-plus配置
mybatis-plus:
mapper-locations: classpath:/mapper/*Mapper.xml
global-config:
banner: false
db-config:
id-type: auto
table-underline: true
logic-delete-value: 1
logic-not-delete-value: 0
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# spring security 配置
security:
oauth2:
resource:
loadBalanced: true
token-info-uri: http://yifu-auth/oauth/check_token
ignore: # 通用放行URL,服务个性化,请在对应配置文件覆盖
urls:
- /v3/api-docs
- /actuator/**
- /swagger-ui/**
# 文件上传相关 支持阿里云、华为云、腾讯、minio
oss:
endpoint: http://oss-cn-beijing.aliyuncs.com
accessKey: LTAIDh9goA3jgpun
secretKey: eN8EHPAZxglNfcUCMhAT02cy93omLa
bucket-name: yf-hr-static-source
# swagger 配置
#swagger:
# enabled: true
# title: Yifu Swagger API
# gateway: http://${GATEWAY_HOST:yifu-gateway}:${GATEWAY-PORT:9999}
# token-url: ${swagger.gateway}/auth/oauth/token
# services:
# yifu-upms-biz: admin
# yifu-codegen: gen
# Spring 相关
spring:
application:
name: @artifactId@
#mvc:
# pathmatch:
# matching-strategy: ANT_PATH_MATCHER
servlet:
multipart:
#所有上传文件最大大小
max-request-size: 100MB
#单个文件最大大小
max-file-size: 50MB
#swagger 文档 https://springdoc.org/
### OpenAPI3 注解
# OpenAPI 3 注解位置
# @Tag(name = “接口类描述”) Controller 类上
# @Operation(summary =“接口方法描述”) Controller 方法上
# @Parameters Controller 方法上
# @Parameter(description=“参数描述”) Controller 方法上 @Parameters 里
# @Parameter(description=“参数描述”) Controller 方法的参数上
# @Parameter(hidden = true) 或 @Hidden --
# @Schema DTO类上
# @Schema DTO属性上
springdoc:
api-docs:
#是否开启文档功能
enabled: true
#swagger后端请求地址
path: /api-docs
swagger-ui:
#自定义swagger前端请求路径,输入http:127.0.0.1:8080/test会自动重定向到swagger页面
path: /api
#包扫描路径
packages-to-scan: com.yifu.cloud.plus.v1.yifu.insurances.controller
#这里定义了两个分组,可定义多个,也可以不定义
group-configs:
#分组名
#- group: admin
#按路径匹配
# pathsToMatch: /admin/**
#分组名
- group: insurances
#按包路径匹配
packagesToScan: com.yifu.cloud.plus.v1.yifu.insurances.controller
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
<property name="log.path" value="logs/${spring.application.name}"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
</root>
</configuration>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment