Commit 50ebd1a9 authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent bfc226d9
......@@ -51,14 +51,13 @@ public class FddSealInfoController {
/**
* 分页查询
* @param page 分页对象
* @param fddSealInfo 法大大印章
* @return
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page" )
public R getFddSealInfoPage(Page page, FddSealInfo fddSealInfo) {
return R.ok(fddSealInfoService.getFddSealInfoPage(page, fddSealInfo));
public R<List<FddSealInfo>> getFddSealInfoPage(FddSealInfo fddSealInfo) {
return R.ok(fddSealInfoService.getFddSealInfoPage(fddSealInfo));
}
/**
......
......@@ -18,12 +18,12 @@
package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddSealInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 法大大印章
*
......@@ -38,6 +38,6 @@ public interface FddSealInfoMapper extends BaseMapper<FddSealInfo> {
* @param fddSealInfo 法大大印章
* @return
*/
IPage<FddSealInfo> getFddSealInfoPage(Page<FddSealInfo> page, @Param("fddSealInfo") FddSealInfo fddSealInfo);
List<FddSealInfo> getFddSealInfoPage(@Param("fddSealInfo") FddSealInfo fddSealInfo);
}
......@@ -40,7 +40,7 @@ public interface FddSealInfoService extends IService<FddSealInfo> {
* @param fddSealInfo 法大大印章
* @return
*/
IPage<FddSealInfo> getFddSealInfoPage(Page<FddSealInfo> page, FddSealInfo fddSealInfo);
List<FddSealInfo> getFddSealInfoPage(FddSealInfo fddSealInfo);
/**
* 印章授权
......
......@@ -27,12 +27,11 @@ import com.yifu.cloud.plus.v1.yifu.archives.mapper.FddContractAttachInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.util.IdCardUtil;
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.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.NoUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import lombok.RequiredArgsConstructor;
......@@ -42,11 +41,16 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
......@@ -73,6 +77,9 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
@Autowired
private TEmployeeInfoMapper tEmployeeInfoMapper;
@Autowired
private TEmployeeProjectMapper tEmployeeProjectMapper;
@Autowired
private TEmployeeContractInfoService employeeContractInfoService;
......@@ -97,6 +104,10 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
@Autowired
private TEmployeeLogService tEmployeeLogService;
// 缓存信息
@Autowired
private CacheManager cacheManager;
ExecutorService executorService = Executors.newFixedThreadPool(10);
public static final String NO_VALID_CONTRACT_FOUND = "未获取到有效在用合同,请确认存在对应姓名、身份证、合同起始时间的合同数据";
......@@ -274,40 +285,57 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0],tEmployeeProject.getId(),"",employeeInfoCompare,tEmployeeInfo);
} else {
//新增人员档案
TEmployeeInfo newEmployeeInfo = new TEmployeeInfo();
newEmployeeInfo.setEmpName(fddContractAttachInfo.getEmpName());
newEmployeeInfo.setEmpIdcard(fddContractAttachInfo.getEmpIdcard());
newEmployeeInfo.setEmpPhone(fddContractAttachInfo.getEmpPhone());
newEmployeeInfo.setEmpNatrue(fddContractTemplate.getType());
newEmployeeInfo.setEmpCode(getCode());
newEmployeeInfo.setFileStatus(CommonConstants.ZERO_INT);
newEmployeeInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
newEmployeeInfo.setStatus(CommonConstants.ZERO_INT);
newEmployeeInfo.setProjectNum(CommonConstants.ONE_INT);
newEmployeeInfo.setFileSource(CommonConstants.dingleDigitStrArray[4]);
Date date = IdCardUtil.getBirthdate(fddContractAttachInfo.getEmpIdcard());
if (null != date) {
//初始化年龄
newEmployeeInfo.setEmpAge(IdCardUtil.IdNOToAge(fddContractAttachInfo.getEmpIdcard()));
newEmployeeInfo.setEmpBirthday(date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
}
newEmployeeInfo.setEmpSex(IdCardUtil.getSex(fddContractAttachInfo.getEmpIdcard()));
tEmployeeInfoMapper.insert(newEmployeeInfo);
//新增项目档案
TEmployeeProject newTEmpProject = new TEmployeeProject();
newTEmpProject.setEmpName(fddContractAttachInfo.getEmpName());
newTEmpProject.setEmpIdcard(fddContractAttachInfo.getEmpIdcard());
newTEmpProject.setEmpPhone(fddContractAttachInfo.getEmpPhone());
newTEmpProject.setDeptId(settleDomain.getId());
newTEmpProject.setDeptNo(settleDomain.getDepartNo());
newTEmpProject.setDeptName(settleDomain.getDepartName());
newTEmpProject.setPost(fddContractAttachInfo.getPost());
newTEmpProject.setUnitId(tCustomerInfo.getId());
newTEmpProject.setUnitName(tCustomerInfo.getCustomerName());
newTEmpProject.setUnitNo(tCustomerInfo.getCustomerCode());
newTEmpProject.setContractType(fddContractTemplate.getType());
newTEmpProject.setDeleteFlag(CommonConstants.STATUS_NORMAL);
newTEmpProject.setStatus(CommonConstants.dingleDigitIntArray[0]);
newTEmpProject.setPost(fddContractAttachInfo.getPost());
newTEmpProject.setEmpNatrue(newEmployeeInfo.getEmpNatrue());
newTEmpProject.setEmpCode(newEmployeeInfo.getEmpCode());
String empNO = getEmpNo(tEmployeeProject.getDeptNo());
newTEmpProject.setEmpNo(empNO);
//新增档案
tEmployeeProjectMapper.insert(newTEmpProject);
//新增合同
TEmployeeContractInfo newEmployeeContractInfo1 = new TEmployeeContractInfo();
saveTEmployeeContractInfo(newEmployeeContractInfo1, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo,tCustomerInfo,newTEmpProject);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo1);
}
//新增项目档案
TEmployeeProject newTEmpProject = new TEmployeeProject();
// newTEmployeeInfo.setEmpName(fddContractAttachInfo.getEmpName());
// newTEmployeeInfo.setEmpIdcard(fddContractAttachInfo.getEmpIdcard());
// newTEmployeeInfo.setEmpPhone(fddContractAttachInfo.getEmpPhone());
// newTEmployeeInfo.setEmpType(fddContractTemplate.getType());
// newTEmployeeInfo.setSettleDomain(settleDomain.getId());
// newTEmployeeInfo.setPost(fddContractAttachInfo.getPost());
// newTEmployeeInfo.setBelongUnit(tCustomerInfo.getId());
// newTEmployeeInfo.setBelongUnitName(tCustomerInfo.getCustomerName());
// newTEmployeeInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
// newTEmployeeInfo.setWorkFlag(CommonConstants.ZERO_STRING);
// newTEmployeeInfo.setLockFlag(CommonConstants.ONE_STRING);
// newTEmployeeInfo.setWorkingStatusSub(CommonConstants.ZERO_STRING);
// newTEmployeeInfo.setContractFileStatus(CommonConstants.ZERO_STRING);
// Date date = IdCardUtil.getBirthdate(fddContractAttachInfo.getEmpIdcard());
//
// newTEmployeeInfo.setEmpNo(str);
//
// if (null != date) {
// //初始化年龄
// newTEmployeeInfo.setEmpAge(IdCardUtil.IdNOToAge(fddContractAttachInfo.getEmpIdcard()));
// newTEmployeeInfo.setEmpBirthday(date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
// }
// newTEmployeeInfo.setEmpSex(IdCardUtil.getSex(fddContractAttachInfo.getEmpIdcard()));
// //新增档案
// tEmployeeInfoMapper.insert(newTEmployeeInfo);
//新增合同
TEmployeeContractInfo newEmployeeContractInfo1 = new TEmployeeContractInfo();
saveTEmployeeContractInfo(newEmployeeContractInfo1, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo,tCustomerInfo,newTEmpProject);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo1);
}
}
}catch (Exception e) {
......@@ -571,4 +599,34 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
return str;
}
//获取员工主码
private synchronized String getCode() {
String nowDay = DateUtil.getThisDay();
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_EMP_CODE);
Object nowNumObj = cache.get(nowDay);
int nowNums = 1;
if (Common.isNotNull(nowNumObj)) {
SimpleValueWrapper value = (SimpleValueWrapper) nowNumObj;
nowNums = (Integer) value.get() + 1;
}
cache.put(nowDay, nowNums);
return "ZM" + nowDay + this.getFiveNum(String.valueOf(nowNums));
}
/**
* @param nowNums 数字
* @Description: 获取五位字符型数字
* @Author: hgw
* @Date: 2022/6/21 17:35
* @return: 五位字符型数字
**/
private String getFiveNum(String nowNums) {
if (nowNums.length() >= 5) {
return nowNums.substring(0, 5);
}
String[] zeroArr = {"0", "00", "000", "0000"};
int num = 4 - nowNums.length();
return zeroArr[num] + nowNums;
}
}
......@@ -68,7 +68,7 @@ public class FddSealInfoServiceImpl extends ServiceImpl<FddSealInfoMapper, FddSe
private final FddReqLogService reqLogService;
@Override
public IPage<FddSealInfo> getFddSealInfoPage(Page<FddSealInfo> page, FddSealInfo fddSealInfo) {
public List<FddSealInfo> getFddSealInfoPage(FddSealInfo fddSealInfo) {
long count = this.count(Wrappers.<FddSealInfo>query().lambda().eq(FddSealInfo::getStatus,CommonConstants.TWO_STRING));
if (count == CommonConstants.ZERO_INT) {
//初始化印章
......@@ -120,7 +120,7 @@ public class FddSealInfoServiceImpl extends ServiceImpl<FddSealInfoMapper, FddSe
}
}
}
return baseMapper.getFddSealInfoPage(page, fddSealInfo);
return baseMapper.getFddSealInfoPage(fddSealInfo);
}
@Override
......
......@@ -83,9 +83,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
private final TCustomerInfoMapper tCustomerInfoMapper;
// 缓存信息
private final CacheManager cacheManager;
@Override
public R addCheck(TEmployeeProject tEmployeeProject) {
......@@ -590,42 +587,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
proInsList.add(insTEmployeePro);
}
/**
* @param
* @Description: 获取员工主码
* @Author: hgw
* @Date: 2022/6/22 17:52
* @return: java.lang.String
**/
private synchronized String getCode() {
String nowDay = DateUtil.getThisDay();
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_EMP_CODE);
Object nowNumObj = cache.get(nowDay);
int nowNums = 1;
if (Common.isNotNull(nowNumObj)) {
SimpleValueWrapper value = (SimpleValueWrapper) nowNumObj;
nowNums = (Integer) value.get() + 1;
}
cache.put(nowDay, nowNums);
return "ZM" + nowDay + this.getFiveNum(String.valueOf(nowNums));
}
/**
* @param nowNums 数字
* @Description: 获取五位字符型数字
* @Author: hgw
* @Date: 2022/6/21 17:35
* @return: 五位字符型数字
**/
private String getFiveNum(String nowNums) {
if (nowNums.length() >= 5) {
return nowNums.substring(0, 5);
}
String[] zeroArr = {"0", "00", "000", "0000"};
int num = 4 - nowNums.length();
return zeroArr[num] + nowNums;
}
@Override
public R<List<ErrorMessage>> batchRemoveByIds(String ids) {
List<ErrorMessage> errorList = new ArrayList<ErrorMessage>();
......
......@@ -658,10 +658,18 @@
<update id="updateEmpIdById" parameterType="java.util.List">
update t_employee_project
SET EMP_ID = #{i.id}
<trim prefix="set" suffixOverrides=",">
<trim prefix="EMP_ID =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.id!=null">
when EMP_IDCARD=#{i.empIdcard} then #{i.id}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
EMP_IDCARD=#{i.empIdcard} AND DEPT_NO =#{i.deptNo}
EMP_IDCARD=#{i.empIdcard}
</foreach>
</update>
......
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