Commit 1b78ec24 authored by fangxinjiang's avatar fangxinjiang

项目档案新增字段“标签”

parent 3fc42607
......@@ -364,6 +364,13 @@ public class TEmployeeProject extends BaseEntity {
@TableField(exist = false)
private String changeStartMonth;
/**
* 标签
*/
@Schema(description ="标签")
@Size(max = 20, message = "标签不可超过20位")
private String empLabel;
/**
* 员工合同状态(字典)
* 0 无合同
......
......@@ -474,6 +474,14 @@ public class EmployeeProjectExportParamVO extends BaseEntity {
@ExcelProperty(value ="社保所在县")
private String socialTown;
/**
* 标签
*/
@ExcelAttribute(name = "标签",maxLength = 20)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value ="标签")
private String empLabel;
private String[] socialStatusArray;
private String[] fundStatusArray;
......
......@@ -479,7 +479,13 @@ public class EmployeeProjectExportVO {
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value ="社保所在市")
private String socialCity;
/**
* 标签
*/
@ExcelAttribute(name = "标签",maxLength = 20)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value ="标签")
private String empLabel;
/**
* 社保-县
*/
......
......@@ -23,10 +23,12 @@ import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
......@@ -142,4 +144,12 @@ public class EmployeeProjectUpdateVO extends RowIndex implements Serializable {
@ExcelProperty(value ="试用期")
private String tryPeriod;
/**
* 标签
*/
@ExcelAttribute(name = "标签",maxLength = 20)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value ="标签")
private String empLabel;
}
......@@ -23,10 +23,12 @@ import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
......@@ -141,5 +143,12 @@ public class EmployeeProjectVO extends RowIndex implements Serializable {
@ExcelProperty(value ="试用期")
@ExcelAttribute(name = "试用期",maxLength = 4)
private String tryPeriod;
/**
* 标签
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value ="标签")
@ExcelAttribute(name = "标签",maxLength = 20,errorInfo = "标签不超过20个字")
@Schema(description ="标签")
private String empLabel;
}
......@@ -23,7 +23,10 @@ import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
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;
import com.yifu.cloud.plus.v1.yifu.common.core.redis.RedisDistributedLock;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
......@@ -185,7 +188,29 @@ public class TEmployeeInfoController {
@PostMapping("/addNewEmployee")
//@PreAuthorize("@pms.hasPermission('temployeeinfo_add')")
public R<String> addNewEmployee(@Valid @RequestBody TEmployeeInfo tEmployeeInfo) {
return tEmployeeInfoService.addNewEmployee(tEmployeeInfo);
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
// 获取redis分布式事务锁
String key = CacheConstants.EMP_ADD_LOCK + CommonConstants.DOWN_LINE_STRING + user.getId();
String requestId;
try {
requestId = RedisDistributedLock.getLock(key,"10");
} catch (Exception e) {
throw new RuntimeException(ResultConstants.NO_GETLOCK_DATA+CommonConstants.DOWN_LINE_STRING+e.getMessage());
}
try {
if (Common.isNotNull(requestId)) {
return tEmployeeInfoService.addNewEmployee(tEmployeeInfo);
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
}
/**
......
......@@ -791,7 +791,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//根据身份证获取人员档案
tEmployeeInfo= tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL).last(CommonConstants.LAST_ONE_SQL));
//根据身份证和项目编码获取项目档案
tEmployeeProject = baseMapper.selectOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard())
......
......@@ -6,15 +6,15 @@ spring:
activate:
on-profile: prd
redis:
host: 192.168.0.153
port: 22379
password: '@yf_2022'
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.0.222:22306/mvp_archives?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://119.96.147.6:22306/mvp_archives?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
hikari:
driver-class-name: ${spring.datasource.driver-class-name}
jdbc-url: ${spring.datasource.url}
......
......@@ -56,6 +56,7 @@
<result property="socialStatus" column="SOCIAL_STATUS"/>
<result property="fundStatus" column="FUND_STATUS"/>
<result property="contractStatus" column="CONTRACT_STATUS"/>
<result property="empLabel" column="EMP_LABEL"/>
</resultMap>
<resultMap id="tEmployeeProjectExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO">
......@@ -115,6 +116,7 @@
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="contractStatus" column="CONTRACT_STATUS"/>
<result property="empLabel" column="EMP_LABEL"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -168,7 +170,8 @@
a.SOCIAL_PROVINCE,
a.SOCIAL_CITY,
a.SOCIAL_TOWN,
a.SALARY_STATUS
a.SALARY_STATUS,
a.EMP_LABEL
</sql>
<sql id="Base_Export_List">
......@@ -231,7 +234,8 @@
a.CREATE_NAME,
a.CREATE_TIME,
b.EMP_EMAIL,
b.EMP_NATRUE AS PROEMP_NATRUE
b.EMP_NATRUE AS PROEMP_NATRUE,
a.EMP_LABEL
</sql>
<sql id="tEmployeeProject_where">
......@@ -421,6 +425,9 @@
#{idStr}
</foreach>
</if>
<if test="tEmployeeProject.empLabel != null">
AND a.EMP_LABEL = #{tEmployeeProject.empLabel}
</if>
</if>
</sql>
......@@ -581,12 +588,22 @@
#{idStr}
</foreach>
</if>
<if test="tEmployeeProject.empLabel != null">
AND a.EMP_LABEL = #{tEmployeeProject.empLabel}
</if>
</if>
</sql>
<update id="updateExcelEmpProject" parameterType="java.util.List">
update t_employee_project
<trim prefix="set" suffixOverrides=",">
<trim prefix="EMP_LABEL =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empLabel!=null">
when ID=#{i.id} then #{i.empLabel}
</if>
</foreach>
</trim>
<trim prefix="EMP_NATRUE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empNatrue!=null">
......@@ -692,7 +709,7 @@
(ID,EMP_ID,EMP_NATRUE,EMP_NAME,EMP_IDCARD,STATUS,PROJECT_STATUS,EMP_CODE,DEPT_NO,CONTRACT_TYPE,POST,
DEPT_ID,DEPT_NAME,UNIT_ID,UNIT_NAME,UNIT_NO,EMP_NO,TRY_PERIOD,ENJOIN_DATE,BANK_NAME,BANK_NO,BANK_SUB_NAME,
BUSINESS_PRIMARY_TYPE,BUSINESS_SECOND_TYPE,BUSINESS_THIRD_TYPE,WORKING_HOURS,PROJECT_SOURCE,DELETE_FLAG,
CREATE_BY,CREATE_NAME,CREATE_TIME,INSURANCE_STATUS,SOCIAL_STATUS,FUND_STATUS)
CREATE_BY,CREATE_NAME,CREATE_TIME,INSURANCE_STATUS,SOCIAL_STATUS,FUND_STATUS,EMP_LABEL)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
......@@ -729,13 +746,19 @@
now(),
0,
0,
0
0,
#{item.empLabel,jdbcType=VARCHAR}
)
</foreach>
</insert>
<update id="updateReduceEmpProject" parameterType="java.util.List">
update t_employee_project
<trim prefix="set" suffixOverrides=",">
<trim prefix="EMP_LABEL =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then #{i.empLabel}
</foreach>
</trim>
<trim prefix="LEAVE_TIME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then now()
......
......@@ -154,4 +154,7 @@ public interface CacheConstants {
//社保公积金派单
String PAYMENT_DISPATCH_BATCH_IMPORT = "payment_dispatch_batch_import";
String EMP_ADD_LOCK ="emp_add_lock";
}
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