Commit 15eebdbe authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent c036e161
...@@ -19,23 +19,15 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller; ...@@ -19,23 +19,15 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.plugins.pagination.Page;
import com.pig4cloud.plugin.excel.annotation.RequestExcel; import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel; import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import com.pig4cloud.plugin.excel.vo.ErrorMessage; import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TCustomerInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; 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.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
...@@ -46,9 +38,7 @@ import org.springframework.validation.BindingResult; ...@@ -46,9 +38,7 @@ import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
...@@ -65,12 +55,6 @@ public class TEmployeeProjectController { ...@@ -65,12 +55,6 @@ public class TEmployeeProjectController {
private final TEmployeeProjectService tEmployeeProjectService; private final TEmployeeProjectService tEmployeeProjectService;
private final TSettleDomainService tSettleDomainService;
private final TEmployeeInfoMapper tEmployeeInfoMapper;
private final TCustomerInfoMapper tCustomerInfoMapper;
/** /**
* @param empId 人员档案id * @param empId 人员档案id
* @Description: 根据人员档案id获取项目list * @Description: 根据人员档案id获取项目list
...@@ -261,26 +245,6 @@ public class TEmployeeProjectController { ...@@ -261,26 +245,6 @@ public class TEmployeeProjectController {
@Operation(summary = "通过项目编码查询项目信息", description = "通过项目编码查询项目信息") @Operation(summary = "通过项目编码查询项目信息", description = "通过项目编码查询项目信息")
@PostMapping("/getItemInfo" ) @PostMapping("/getItemInfo" )
public R getItemByEmpNo(@RequestParam String empIdcard,@RequestParam String empNo) { public R getItemByEmpNo(@RequestParam String empIdcard,@RequestParam String empNo) {
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda() return tEmployeeProjectService.getItemByEmpNo(empIdcard,empNo);
.eq(TSettleDomain::getDepartNo,empNo));
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,empIdcard));
Map<String,Object> map = new HashMap<>();
String empCode = "";
if (Common.isNotNull(tEmployeeInfo)) {
empCode = tEmployeeInfo.getEmpCode();
}
String customerName = "";
if (Common.isNotNull(tSettleDomain)) {
TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectOne(Wrappers.<TCustomerInfo>query().lambda()
.eq(TCustomerInfo::getId,tSettleDomain.getCustomerId()));
if (Common.isNotNull(tCustomerInfo)) {
customerName = tCustomerInfo.getCustomerName();
}
}
map.put("empCode",empCode);
map.put("itemInfo",tSettleDomain);
map.put("customerName",customerName);
return R.ok(map);
} }
} }
...@@ -28,6 +28,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO; ...@@ -28,6 +28,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
...@@ -115,4 +116,6 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> { ...@@ -115,4 +116,6 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
* @Date: 2022/6/23 18:06 * @Date: 2022/6/23 18:06
**/ **/
void saveEmployeeProjectInfo(TEmployeeInfo employeeInfo); void saveEmployeeProjectInfo(TEmployeeInfo employeeInfo);
R getItemByEmpNo(String empIdcard, String empNo);
} }
...@@ -25,12 +25,16 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -25,12 +25,16 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.plugin.excel.vo.ErrorMessage; import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TCustomerInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper; 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.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
...@@ -45,7 +49,6 @@ import org.springframework.cache.CacheManager; ...@@ -45,7 +49,6 @@ import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import java.io.IOException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -64,7 +67,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -64,7 +67,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
private final TEmployeeInfoMapper tEmployeeInfoMapper; private final TEmployeeInfoMapper tEmployeeInfoMapper;
private final TEmployeeProjectMapper tEmployeeProjectMapper; private final TSettleDomainService tSettleDomainService;
private final TCustomerInfoMapper tCustomerInfoMapper;
// 缓存信息 // 缓存信息
private final CacheManager cacheManager; private final CacheManager cacheManager;
...@@ -97,7 +102,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -97,7 +102,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (!Common.isEmpty(tEmployeeInfo)) { if (!Common.isEmpty(tEmployeeInfo)) {
map.put("empProId",tEmployeeProject.getId()); map.put("empProId",tEmployeeProject.getId());
if (CommonConstants.STATUS_NORMAL.equals(tEmployeeInfo.getFileStatus())) { if (CommonConstants.STATUS_NORMAL.equals(tEmployeeInfo.getFileStatus())) {
map.put("code","201");
return R.ok(map, "该人员已减项,是否“复项”"); return R.ok(map, "该人员已减项,是否“复项”");
} else { } else {
map.put("code","202"); map.put("code","202");
...@@ -291,13 +295,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -291,13 +295,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeInfoMapper.updateExcelEmployeeInfo(updateList); tEmployeeInfoMapper.updateExcelEmployeeInfo(updateList);
} }
if (proInsList.size() > CommonConstants.dingleDigitIntArray[0]) { if (proInsList.size() > CommonConstants.dingleDigitIntArray[0]) {
tEmployeeProjectMapper.insertExcelEmpProject(proInsList); baseMapper.insertExcelEmpProject(proInsList);
List<String> idList = proInsList.stream().map(TEmployeeProject::getEmpIdcard).collect(Collectors.toList()); List<String> idList = proInsList.stream().map(TEmployeeProject::getEmpIdcard).collect(Collectors.toList());
List<TEmployeeInfo> updList = tEmployeeInfoMapper.selectList(Wrappers.<TEmployeeInfo>query().lambda().in(TEmployeeInfo::getEmpIdcard,idList)); List<TEmployeeInfo> updList = tEmployeeInfoMapper.selectList(Wrappers.<TEmployeeInfo>query().lambda().in(TEmployeeInfo::getEmpIdcard,idList));
tEmployeeProjectMapper.updateEmpIdById(updList); baseMapper.updateEmpIdById(updList);
} }
if (proupdateList.size() > CommonConstants.dingleDigitIntArray[0]) { if (proupdateList.size() > CommonConstants.dingleDigitIntArray[0]) {
tEmployeeProjectMapper.updateExcelEmpProject(proupdateList); baseMapper.updateExcelEmpProject(proupdateList);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("数据更新异常",e); log.error("数据更新异常",e);
...@@ -363,7 +367,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -363,7 +367,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
} }
try { try {
if (updateList.size() > CommonConstants.dingleDigitIntArray[0]) { if (updateList.size() > CommonConstants.dingleDigitIntArray[0]) {
tEmployeeProjectMapper.updateExcelEmpProject(updateList); baseMapper.updateExcelEmpProject(updateList);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("数据更新异常",e); log.error("数据更新异常",e);
...@@ -404,7 +408,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -404,7 +408,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
insTEmployeePro.setEmpId(CommonConstants.EMPTY_STRING); insTEmployeePro.setEmpId(CommonConstants.EMPTY_STRING);
String str = ""; String str = "";
String EmpNo = tEmployeeProjectMapper.findEmployeeMaxOnlyNoByDepId(insTEmployeePro.getDeptNo()); String EmpNo = baseMapper.findEmployeeMaxOnlyNoByDepId(insTEmployeePro.getDeptNo());
if (!Common.isEmpty(EmpNo)) { if (!Common.isEmpty(EmpNo)) {
str = NoUtil.productionNo(EmpNo, CommonConstants.EMPLOYEE_INIT_NO_START); str = NoUtil.productionNo(EmpNo, CommonConstants.EMPLOYEE_INIT_NO_START);
} else { } else {
...@@ -540,20 +544,34 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -540,20 +544,34 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
public void saveEmployeeProjectInfo(TEmployeeInfo employeeInfo) { public void saveEmployeeProjectInfo(TEmployeeInfo employeeInfo) {
TEmployeeProject tEmployeeProject = new TEmployeeProject(); TEmployeeProject tEmployeeProject = new TEmployeeProject();
tEmployeeProject.setEmpId(employeeInfo.getId()); tEmployeeProject.setEmpId(employeeInfo.getId());
tEmployeeProject.setEmpCode(employeeInfo.getEmpCode()); tEmployeeProject.setEmpCode(this.getCode());
tEmployeeProject.setEmpNatrue(employeeInfo.getEmpNatrue()); tEmployeeProject.setEmpNatrue(employeeInfo.getEmpNatrue());
tEmployeeProject.setEmpName(employeeInfo.getEmpName()); tEmployeeProject.setEmpName(employeeInfo.getEmpName());
tEmployeeProject.setEmpIdcard(employeeInfo.getEmpIdcard()); tEmployeeProject.setEmpIdcard(employeeInfo.getEmpIdcard());
tEmployeeProject.setPost(employeeInfo.getPost()); tEmployeeProject.setPost(employeeInfo.getPost());
String str = ""; String str = "";
String EmpNo = tEmployeeProjectMapper.findEmployeeMaxOnlyNoByDepId(employeeInfo.getDeptNo()); String EmpNo = baseMapper.findEmployeeMaxOnlyNoByDepId(employeeInfo.getDeptNo());
if (!Common.isEmpty(EmpNo)) { if (!Common.isEmpty(EmpNo)) {
str = NoUtil.productionNo(EmpNo, CommonConstants.EMPLOYEE_INIT_NO_START); str = NoUtil.productionNo(EmpNo, CommonConstants.EMPLOYEE_INIT_NO_START);
} else { } else {
str = employeeInfo.getDeptNo() + CommonConstants.EMPLOYEE_INIT_NO; str = employeeInfo.getDeptNo() + CommonConstants.EMPLOYEE_INIT_NO;
} }
tEmployeeProject.setEmpNo(str); tEmployeeProject.setEmpNo(str);
tEmployeeProjectMapper.insert(tEmployeeProject); tEmployeeProject.setDeptNo(employeeInfo.getDeptNo());
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo,employeeInfo.getDeptNo()).eq(TSettleDomain::getDeleteFlag,CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(tSettleDomain)) {
tEmployeeProject.setDeptId(tSettleDomain.getId());
tEmployeeProject.setDeptName(tSettleDomain.getDepartName());
TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectById(tSettleDomain.getCustomerId());
if(Common.isNotNull(tCustomerInfo)) {;
tEmployeeProject.setUnitId(tCustomerInfo.getId());
tEmployeeProject.setUnitNo(tCustomerInfo.getCustomerCode());
tEmployeeProject.setUnitName(tCustomerInfo.getCustomerName());
}
}
baseMapper.insert(tEmployeeProject);
} }
/** /**
...@@ -608,5 +626,29 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -608,5 +626,29 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
return this.list(Wrappers.query(project)); return this.list(Wrappers.query(project));
} }
@Override
public R getItemByEmpNo(String empIdcard, String empNo) {
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo,empNo));
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,empIdcard));
Map<String,Object> map = new HashMap<>();
String empCode = "";
if (Common.isNotNull(tEmployeeInfo)) {
empCode = tEmployeeInfo.getEmpCode();
}
String customerName = "";
if (Common.isNotNull(tSettleDomain)) {
TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectOne(Wrappers.<TCustomerInfo>query().lambda()
.eq(TCustomerInfo::getId,tSettleDomain.getCustomerId()));
if (Common.isNotNull(tCustomerInfo)) {
customerName = tCustomerInfo.getCustomerName();
}
}
map.put("empCode",empCode);
map.put("itemInfo",tSettleDomain);
map.put("customerName",customerName);
return R.ok(map);
}
} }
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