Commit 8527ab5a authored by fangxinjiang's avatar fangxinjiang

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

# Conflicts:
#	yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeProjectServiceImpl.java
parents 14318d30 ab8dbb4b
......@@ -381,4 +381,12 @@ public class TEmployeeInfo extends BaseEntity {
@Schema(description = "导出的表头的Set")
private Set<String> exportFields;
@Schema(description = "减档时间起")
@TableField(exist = false)
private String leaveTimeStart;
@Schema(description = "减档时间止")
@TableField(exist = false)
private String leaveTimeEnd;
}
......@@ -575,7 +575,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
jsonObject.put("value",fddContractTemplate.getType());
jsonObject.put("type","personnel_type");
R<String> res = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dict/inner/getLableFronValue", null, Map.class, SecurityConstants.FROM_IN);
, "/dict/inner/getLableFronValue", jsonObject, Map.class, SecurityConstants.FROM_IN);
if (res != null) {
//电子合同模板对应的“员工类型”
newEmployeeContractInfo.setContractName(res.getData());
......
......@@ -30,6 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TElecEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
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.FileVo;
......@@ -41,6 +42,7 @@ import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
......@@ -87,6 +89,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
* @date: 2022/6/27
*/
@Override
@Transactional
public R importZip(MultipartFile zipFile){
try {
String pathName = System.getProperty("java.io.tmpdir");
......@@ -168,7 +171,33 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
Enumeration<?> entries = zipFile.entries();
Map<String,String> insMap = new HashMap<>();
Map<String,String> map = new HashMap<>();
List<TElecEmployeeInfo> infolist = new ArrayList<>();
List<String> list = new ArrayList<>();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
//添加进filesName
String empInfo = entry.getName();
// 如果是文件夹,就创建个文件夹
if (!entry.isDirectory()) {
if (empInfo.length() > empInfo.lastIndexOf("/") + 1) {
String idCard = empInfo.substring(0, empInfo.indexOf("/"));
String dataType = empInfo.substring(empInfo.indexOf("/") + 1, empInfo.lastIndexOf("/"));
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, idCard)).eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.ZERO_STRING)
.eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT));
if (Common.isEmpty(tEmployeeInfo)) {
return R.failed("未找到身份证对应的档案信息,身份证号:" + idCard);
}
if (Common.isNotNull(elecTypeMap)) {
if (!Common.isNotNull(elecTypeMap.get(dataType))) {
return R.failed("资料类型错误:" + dataType);
}
}
}
}
}
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
//添加进filesName
......@@ -197,7 +226,6 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
}
TElecEmployeeInfo tElecEmployeeInfo = new TElecEmployeeInfo();
List<String> list = new ArrayList<>();
if (empInfo.length() > empInfo.lastIndexOf("/") + 1) {
String idCard = empInfo.substring(0,empInfo.indexOf("/"));
String dataType = empInfo.substring(empInfo.indexOf("/") +1,empInfo.lastIndexOf("/"));
......@@ -223,9 +251,11 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
String id = insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType);
//if (!elecTypeMap.get(dataType).equals(insMap.get(idCard))) {
if (Common.isEmpty(id)) {
infolist.add(tElecEmployeeInfo);
this.save(tElecEmployeeInfo);
insMap.put(idCard + CommonConstants.DOWN_LINE_STRING + dataType, tElecEmployeeInfo.getId());
}
list.add(insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType));
fileUploadService.uploadImg(fileCovertMultipartFile(targetFile),"", CommonConstants.EIGHT_INT,insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType));
}
......
......@@ -47,16 +47,16 @@ public class TEmployeeLogServiceImpl extends ServiceImpl<TEmployeeLogMapper, TEm
String differenceKey = HrEquator.comparisonValue(oldInfo, newInfo);
//如果有差异保存差异
if(!Common.isEmpty(differenceKey)){
TEmployeeLog record = new TEmployeeLog();
record.setProjectId(projectId);
record.setType(type);
record.setEmpId(empId);
record.setCreateTime(LocalDateTime.now());
record.setOldInfo(JSON.toJSONString(oldInfo,features));
record.setNewInfo(JSON.toJSONString(newInfo,features));
record.setDifferenceInfo(differenceKey);
baseMapper.insert(record);
return record;
TEmployeeLog employeeLog = new TEmployeeLog();
employeeLog.setProjectId(projectId);
employeeLog.setType(type);
employeeLog.setEmpId(empId);
employeeLog.setCreateTime(LocalDateTime.now());
employeeLog.setOldInfo(JSON.toJSONString(oldInfo,features));
employeeLog.setNewInfo(JSON.toJSONString(newInfo,features));
employeeLog.setDifferenceInfo(differenceKey);
baseMapper.insert(employeeLog);
return employeeLog;
}
}catch (Exception e){
log.error(JSON.toJSON(oldInfo)+"插入修改记录报错>>>",e);
......
......@@ -30,6 +30,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDictItem;
import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
......@@ -49,6 +50,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCheckProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
......@@ -77,7 +79,7 @@ import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@Log4j2
@EnableConfigurationProperties(DaprCheckProperties.class)
@EnableConfigurationProperties({DaprUpmsProperties.class, DaprCheckProperties.class})
public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMapper, TEmployeeProject> implements TEmployeeProjectService {
@Autowired
......@@ -99,6 +101,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Autowired
private DaprCheckProperties daprCheckProperties;
@Autowired
private DaprUpmsProperties daprUpmsProperties;
@Override
public R addCheck(TEmployeeProject tEmployeeProject) {
......@@ -520,13 +525,37 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
// 调用字典服务,渲染字典值
R<Map<String, Map<String, Map<String, String>>>> dictR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dict/inner/getDictToValue", null, Map.class, SecurityConstants.FROM_IN);
Map<String, Map<String, Map<String, String>>> dictDataMap;
Map<String, Map<String, String>> dictMap;
// 减项原因
Map<String, String> empReduceMap;
if (dictR == null || dictR.getData() == null) {
return R.failed("获取字典失败!");
} else {
dictDataMap = dictR.getData();
dictMap = dictDataMap.get("data");
if (dictMap == null) {
return R.failed("获取字典失败!!");
}
empReduceMap = dictMap.get("reduce_project_reason");
}
String leaveReason = "";
if (empReduceMap != null) {
leaveReason = empReduceMap.get(excel.getLeaveReason());
}
String errorMessage = "";
if (Common.isNotNull(excel.getEmpName())) {
errorMessage = errorMessage.concat(excel.getEmpName()).concat(";");
}else {
errorMessage = " ".concat(";");
}
errorMessage = errorMessage + excel.getEmpIdcard() + ";" + excel.getDeptNo() + ";" + excel.getLeaveReason() + ";";
errorMessage = errorMessage + excel.getEmpIdcard() + ";" + excel.getDeptNo() + ";" + leaveReason + ";";
if (Common.isNotNull(excel.getLeaveRemark())) {
errorMessage = errorMessage.concat(excel.getLeaveRemark()).concat(";");
}else {
......@@ -714,21 +743,23 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//档案有(在档人员),项目无
} else if (Common.isNotNull(tEmployeeInfo) && Common.isEmpty(tEmployeeProject)
&& CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()) {
TCheckBankNo check = new TCheckBankNo();
check.setBankNo(excel.getBankNo());
check.setIdNum(excel.getEmpIdcard());
check.setName(excel.getEmpName());
R<TCheckBankNo> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckbankno/inner/checkBankNo", check, TCheckBankNo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
check = checkListR.getData();
if (check == null || Common.isEmpty(check.getResult())) {
if (Common.isNotNull(excel.getBankNo())) {
TCheckBankNo check = new TCheckBankNo();
check.setBankNo(excel.getBankNo());
check.setIdNum(excel.getEmpIdcard());
check.setName(excel.getEmpName());
R<TCheckBankNo> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckbankno/inner/checkBankNo", check, TCheckBankNo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
check = checkListR.getData();
if (check == null || Common.isEmpty(check.getResult())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
} else if (check.getResult().equals(CommonConstants.ZERO_STRING)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), check.getMessage()));
}
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
} else if (check.getResult().equals(CommonConstants.ZERO_STRING)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), check.getMessage()));
}
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
}
updateExcelPost(excel, updateList, tEmployeeInfo);
insertExcelPro(excel, proInsList,tEmployeeInfo);
......@@ -749,21 +780,23 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//档案有(离职库),项目无;
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isEmpty(tEmployeeProject)) {
TCheckBankNo check = new TCheckBankNo();
check.setBankNo(excel.getBankNo());
check.setIdNum(excel.getEmpIdcard());
check.setName(excel.getEmpName());
R<TCheckBankNo> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckbankno/inner/checkBankNo", check, TCheckBankNo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
check = checkListR.getData();
if (check == null || Common.isEmpty(check.getResult())) {
if (Common.isNotNull(excel.getBankNo())) {
TCheckBankNo check = new TCheckBankNo();
check.setBankNo(excel.getBankNo());
check.setIdNum(excel.getEmpIdcard());
check.setName(excel.getEmpName());
R<TCheckBankNo> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckbankno/inner/checkBankNo", check, TCheckBankNo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
check = checkListR.getData();
if (check == null || Common.isEmpty(check.getResult())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
} else if (check.getResult().equals(CommonConstants.ZERO_STRING)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), check.getMessage()));
}
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
} else if (check.getResult().equals(CommonConstants.ZERO_STRING)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), check.getMessage()));
}
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
}
updateExcelPost(excel, updateList, tEmployeeInfo);
insertExcelPro(excel, proInsList, tEmployeeInfo);
......
......@@ -64,18 +64,6 @@
<if test="tElecEmployeeInfo.empIdcard != null and tElecEmployeeInfo.empIdcard.trim() != ''">
AND a.EMP_IDCARD = #{tElecEmployeeInfo.empIdcard}
</if>
<if test="tElecEmployeeInfo.unitName != null and tElecEmployeeInfo.unitName.trim() != ''">
AND c.UNIT_NAME like concat('%',#{tElecEmployeeInfo.unitName},'%')
</if>
<if test="tElecEmployeeInfo.deptName != null and tElecEmployeeInfo.deptName.trim() != ''">
AND c.DEPT_NAME like concat('%',#{tElecEmployeeInfo.deptName},'%')
</if>
<if test="tElecEmployeeInfo.empNo != null and tElecEmployeeInfo.empNo.trim() != ''">
AND c.EMP_NO = #{tElecEmployeeInfo.empNo}
</if>
<if test="tElecEmployeeInfo.deptNo != null and tElecEmployeeInfo.deptNo.trim() != ''">
AND c.DEPT_NO like concat('%',#{tElecEmployeeInfo.deptNo},'%')
</if>
<if test="tElecEmployeeInfo.dataType != null and tElecEmployeeInfo.dataType.trim() != ''">
AND a.DATA_TYPE = #{tElecEmployeeInfo.dataType}
</if>
......@@ -99,16 +87,29 @@
<!--tElecEmployeeInfo简单分页查询-->
<select id="getTElecEmployeeInfoPage" resultMap="tElecEmployeeInfoMap">
SELECT
<include refid="Base_Column_List"/>,GROUP_CONCAT(distinct c.DEPT_NAME) as DEPT_NAME,GROUP_CONCAT(distinct c.UNIT_NAME) as UNIT_NAME,GROUP_CONCAT(distinct c.DEPT_NO) as DEPT_NO,GROUP_CONCAT(distinct c.EMP_NO) as EMP_NO
FROM t_elec_employee_info a
left join t_employee_info b on a.EMP_IDCARD = b.EMP_IDCARD
left join t_employee_project c on a.EMP_IDCARD = c.EMP_IDCARD AND c.DELETE_FLAG = '0' AND c.PROJECT_STATUS = '0'
<where>
1=1 AND a.DELETE_FLAG = '0'
<include refid="tElecEmployeeInfo_where"/>
</where>
GROUP BY a.EMP_IDCARD,a.CREATE_TIME,a.DATA_TYPE
ORDER BY a.CREATE_TIME desc
SELECT * from (
SELECT
<include refid="Base_Column_List"/>,GROUP_CONCAT(distinct c.DEPT_NAME) as DEPT_NAME,GROUP_CONCAT(distinct c.UNIT_NAME) as UNIT_NAME,GROUP_CONCAT(distinct c.DEPT_NO) as DEPT_NO,GROUP_CONCAT(distinct c.EMP_NO) as EMP_NO
FROM t_elec_employee_info a
left join t_employee_info b on a.EMP_IDCARD = b.EMP_IDCARD
left join t_employee_project c on a.EMP_IDCARD = c.EMP_IDCARD AND c.DELETE_FLAG = '0' AND c.PROJECT_STATUS = '0'
WHERE a.DELETE_FLAG = '0'
<include refid="tElecEmployeeInfo_where"/>
GROUP BY a.EMP_IDCARD,a.CREATE_TIME,a.DATA_TYPE
ORDER BY a.CREATE_TIME desc
) b
where 1=1
<if test="tElecEmployeeInfo.unitName != null and tElecEmployeeInfo.unitName.trim() != ''">
AND b.UNIT_NAME like concat('%',#{tElecEmployeeInfo.unitName},'%')
</if>
<if test="tElecEmployeeInfo.deptName != null and tElecEmployeeInfo.deptName.trim() != ''">
AND b.DEPT_NAME like concat('%',#{tElecEmployeeInfo.deptName},'%')
</if>
<if test="tElecEmployeeInfo.deptNo != null and tElecEmployeeInfo.deptNo.trim() != ''">
AND b.DEPT_NO like concat('%',#{tElecEmployeeInfo.deptNo},'%')
</if>
<if test="tElecEmployeeInfo.empNo != null and tElecEmployeeInfo.empNo.trim() != ''">
AND b.EMP_NO like concat('%',#{tElecEmployeeInfo.empNo},'%')
</if>
</select>
</mapper>
......@@ -387,6 +387,12 @@
<if test="tEmployeeInfo.leaveTime != null">
AND a.LEAVE_TIME = #{tEmployeeInfo.leaveTime}
</if>
<if test="tEmployeeInfo.leaveTimeStart != null">
AND a.LEAVE_TIME >= #{tEmployeeInfo.leaveTimeStart}
</if>
<if test="tEmployeeInfo.leaveTimeEnd != null">
AND a.LEAVE_TIME <![CDATA[ <= ]]> #{tEmployeeInfo.leaveTimeEnd}
</if>
<if test="tEmployeeInfo.leaveReason != null and tEmployeeInfo.leaveReason.trim() != ''">
AND a.LEAVE_REASON = #{tEmployeeInfo.leaveReason}
</if>
......@@ -396,15 +402,6 @@
<if test="tEmployeeInfo.contactAddress != null and tEmployeeInfo.contactAddress.trim() != ''">
AND a.CONTACT_ADDRESS = #{tEmployeeInfo.contactAddress}
</if>
<if test="tEmployeeInfo.unitName != null and tEmployeeInfo.unitName.trim() != ''">
AND b.UNIT_NAME like concat('%',#{tEmployeeInfo.unitName},'%')
</if>
<if test="tEmployeeInfo.deptName != null and tEmployeeInfo.deptName.trim() != ''">
AND b.DEPT_NAME like concat('%',#{tEmployeeInfo.deptName},'%')
</if>
<if test="tEmployeeInfo.deptNo != null and tEmployeeInfo.deptNo.trim() != ''">
AND b.DEPT_NO = #{tEmployeeInfo.deptNo}
</if>
</if>
</if>
</sql>
......@@ -414,30 +411,41 @@
select
<include refid="baseParam"/>
from t_employee_info a
left join t_employee_project b on a.id = b.EMP_ID
where a.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
${sql}
group by a.id order by a.CREATE_TIME desc
order by a.CREATE_TIME desc
</select>
<!-- hgw 分页查询 -->
<select id="getLeavePage" resultMap="tEmployeeExportMap">
SELECT
a.ID,
<include refid="Base_Export_List"/>
,GROUP_CONCAT(DISTINCT b.unit_name) UNIT_NAME
,GROUP_CONCAT(DISTINCT b.unit_no) UNIT_NO
,a.LEAVE_TIME
,a.LEAVE_USER_NAME
,a.LEAVE_USER
,a.LEAVE_REASON
from t_employee_info a
left join t_employee_project b on a.id = b.EMP_ID
where a.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
${sql}
group by a.id order by a.CREATE_TIME desc
SELECT * from (
SELECT
a.ID,
<include refid="Base_Export_List"/>
,GROUP_CONCAT(DISTINCT b.unit_name) UNIT_NAME
,GROUP_CONCAT(DISTINCT b.unit_no) UNIT_NO
,a.LEAVE_TIME
,a.LEAVE_USER_NAME
,a.LEAVE_USER
,a.LEAVE_REASON
from t_employee_info a
left join t_employee_project b on a.id = b.EMP_ID
where a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
${sql}
group by a.id order by a.CREATE_TIME desc
) b
where 1=1
<if test="tEmployeeInfo.unitName != null and tEmployeeInfo.unitName.trim() != ''">
AND b.UNIT_NAME like concat('%',#{tEmployeeInfo.unitName},'%')
</if>
<if test="tEmployeeInfo.deptName != null and tEmployeeInfo.deptName.trim() != ''">
AND b.DEPT_NAME like concat('%',#{tEmployeeInfo.deptName},'%')
</if>
<if test="tEmployeeInfo.deptNo != null and tEmployeeInfo.deptNo.trim() != ''">
AND b.DEPT_NO like concat('%',#{tEmployeeInfo.deptNo},'%')
</if>
</select>
<!-- hgw list查询 -->
......@@ -445,10 +453,9 @@
select
<include refid="baseParam"/>
from t_employee_info a
left join t_employee_project b on a.id = b.EMP_ID
where a.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
group by a.id order by a.CREATE_TIME desc
order by a.CREATE_TIME desc
</select>
<!-- hgw 根据身份证查询 -->
......@@ -535,29 +542,41 @@
from t_employee_info a
left join t_employee_project b on a.id = b.EMP_ID
<where>
a.DELETE_FLAG = '0'
a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
</where>
GROUP BY a.id
GROUP BY a.id order by a.CREATE_TIME desc
</select>
<!--tEmployeeInfo离职档案导出查询-->
<select id="getTEmployeeLeaveExportList" resultMap="tEmployeeExportMap">
select * from (
SELECT
<include refid="Base_Export_List"/>
,GROUP_CONCAT(DISTINCT b.unit_name) UNIT_NAME
,GROUP_CONCAT(DISTINCT b.unit_no) UNIT_NO
,a.LEAVE_TIME
,a.LEAVE_USER
,a.LEAVE_USER_NAME
,a.LEAVE_REASON
<include refid="Base_Export_List"/>,GROUP_CONCAT(DISTINCT b.unit_name) UNIT_NAME
,
GROUP_CONCAT(DISTINCT b.unit_no) UNIT_NO
,a.LEAVE_TIME
,a.LEAVE_USER
,a.LEAVE_USER_NAME
,a.LEAVE_REASON
from t_employee_info a
left join t_employee_project b on a.id = b.EMP_ID
<where>
a.DELETE_FLAG = '0'
a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
</where>
GROUP BY a.id
GROUP BY a.id order by a.CREATE_TIME desc
) b
where 1=1
<if test="tEmployeeInfo.unitName != null and tEmployeeInfo.unitName.trim() != ''">
AND b.UNIT_NAME like concat('%',#{tEmployeeInfo.unitName},'%')
</if>
<if test="tEmployeeInfo.deptName != null and tEmployeeInfo.deptName.trim() != ''">
AND b.DEPT_NAME like concat('%',#{tEmployeeInfo.deptName},'%')
</if>
<if test="tEmployeeInfo.deptNo != null and tEmployeeInfo.deptNo.trim() != ''">
AND b.DEPT_NO like concat('%',#{tEmployeeInfo.deptNo},'%')
</if>
</select>
<!-- 获取当日最大的编码 -->
......
dapr.upms.appUrl=http://yifu-upms.qas-mvp.svc.cluster.local:3500/v1.0/invoke/
dapr.upms.appUrl=http://localhost:3500/v1.0/invoke/
dapr.upms.appId=yifu-upms
dapr.upms.appPort=4000
dapr.upms.httpPort=3500
......
......@@ -18,6 +18,7 @@ package com.yifu.cloud.plus.v1.yifu.social.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
......@@ -28,6 +29,7 @@ import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 社保、公积金基数配置
......@@ -450,4 +452,8 @@ public class SysBaseSetInfo extends BaseEntity {
@ExcelProperty("社保户名称")
private String departName;
@Schema(description = "公积金比例List(保存时前端传参用)")
@TableField(exist = false)
private List<SysPayProportion> fundProList;
}
......@@ -20,17 +20,16 @@ package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysPayProportion;
import com.yifu.cloud.plus.v1.yifu.social.service.SysBaseSetInfoService;
import com.yifu.cloud.plus.v1.yifu.social.service.SysPayProportionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
......@@ -50,6 +49,7 @@ import java.util.List;
public class SysBaseSetInfoController {
private final SysBaseSetInfoService sysBaseSetInfoService;
private final SysPayProportionService sysPayProportionService;
/**
......@@ -73,7 +73,6 @@ public class SysBaseSetInfoController {
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
//@PreAuthorize("@pms.hasPermission('social_sysbasesetinfo_get')" )
public R<List<SysBaseSetInfo>> getSysBaseSetInfoNoPage(@RequestBody SysBaseSetInfo sysBaseSetInfo) {
return R.ok(sysBaseSetInfoService.list(Wrappers.query(sysBaseSetInfo).orderByDesc(CommonConstants.CREATE_TIME)));
}
......@@ -84,11 +83,14 @@ public class SysBaseSetInfoController {
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('social_sysbasesetinfo_get')")
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('social_sysbasesetinfo_get')")
public R<SysBaseSetInfo> getById(@PathVariable("id") String id) {
return R.ok(sysBaseSetInfoService.getById(id));
SysBaseSetInfo baseSetInfo = sysBaseSetInfoService.getById(id);
if (null != baseSetInfo && CommonConstants.ONE_STRING.equals(baseSetInfo.getBaseType())){
baseSetInfo.setFundProList(sysPayProportionService.list(Wrappers.<SysPayProportion>query().lambda().eq(SysPayProportion::getSysBaseSetId,id)));
}
return R.ok(baseSetInfo);
}
/**
......@@ -133,4 +135,22 @@ public class SysBaseSetInfoController {
return R.ok(sysBaseSetInfoService.removeById(id));
}
/**
* 通过id禁用启用一条记录
* @param id
* @return R
*/
@Operation(summary = "启用禁用", description = "启用禁用:hasPermission('social_sysbasesetinfo_enable') 0.在用 1.终止 2.过期")
@SysLog("禁用启用基数设置表")
@PostMapping("/disableOrEnableById")
@PreAuthorize("@pms.hasPermission('wxhr:social_sysbasesetinfo_enable')")
public R disableOrEnableById(@RequestParam String id, @RequestParam Integer status) {
SysBaseSetInfo baseSetInfo = sysBaseSetInfoService.getById(id);
if (null == baseSetInfo){
return R.failed("无对应ID的数据!");
}
baseSetInfo.setStatus(status);
return new R<>(sysBaseSetInfoService.updateById(baseSetInfo));
}
}
......@@ -22,14 +22,15 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialLog;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
......@@ -63,71 +64,16 @@ public class TSocialLogController {
}
/**
* 不分页查询
*
* @param tSocialLog 社保变更记录表
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
//@PreAuthorize("@pms.hasPermission('social_tsociallog_get')" )
public R<List<TSocialLog>> getTSocialLogNoPage(@RequestBody TSocialLog tSocialLog) {
return R.ok(tSocialLogService.list(Wrappers.query(tSocialLog).orderByDesc(CommonConstants.CREATE_TIME)));
}
/**
* 通过id查询社保变更记录表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('social_tsociallog_get')")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('social_tsociallog_get')")
public R<TSocialLog> getById(@PathVariable("id") String id) {
return R.ok(tSocialLogService.getById(id));
}
/**
* 新增社保变更记录表
*
* @param tSocialLog 社保变更记录表
* @return R
*/
@Operation(summary = "新增社保变更记录表", description = "新增社保变更记录表:hasPermission('social_tsociallog_add')")
@SysLog("新增社保变更记录表")
@PostMapping
@PreAuthorize("@pms.hasPermission('social_tsociallog_add')")
public R<Boolean> save(@RequestBody TSocialLog tSocialLog) {
return R.ok(tSocialLogService.save(tSocialLog));
}
/**
* 修改社保变更记录表
*
* @param tSocialLog 社保变更记录表
* @return R
*/
@Operation(summary = "修改社保变更记录表", description = "修改社保变更记录表:hasPermission('social_tsociallog_edit')")
@SysLog("修改社保变更记录表")
@PutMapping
@PreAuthorize("@pms.hasPermission('social_tsociallog_edit')")
public R<Boolean> updateById(@RequestBody TSocialLog tSocialLog) {
return R.ok(tSocialLogService.updateById(tSocialLog));
}
/**
* 通过id删除社保变更记录表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id删除社保变更记录表", description = "通过id删除社保变更记录表:hasPermission('social_tsociallog_del')")
@SysLog("通过id删除社保变更记录表")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('social_tsociallog_del')")
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tSocialLogService.removeById(id));
* @Description: 通过EMP_ID查询人员档案变更日志
* @Author: hgw
* @Date: 2022/6/28 16:45
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog>>
**/
@Operation(summary = "通过mainId、type查询社保变更日志(type类型:1社保基数配置;2公积金基数配置;后续再追加)", description = "通过mainId查询社保变更日志")
@GetMapping("/getByEmpId")
public R<List<TSocialLog>> getByEmpId(@RequestParam String mainId, @RequestParam Integer type) {
return R.ok(tSocialLogService.list(Wrappers.<TSocialLog>query().eq("MAIN_ID", mainId)
.eq("TYPE", type).orderByDesc(CommonConstants.CREATE_TIME)));
}
}
......@@ -17,19 +17,25 @@
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
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;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysPayProportion;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.SysBaseSetInfoService;
import com.yifu.cloud.plus.v1.yifu.social.service.SysPayProportionService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 基数设置表
*
......@@ -41,6 +47,9 @@ import org.springframework.stereotype.Service;
public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, SysBaseSetInfo> implements SysBaseSetInfoService {
private final TSocialLogService tSocialLogService;
private final SysPayProportionService sysPayProportionService;
/**
* 基数设置表简单分页查询
*
......@@ -54,21 +63,129 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
@Override
public R<String> saveSysBase(SysBaseSetInfo sysBaseSetInfo) {
YifuUser user = SecurityUtils.getUser();
if (null == user) {
return R.failed("获取用户登录信息失败!");
}
SysBaseSetInfo baseSetInfo = null;
if (null != sysBaseSetInfo.getTown()) {
baseSetInfo = this.getOne(Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getBaseType, sysBaseSetInfo.getBaseType())
.eq(SysBaseSetInfo::getDepartId, sysBaseSetInfo.getDepartId())
.eq(SysBaseSetInfo::getTown, sysBaseSetInfo.getTown())
.le(SysBaseSetInfo::getApplyStartDate, sysBaseSetInfo.getApplyStartDate())
.ge(SysBaseSetInfo::getApplyEndDate, sysBaseSetInfo.getApplyStartDate())
.last(CommonConstants.LAST_ONE_SQL));
}
if (null != sysBaseSetInfo.getCity() && null == sysBaseSetInfo.getTown()) {
baseSetInfo = this.getOne(Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getBaseType, sysBaseSetInfo.getBaseType())
.eq(SysBaseSetInfo::getDepartId, sysBaseSetInfo.getDepartId())
.eq(SysBaseSetInfo::getCity, sysBaseSetInfo.getCity())
.isNull(SysBaseSetInfo::getTown)
.le(SysBaseSetInfo::getApplyStartDate, sysBaseSetInfo.getApplyStartDate())
.ge(SysBaseSetInfo::getApplyEndDate, sysBaseSetInfo.getApplyStartDate())
.last(CommonConstants.LAST_ONE_SQL));
}
if (null != sysBaseSetInfo.getProvince() && null == sysBaseSetInfo.getCity()) {
baseSetInfo = this.getOne(Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getBaseType, sysBaseSetInfo.getBaseType())
.eq(SysBaseSetInfo::getDepartId, sysBaseSetInfo.getDepartId())
.eq(SysBaseSetInfo::getProvince, sysBaseSetInfo.getProvince())
.isNull(SysBaseSetInfo::getCity)
.le(SysBaseSetInfo::getApplyStartDate, sysBaseSetInfo.getApplyStartDate())
.ge(SysBaseSetInfo::getApplyEndDate, sysBaseSetInfo.getApplyStartDate())
.last(CommonConstants.LAST_ONE_SQL));
}
if (null != baseSetInfo) {
return R.failed("对应户、地市、有效期的基数配置已存在!");
}
this.save(sysBaseSetInfo);
this.saveOrUpdateBaseAndFundPro(sysBaseSetInfo);
return R.ok();
}
@Override
public R<String> updateSysBase(SysBaseSetInfo sysBaseSetInfo) {
YifuUser user = SecurityUtils.getUser();
if (null == user) {
return R.failed("获取用户登录信息失败!");
}
SysBaseSetInfo old = this.getById(sysBaseSetInfo.getId());
if (old == null || Common.isEmpty(old.getId())) {
return R.failed("根据id未找到基数配置!" + sysBaseSetInfo.getId());
}
this.updateById(sysBaseSetInfo);
SysBaseSetInfo baseSetInfo = null;
if (null != sysBaseSetInfo.getTown()) {
baseSetInfo = this.getOne(Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getBaseType, sysBaseSetInfo.getBaseType())
.eq(SysBaseSetInfo::getDepartId, sysBaseSetInfo.getDepartId())
.eq(SysBaseSetInfo::getTown, sysBaseSetInfo.getTown())
.le(SysBaseSetInfo::getApplyStartDate, sysBaseSetInfo.getApplyStartDate())
.ge(SysBaseSetInfo::getApplyEndDate, sysBaseSetInfo.getApplyStartDate())
.ne(SysBaseSetInfo::getId, sysBaseSetInfo.getId())
.eq(SysBaseSetInfo::getStatus, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
}
if (null != sysBaseSetInfo.getCity() && null == sysBaseSetInfo.getTown()) {
baseSetInfo = this.getOne(Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getBaseType, sysBaseSetInfo.getBaseType())
.eq(SysBaseSetInfo::getDepartId, sysBaseSetInfo.getDepartId())
.eq(SysBaseSetInfo::getCity, sysBaseSetInfo.getCity())
.isNull(SysBaseSetInfo::getTown)
.le(SysBaseSetInfo::getApplyStartDate, sysBaseSetInfo.getApplyStartDate())
.ge(SysBaseSetInfo::getApplyEndDate, sysBaseSetInfo.getApplyStartDate())
.ne(SysBaseSetInfo::getId, sysBaseSetInfo.getId())
.eq(SysBaseSetInfo::getStatus, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
}
if (null != sysBaseSetInfo.getProvince() && null == sysBaseSetInfo.getCity()) {
baseSetInfo = this.getOne(Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getBaseType, sysBaseSetInfo.getBaseType())
.eq(SysBaseSetInfo::getDepartId, sysBaseSetInfo.getDepartId())
.eq(SysBaseSetInfo::getProvince, sysBaseSetInfo.getProvince())
.isNull(SysBaseSetInfo::getCity)
.le(SysBaseSetInfo::getApplyStartDate, sysBaseSetInfo.getApplyStartDate())
.ge(SysBaseSetInfo::getApplyEndDate, sysBaseSetInfo.getApplyStartDate())
.ne(SysBaseSetInfo::getId, sysBaseSetInfo.getId())
.eq(SysBaseSetInfo::getStatus, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
}
if (null != baseSetInfo) {
return R.failed("对应户、地市、有效期的基数配置已存在!");
}
this.saveOrUpdateBaseAndFundPro(sysBaseSetInfo);
// 记录变更日志
tSocialLogService.saveModificationRecord(CommonConstants.ONE_INT, old.getId(), old, sysBaseSetInfo);
return R.ok();
}
/**
* @param sysBaseSetInfo
* @Description: 新增、编辑社保、公积金基数
* @Author: hgw
* @Date: 2022/7/12 14:33
* @return: void
**/
private void saveOrUpdateBaseAndFundPro(SysBaseSetInfo sysBaseSetInfo) {
if (Common.isNotNull(sysBaseSetInfo.getId())) {
baseMapper.updateById(sysBaseSetInfo);
} else {
sysBaseSetInfo.setStatus(CommonConstants.ZERO_INT);
sysBaseSetInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
baseMapper.insert(sysBaseSetInfo);
}
List<SysPayProportion> payProportionList = sysBaseSetInfo.getFundProList();
if (Common.isNotNull(payProportionList)) {
for (SysPayProportion payProportion : payProportionList) {
if (Common.isNotNull(payProportion.getId())) {
sysPayProportionService.updateById(payProportion);
} else {
payProportion.setSysBaseSetId(sysBaseSetInfo.getId());
sysPayProportionService.save(payProportion);
}
}
}
}
}
......@@ -67,15 +67,15 @@ public class TSocialLogServiceImpl extends ServiceImpl<TSocialLogMapper, TSocial
String differenceKey = HrEquator.comparisonValue(oldInfo, newInfo);
//如果有差异保存差异
if (!Common.isEmpty(differenceKey)) {
TSocialLog record = new TSocialLog();
record.setType(type);
record.setMainId(mainId);
record.setCreateTime(LocalDateTime.now());
record.setOldInfo(JSON.toJSONString(oldInfo, features));
record.setNewInfo(JSON.toJSONString(newInfo, features));
record.setDifferenceInfo(differenceKey);
baseMapper.insert(record);
return record;
TSocialLog socialLog = new TSocialLog();
socialLog.setType(type);
socialLog.setMainId(mainId);
socialLog.setCreateTime(LocalDateTime.now());
socialLog.setOldInfo(JSON.toJSONString(oldInfo, features));
socialLog.setNewInfo(JSON.toJSONString(newInfo, features));
socialLog.setDifferenceInfo(differenceKey);
baseMapper.insert(socialLog);
return socialLog;
}
} catch (Exception e) {
log.error(JSON.toJSON(oldInfo) + "【新增社保变更记录】报错>>>", e);
......
......@@ -318,7 +318,7 @@ public class DictController {
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.String, java.util.Map < java.lang.String, java.lang.String>>>
**/
@Inner
@GetMapping("/inner/getDictToValue")
@PostMapping("/inner/getDictToValue")
public R<Map<String, Map<String, String>>> getDictToValue() {
return sysDictItemService.getDictToValue();
}
......
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