Commit 5ce3683a by 邓实川 Committed by chenzg

员工列表优化,电子合同创建个人账户身份类型更新

parent 1090336a
...@@ -10,7 +10,6 @@ import org.springframework.context.annotation.Configuration; ...@@ -10,7 +10,6 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
......
...@@ -101,13 +101,13 @@ public class DzhtController2 { ...@@ -101,13 +101,13 @@ public class DzhtController2 {
String name = yg.getName(); String name = yg.getName();
Integer type = yg.getZjType(); Integer type = yg.getZjType();
String idType = null; String idType = null;
if (type == 1) { if (type == 0) {
idType = "CRED_PSN_CH_IDCARD";// 大陆身份证 idType = "CRED_PSN_CH_IDCARD";// 大陆身份证
} else if (type == 2) { } else if (type == 1) {
idType = "CRED_PSN_CH_HONGKONG";// 香港通行证 idType = "CRED_PSN_CH_HONGKONG";// 香港通行证
} else if (type == 3) { } else if (type == 2) {
idType = "CRED_PSN_CH_TWCARD";// 台湾通行证 idType = "CRED_PSN_CH_TWCARD";// 台湾通行证
} else if (type == 4) { } else if (type == 3) {
idType = "CRED_PSN_FOREIGN";// 外籍护照 idType = "CRED_PSN_FOREIGN";// 外籍护照
} }
String idNumber = yg.getZjNum(); String idNumber = yg.getZjNum();
......
...@@ -5,20 +5,14 @@ ...@@ -5,20 +5,14 @@
*/ */
package cn.timer.api.controller.yggl; package cn.timer.api.controller.yggl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
...@@ -27,7 +21,6 @@ import org.springframework.web.bind.annotation.PathVariable; ...@@ -27,7 +21,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -35,8 +28,6 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; ...@@ -35,8 +28,6 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.additional.update.impl.LambdaUpdateChainWrapper;
import com.github.pagehelper.util.StringUtil;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
...@@ -56,33 +47,19 @@ import cn.timer.api.bean.yggl.YgglAttaZcxxb; ...@@ -56,33 +47,19 @@ import cn.timer.api.bean.yggl.YgglAttaZcxxb;
import cn.timer.api.bean.yggl.YgglAttaZszjb; import cn.timer.api.bean.yggl.YgglAttaZszjb;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.yggl.YgglMainLzb; import cn.timer.api.bean.yggl.YgglMainLzb;
import cn.timer.api.dto.yggl.YgmzDto;
import cn.timer.api.bean.zzgl.ZzglBmgwM; import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.config.enums.CommonEnum; import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper; import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.yggl.YgAreaDtoMapper;
import cn.timer.api.dao.yggl.YgCityDtoMapper;
import cn.timer.api.dao.yggl.YgMzDtoMapper;
import cn.timer.api.dao.yggl.YgProDtoMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper; import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.yggl.YgglMainLzbMapper; import cn.timer.api.dao.yggl.YgglMainLzbMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper; import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dto.yggl.AddygdaDto; import cn.timer.api.dto.yggl.AddygdaDto;
import cn.timer.api.dto.yggl.IYgjgDto;
import cn.timer.api.dto.yggl.LzbQueryDto; import cn.timer.api.dto.yggl.LzbQueryDto;
import cn.timer.api.dto.yggl.LzygQueryDto; import cn.timer.api.dto.yggl.LzygQueryDto;
import cn.timer.api.dto.yggl.PunishFactory;
import cn.timer.api.dto.yggl.YgAreaDto;
import cn.timer.api.dto.yggl.YgCityDto;
import cn.timer.api.dto.yggl.YgDrjqbDto;
import cn.timer.api.dto.yggl.YgDrsDto;
import cn.timer.api.dto.yggl.YgQueryDto; import cn.timer.api.dto.yggl.YgQueryDto;
import cn.timer.api.dto.yggl.YgglCartogramDto; import cn.timer.api.dto.yggl.YgglCartogramDto;
import cn.timer.api.dto.yggl.YgjgDto;
import cn.timer.api.dto.yggl.YgProDto;
import cn.timer.api.dto.yggl.YgzzDto; import cn.timer.api.dto.yggl.YgzzDto;
import cn.timer.api.utils.Md5; import cn.timer.api.utils.Md5;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
...@@ -110,21 +87,10 @@ public class YgglController { ...@@ -110,21 +87,10 @@ public class YgglController {
@Autowired @Autowired
private YgglMainLzbMapper ygglMainLzbMapper; private YgglMainLzbMapper ygglMainLzbMapper;
@Autowired @Autowired
private ZzglBmgwMMapper zzglBmgwMMapper; private ZzglBmgwMMapper zzglBmgwMMapper;
//weng(籍贯)
@Autowired
private YgAreaDtoMapper ygAreaDtoMapper;
@Autowired
private YgCityDtoMapper ygCityDtoMapper;
@Autowired
private YgProDtoMapper ygProDtoMapper;
//weng
@Autowired
private YgMzDtoMapper ygMzDtoMapper;
/** /**
* 获取员工档案 * 获取员工档案
* *
...@@ -142,7 +108,23 @@ public class YgglController { ...@@ -142,7 +108,23 @@ public class YgglController {
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(queryWrapper); YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(queryWrapper);
return ResultUtil.data(ygglMainEmp, "获取员工档案成功"); return ResultUtil.data(ygglMainEmp, "获取员工档案成功");
} }
/**
* 展示所有部门岗位
*
* @param
* @return
*/
@GetMapping(value = "/bmgw")
@ApiOperation(value = "获取所有部门岗位id和名称", httpMethod = "GET", notes = "获取所有部门岗位id和名称")
@ApiOperationSupport(order = 2)
public Result<List<ZzglBmgwM>> allbmgw(@CurrentUser UserBean userBean) {
Integer orgCode = userBean.getOrgCode();
List<ZzglBmgwM> bmgws = ZzglBmgwM.builder().build()
.selectList(new QueryWrapper<ZzglBmgwM>().eq("org_code", orgCode));
return ResultUtil.data(bmgws, "获取员工档案成功");
}
/** /**
* 根据岗位id获取员工档案部门岗位名称 * 根据岗位id获取员工档案部门岗位名称
* *
...@@ -152,23 +134,20 @@ public class YgglController { ...@@ -152,23 +134,20 @@ public class YgglController {
@GetMapping(value = "/ygdabm") @GetMapping(value = "/ygdabm")
@ApiOperation(value = "获取员工档案部门岗位名称", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取员工档案部门岗位名称", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
public Result<String> selectbmgw(@CurrentUser UserBean userBean,@PathVariable Integer gwid) { public Result<String> selectbmgw(@CurrentUser UserBean userBean, @PathVariable Integer gwid) {
if (gwid==null||gwid==0) {
return ResultUtil.data("无岗位","获取员工档案部门岗位名称成功");
}
Integer orgCode = userBean.getOrgCode(); Integer orgCode = userBean.getOrgCode();
QueryWrapper<ZzglBmgwM> queryWrapper = new QueryWrapper<>(); QueryWrapper<ZzglBmgwM> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("org_code", orgCode).eq("id", gwid); queryWrapper.eq("org_code", orgCode).eq("id", gwid);
String gw = ZzglBmgwM.builder().build().selectOne(queryWrapper).getName(); String gw = ZzglBmgwM.builder().build().selectOne(queryWrapper).getName();
Integer bmid = ZzglBmgwM.builder().build().selectOne(queryWrapper).getUpId(); Integer bmid = ZzglBmgwM.builder().build().selectOne(queryWrapper).getUpId();
//QueryWrapper<ZzglBmgwM> queryWrapper1 = new QueryWrapper<>(); // QueryWrapper<ZzglBmgwM> queryWrapper1 = new QueryWrapper<>();
//queryWrapper1.eq("org_code", orgCode).eq("up_dept_id", gwid); // queryWrapper1.eq("org_code", orgCode).eq("up_dept_id", gwid);
String bm = ZzglBmgwM.builder().build().selectOne(new QueryWrapper<ZzglBmgwM>().eq("org_code", orgCode).eq("id", bmid)).getName(); String bm = ZzglBmgwM.builder().build()
String bmgw = bm+"/"+gw; .selectOne(new QueryWrapper<ZzglBmgwM>().eq("org_code", orgCode).eq("id", bmid)).getName();
return ResultUtil.data(bmgw,"获取员工档案部门岗位名称成功"); String bmgw = bm + "/" + gw;
return ResultUtil.data(bmgw, "获取员工档案成功");
} }
/** /**
* 获取员工教育经历表 * 获取员工教育经历表
* *
...@@ -359,7 +338,25 @@ public class YgglController { ...@@ -359,7 +338,25 @@ public class YgglController {
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>(); QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("org_code", orgCode).eq("emp_num", empNum); queryWrapper.eq("org_code", orgCode).eq("emp_num", empNum);
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(queryWrapper); YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(queryWrapper);
Integer bmgwId = ygglMainEmp.getBmgwId(); if (ygglMainEmp != null) {
Integer bmgwId = ygglMainEmp.getBmgwId();
if (bmgwId != null) {
ZzglBmgwM zzglBmgwM = ZzglBmgwM.builder().build()
.selectOne(new QueryWrapper<ZzglBmgwM>().select("name", "up_id").eq("id", bmgwId));
if (zzglBmgwM != null) {
ygglMainEmp.setGwName(zzglBmgwM.getName());
Integer upId = zzglBmgwM.getUpId();
if (upId != null) {
ZzglBmgwM zzglBmM = ZzglBmgwM.builder().build()
.selectOne(new QueryWrapper<ZzglBmgwM>().select("name").eq("up_id", upId));
if (zzglBmM != null) {
ygglMainEmp.setBmName(zzglBmM.getName());
}
}
}
}
}
return ResultUtil.data(ygglMainEmp, "获取员工档案成功"); return ResultUtil.data(ygglMainEmp, "获取员工档案成功");
} }
...@@ -481,7 +478,7 @@ public class YgglController { ...@@ -481,7 +478,7 @@ public class YgglController {
public Result<List<YgglAttaCzjlb>> selectczjlb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) { public Result<List<YgglAttaCzjlb>> selectczjlb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaCzjlb> ygglAttaCzjlbs = YgglAttaCzjlb.builder().build().selectList( List<YgglAttaCzjlb> ygglAttaCzjlbs = YgglAttaCzjlb.builder().build().selectList(
new QueryWrapper<YgglAttaCzjlb>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum)); new QueryWrapper<YgglAttaCzjlb>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
return ResultUtil.data(ygglAttaCzjlbs, "获取员工合同信息表成功"); return ResultUtil.data(ygglAttaCzjlbs, "获取员工成长记录表成功");
} }
/** /**
...@@ -842,8 +839,8 @@ public class YgglController { ...@@ -842,8 +839,8 @@ public class YgglController {
@ApiOperation(value = "添加/修改员工材料附件表", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "添加/修改员工材料附件表", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 41) @ApiOperationSupport(order = 41)
public Result<YgglAttaClfjb> addclfjb(@CurrentUser UserBean userBean, @RequestBody YgglAttaClfjb ygglAttaClfjb) { public Result<YgglAttaClfjb> addclfjb(@CurrentUser UserBean userBean, @RequestBody YgglAttaClfjb ygglAttaClfjb) {
ygglAttaClfjb.setOrgCode(userBean.getOrgCode());
ygglAttaClfjb.setEmpNum(ygglAttaClfjb.getEmpNum()); ygglAttaClfjb.setEmpNum(ygglAttaClfjb.getEmpNum());
ygglAttaClfjb.setOrgCode(userBean.getOrgCode());
ygglAttaClfjb.insertOrUpdate(); ygglAttaClfjb.insertOrUpdate();
return ResultUtil.data(ygglAttaClfjb, "添加/修改员工材料附件表成功"); return ResultUtil.data(ygglAttaClfjb, "添加/修改员工材料附件表成功");
} }
...@@ -1009,25 +1006,34 @@ public class YgglController { ...@@ -1009,25 +1006,34 @@ public class YgglController {
@ApiOperation(value = "员工搜索/分页", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "员工搜索/分页", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 52) @ApiOperationSupport(order = 52)
public Result<Object> ygquery(@CurrentUser UserBean userBean, @RequestBody YgQueryDto ygQueryDto) { public Result<Object> ygquery(@CurrentUser UserBean userBean, @RequestBody YgQueryDto ygQueryDto) {
Integer orgCode = userBean.getOrgCode();
Integer b = ygQueryDto.getBmgwid(); Integer b = ygQueryDto.getBmgwid();
ArrayList<Integer> bList = new ArrayList<Integer>();
List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getOrgCode, orgCode).list();
ZzglBmgwM.getDepts(bList, b, zzglBmgwMs);
Integer j = ygQueryDto.getJobStatus(); Integer j = ygQueryDto.getJobStatus();
Integer t = ygQueryDto.getJobType(); Integer t = ygQueryDto.getJobType();
String q = ygQueryDto.getQuery(); String q = ygQueryDto.getQuery();
Page<YgglMainEmp> page = new Page<YgglMainEmp>( Page<YgglMainEmp> page = new Page<YgglMainEmp>(
ygQueryDto.getCurrentPage() == null ? 1 : ygQueryDto.getCurrentPage(), ygQueryDto.getCurrentPage() == null ? 1 : ygQueryDto.getCurrentPage(),
ygQueryDto.getTotalPage() == null ? 10 : ygQueryDto.getTotalPage()); ygQueryDto.getTotalPage() == null ? 10 : ygQueryDto.getTotalPage());
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>(); QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("org_code", userBean.getOrgCode()).eq(t != null && t > -1, "job_type", t) queryWrapper.
.eq(b != null && b > -1, "bmgw_id", b).eq(j != null && j > -1, "job_status", j) select("name","emp_num","bmgw_id","rz_time","job_type","phone","job_status")
.and(!StrUtil.hasBlank(q), wq -> wq.likeRight("name", q).or().likeRight("phone", q)); .eq("org_code", orgCode).eq(t != null && t > -1, "job_type", t)
.eq(j != null && j > -1, "job_status", j).in(!bList.isEmpty(), "id", bList)
.and(!StrUtil.hasBlank(q), wq -> wq.like("name", q).or().like("phone", q));
// List<YgglMainEmp> lo = YgglMainEmp.builder().build().selectList(queryWrapper);
IPage<YgglMainEmp> ygglMainEmpPage = YgglMainEmp.builder().build().selectPage(page, queryWrapper); IPage<YgglMainEmp> ygglMainEmpPage = YgglMainEmp.builder().build().selectPage(page, queryWrapper);
List<YgglMainEmp> ygglMainEmps = ygglMainEmpPage.getRecords(); // List<YgglMainEmp> ygglMainEmps = ygglMainEmpPage.getRecords();
ygglMainEmpPage.getCurrent(); ygglMainEmpPage.getCurrent();
ygglMainEmpPage.getPages(); ygglMainEmpPage.getPages();
ygglMainEmpPage.getTotal(); ygglMainEmpPage.getTotal();
ygglMainEmpPage.getSize(); ygglMainEmpPage.getSize();
return ResultUtil.data(ygglMainEmpPage, ygglMainEmps, "员工搜索成功"); return ResultUtil.data(ygglMainEmpPage, "员工搜索成功");
// return ResultUtil.data(ygglMainEmpPage, ygglMainEmps, "员工搜索成功");
} }
/** /**
...@@ -1047,430 +1053,26 @@ public class YgglController { ...@@ -1047,430 +1053,26 @@ public class YgglController {
List<YgglMainLzb> lzb = ygglMainLzbMapper.queryLzb(page, lzygQueryDto); List<YgglMainLzb> lzb = ygglMainLzbMapper.queryLzb(page, lzygQueryDto);
return ResultUtil.data(page, lzb, "离职员工搜索成功"); return ResultUtil.data(page, lzb, "离职员工搜索成功");
} }
//威力加强版
@PostMapping(value = "/ygdas")
@ApiOperation(value = "导入威力加强版", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 70)
public Result<List<YgDrjqbDto>> ygdr(@CurrentUser UserBean userBean,@RequestBody YgDrsDto drList) {
drList.setOrgCode(userBean.getOrgCode());
YgDrsDto tofList = errorFilter(drList);//滤嘴,过滤信息
if (tofList.getDrList().size()==0) return ResultUtil.data(tofList.getErrorList(), "导入发生错误人员名单");
YgDrsDto tof = optFilter(tofList);//彻底规范好数据
List<YgDrjqbDto> trueList = tof.getDrList();//拿出正确的信息
List<YgDrjqbDto> errorList = tof.getErrorList();//拿出错误的信息
if (trueList.size()==0) return ResultUtil.data(errorList, "导入发生错误人员名单");
for (YgDrjqbDto e : trueList) {
QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper).eq(QyzxEmpLogin::getPhone,e.getPhone()).one();
//证件类型为0
Integer jobType = Integer.valueOf(e.getJobType());//工作类型
Integer syq=Integer.valueOf(e.getSyq());//试用期
Integer sex=Integer.valueOf(e.getSex());//性别,还差一个岗位
Integer gw= e.getHavebmid();
String jobNum = e.getYgnbgh();
Integer jg = e.getJg();
Date birthday = e.getBirthday();
//入职日期
Date rzdate = new Date();
SimpleDateFormat straight = new SimpleDateFormat("yyyy-MM-dd");//正杠
if (e.getRzTime().indexOf("-")!=-1) {
try {
rzdate = straight.parse(e.getRzTime());
} catch (ParseException PException) {
PException.printStackTrace();
e.setError("请填写正确的时间格式");
errorList.add(e);
continue;
}
}
//判断是否已有员工登录表
if (login==null) {// 添加三张表
QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(e.getPhone()).pw(Md5.md5("123456"))
.sts(CommonEnum.U_STS_ON.getType()).orgId(userBean.getOrgCode()).username(e.getName()).build();
if (!qyzxEmpLogin.insert()) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
e.setError("员工无法添加!");
errorList.add(e);
continue;
}
// 员工权限表(未定)
// 员工企业关联表和员工档案,员工成长表(未定)
QyzxEmpEntAsso.builder().empNum(qyzxEmpLogin.getId()).orgCode(userBean.getOrgCode())
.userType(2).status(1).build().insert();// userType2普通员工
YgglMainEmp emp = YgglMainEmp.builder()
.name(e.getName()).phone(e.getPhone()).zjType(0)
.zjNum(e.getZj()).jobType(jobType).rzTime(rzdate)
.updateTime(new Date()).updateMan(userBean.getEmpNum()).syq(syq)
.sex(sex).jobNum(jobNum).bmgwId(gw)
.empNum(qyzxEmpLogin.getId()).orgCode(userBean.getOrgCode()).build();
emp.insert();
boolean wanshan = new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
.eq(YgglMainEmp::getId, emp.getId())
.set(birthday!=null, YgglMainEmp::getBirthday, birthday)
.set(jg!=null && jg!=0, YgglMainEmp::getJg, jg).update();
//return ResultUtil.data(ygglMainEmp, "新添加员工档案成功!");
}else {
// 添加两张表
YgglMainEmp ishad = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>()
.eq("phone", e.getPhone()).eq("org_code", userBean.getOrgCode()));
if (ishad == null) {
// 员工权限表(未定)
QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(userBean.getOrgCode()).userType(2).build().insert();// 2普通员工
YgglMainEmp emp = YgglMainEmp.builder().name(e.getName()).phone(e.getPhone())
.zjType(0).zjNum(e.getZj())
.jobType(jobType).rzTime(rzdate)
.updateTime(new Date()).updateMan(userBean.getEmpNum())
.syq(syq).sex(sex)
.jobNum(jobNum).empNum(login.getId()).orgCode(userBean.getOrgCode()).build();
emp.insert();
boolean wanshan = new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
.eq(YgglMainEmp::getId, emp.getId())
.set(birthday!=null, YgglMainEmp::getBirthday, birthday)
.set(jg!=null && jg!=0, YgglMainEmp::getJg, jg).update();
//return ResultUtil.data(emp, "添加员工档案成功!");
} else {
e.setError("该手机号码已被使用");
errorList.add(e);
continue;
}
}
}
if (errorList.size()==0) {
return ResultUtil.success("员工全部导入成功!");
}
return ResultUtil.data(errorList, "导入发生错误人员名单");
}
//错误选项过滤器
public YgDrsDto errorFilter(YgDrsDto ygDrsDto) {
List<YgDrjqbDto> drList = ygDrsDto.getDrList();
List<YgDrjqbDto> newList = new ArrayList<YgDrjqbDto>(drList);
List<YgDrjqbDto> errorList = ygDrsDto.getErrorList();
Integer orgCode = ygDrsDto.getOrgCode();
Iterator<YgDrjqbDto> itDr = drList.iterator();
YgDrjqbDto a = drList.get(0);//一个员工导入
Integer size = drList.size();
for (Integer i=0; i<size;) {//
YgDrjqbDto d = newList.get(i);//计数器
if (itDr.hasNext()) {
a=itDr.next();
}
//请填写必填项
String name = newList.get(i).getName(); String phone = newList.get(i).getPhone();
String sex = newList.get(i).getSex(); String zj = newList.get(i).getZj();
if (StrUtil.hasBlank(name)
|| StrUtil.hasBlank(phone)
|| StrUtil.hasBlank(sex)
|| StrUtil.hasBlank(zj)) {
d.setError("请填写必填项");
errorList.add(d);itDr.remove();i++;continue;
}
//手机号码格式不对
String regex = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,5-9]))\\d{8}$";
if (phone.length()!= 11) {
d.setError("手机号应为11位数");
errorList.add(d);itDr.remove();i++;continue;
}
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(phone);
boolean isMatch = m.matches();
if(!isMatch){
d.setError("手机号格式不对");
errorList.add(d);itDr.remove();i++;continue;
}
//手机号码已被使用
QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper).eq(QyzxEmpLogin::getPhone,phone).eq(QyzxEmpLogin::getOrgId, orgCode).one();
if (login!=null) {
d.setError("手机号码已被使用");
errorList.add(d);itDr.remove();i++;continue;
}
//证件号码信息有误
if (zj == null || "".equals(zj)) {
d.setError("证件号码信息有误");
errorList.add(d);itDr.remove();i++;continue;
}
String regularExpression = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" +
"(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)";
boolean matches = zj.matches(regularExpression);
if (!matches) {
d.setError("证件号码信息有误");
errorList.add(d);itDr.remove();i++;continue;
}
try {
if (zj.length() == 18) {
char[] charArray = zj.toCharArray();
//前十七位加权因子
int[] idCardWi = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
//这是除以11后,可能产生的11位余数对应的验证码
String[] idCardY = {"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"};
int sum = 0;
for (Integer j = 0; j < idCardWi.length; j++) {
int current = Integer.parseInt(String.valueOf(charArray[j]));
int count = current * idCardWi[j];
sum += count;
}
char idCardLast = charArray[17];
int idCardMod = sum % 11;
if (idCardY[idCardMod].toUpperCase().equals(String.valueOf(idCardLast).toUpperCase())) {
//System.out.println("成功,接着完善员工的个人信息");
String birth = zj.substring(6, 14);
String birthday =birth.substring(0, 4)+"-"+birth.substring(4, 6)+"-"+birth.substring(6,8);
SimpleDateFormat straight = new SimpleDateFormat("yyyy-MM-dd");
d.setBirthday(straight.parse(birthday));
d.setJg(Integer.parseInt(zj.substring(0, 6)));
} else {
//System.out.println("身份证最后一位:" + String.valueOf(idCardLast).toUpperCase() +
// "错误,正确的应该是:" + idCardY[idCardMod].toUpperCase());
//return false;
d.setError("证件号码信息有误");
errorList.add(d);itDr.remove();i++;continue;
}
}else {
//给15位数的添加生日籍贯
String birth = zj.substring(6, 12);
String birthday = "19" + birth.substring(0, 2) + "-" + birth.substring(2, 4) + "-" + birth.substring(4, 6);
SimpleDateFormat straight = new SimpleDateFormat("yyyy-MM-dd");
d.setBirthday(straight.parse(birthday));
d.setJg(Integer.parseInt(zj.substring(0, 6)));
}
} catch (Exception e) {
e.printStackTrace();
//System.out.println("异常:" + zj);
//return false;
d.setError("证件号码信息有误");
errorList.add(d);itDr.remove();i++;continue;
}
//部门岗位有误
String oneb = newList.get(i).getOneb();String twob = newList.get(i).getTwob();
String threeb = newList.get(i).getThreeb();String fourb = newList.get(i).getFourb();
String gw = newList.get(i).getGw();
String[] bms = {oneb,twob,threeb,fourb};
if (StrUtil.hasBlank(gw) && StrUtil.hasBlank(oneb)
&& StrUtil.hasBlank(twob) && StrUtil.hasBlank(threeb)
&& StrUtil.hasBlank(fourb)) { //没填写岗位,通过~ //
}else {
//填写了部门岗位,办他!
Integer isHaveBmgw = isHavebmgw(bms,gw,orgCode);
if (isHaveBmgw == 0) {
d.setError("部门岗位有误");
errorList.add(d);itDr.remove();i++;continue;
}else {
//获取到部门岗位id啦!
d.setHavebmid(isHaveBmgw);
}
}
i++;
}//for循环完毕!
YgDrsDto tofList = new YgDrsDto(drList, errorList, orgCode);
return tofList;
}
//选填项过滤器
public YgDrsDto optFilter(YgDrsDto ygDrsDto) {
List<YgDrjqbDto> drList = ygDrsDto.getDrList();
List<YgDrjqbDto> newList = new ArrayList<YgDrjqbDto>(drList);
List<YgDrjqbDto> errorList = ygDrsDto.getErrorList();
Integer orgCode = ygDrsDto.getOrgCode();
Iterator<YgDrjqbDto> itDr = drList.iterator();
YgDrjqbDto a = drList.get(0);//一个员工导入
Integer size = drList.size();
for (Integer i=0; i<size;i++) {//
YgDrjqbDto d = newList.get(i);//计数器
if (itDr.hasNext()) {
a=itDr.next();
}
//for (YgDrjqbDto d : drList) {
String ygnbgh = d.getYgnbgh(); String sex = d.getSex();
String jobType = d.getJobType();String jobStatus = d.getJobStatus();
String rzTime = d.getRzTime();String syq = d.getSyq();
String zy = d.getZy();String address = d.getAddress();
String hjAddress = d.getHkAddress();String qq = d.getQq();
String weixin =d.getWeixin(); String email = d.getEmail();
String[] bathroom = {ygnbgh,jobType,jobStatus,rzTime,syq,zy,address,hjAddress,qq,weixin,email};
boolean child=takeshower(bathroom);
if (child == false) {
d.setError("填写内容不要大于50字数");
errorList.add(d);itDr.remove();i++;continue;
}
//公司内部工号
if (ygnbgh != null && ygnbgh.length() != 0) {
d.setYgnbgh(ygnbgh.trim());
}else {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String bh = format.format(new Date())+orgCode+i+System.currentTimeMillis();
d.setYgnbgh(bh);
}
//男女(最大优化)
d.setSex(YgEnumInterface.sex.isMan(sex));
//工作性质(最大优化)
d.setJobType(YgEnumInterface.YgJobType.choose(jobType));
//员工状态(最大优化)
d.setJobStatus(YgEnumInterface.jobStatus.isZhen(jobStatus));
//入职日期(已优化)
d.setRzTime(YgEnumInterface.rzTime.tranTime2(YgEnumInterface.rzTime.tranTime(rzTime)));
//试用期(已优化)
d.setSyq(YgEnumInterface.syq.choose(syq));
}
YgDrsDto clear = new YgDrsDto(drList, errorList, orgCode);
return clear;
}
//浴池,洗去选填项字节大于100的选项
public boolean takeshower(String[] bathroom){
for (String b : bathroom) {
if (b.length()>100) {
return false;}}
return true;}
//判断是否导入组织部门
public Integer isHavebmgw(String[] bms,String gw,Integer orgCode) {
//将姓名转为部门岗位对象
List<ZzglBmgwM> gwList = new ArrayList<ZzglBmgwM>();
//判断有几个部门,且这几个部门是否属实,里面不包括岗位
for (String bm : bms) {
if(!StrUtil.hasBlank(bm)){
ZzglBmgwM ibm = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getName, bm)
.eq(ZzglBmgwM::getOrgCode,orgCode)
.eq(ZzglBmgwM::getType, 0).one(); //选择部门类型0为部门,1为岗位
if (ibm == null) { return 0;} //找不到有相关名称的部门则报错
gwList.add(ibm);
}else {
break;
}
}
Integer qiantao = qiantao(gwList,gw,0,orgCode);
if (qiantao!=0) {
return qiantao;//组织部门成立!
}else {
return 0;//失败
}
};
//判断是否导入组织部门的嵌套并寻找到正确岗位id
public Integer qiantao(List<ZzglBmgwM>gwList,String gw,Integer upid,Integer orgCode) {
//重写
if (upid!=0 && !gwList.get(0).getUpId().equals(upid)) {
return 0;
}
upid = gwList.get(0).getId();
if (gwList.size() == 1) {
ZzglBmgwM igw = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getName, gw)
.eq(ZzglBmgwM::getUpId, upid)
.eq(ZzglBmgwM::getOrgCode,orgCode)
.eq(ZzglBmgwM::getType, 1).one();
if (igw==null) {
return 0;
}
return igw.getId();
}
gwList.remove(0);
Integer q = qiantao(gwList,gw,upid,orgCode);
return q;
};
/** /**
* 部门导入(未完成) * 导入/批量添加/修改员工
* @param *
* @return
*/
@PostMapping(value = "/ygbmdr")
@ApiOperation(value = "员工部门导入", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 59)
public Result<List<YgglMainEmp>> ygbmdr(UserBean userBean, List<YgglMainEmp> EmpList) {
return ResultUtil.success("员工导入成功!");
}
/**
* 展示民族/展示所有民族
* @param
* @return
*/
@PostMapping(value = "/mz/{id}")
@ApiOperation(value = "展示民族/展示所有民族", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 60)
public Result<List<YgmzDto>> selectmzs(@CurrentUser UserBean userBean, @PathVariable Integer id) {
if (id==null||id==0) {
List<YgmzDto> allmz =new LambdaQueryChainWrapper<YgmzDto>(ygMzDtoMapper).list();
return ResultUtil.data(allmz,"展示所有民族");
}
List<YgmzDto> mz =new LambdaQueryChainWrapper<YgmzDto>(ygMzDtoMapper).eq(YgmzDto::getNumber, id).list();
return ResultUtil.data(mz,"展示该民族");
}
/**
* 展示籍贯/展示所有籍贯
* @param * @param
* @return * @return
*/ */
@PostMapping(value = "/jg") @PostMapping(value = "/ygdas")
@ApiOperation(value = "展示籍贯所有省市区", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "导入/批量添加/修改员工", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 65) @ApiOperationSupport(order = 54)
public Result<List<YgjgDto>> selectjgs(@CurrentUser UserBean userBean, @RequestBody YgjgDto ygjgDto) { public Result<List<YgglMainEmp>> addygdas(UserBean userBean, List<YgglMainEmp> ygglMainEmpList) {
Integer type = ygjgDto.getType(); for (YgglMainEmp ygglMainEmp : ygglMainEmpList) {
Integer upId = ygjgDto.getJgid(); ygglMainEmp.insertOrUpdate();
List<YgjgDto> maps = new ArrayList<YgjgDto>(); }
YgjgDto map = YgjgDto.builder().build(); return ResultUtil.data(ygglMainEmpList, "导入/批量添加/修改员工成功");
if (type == 1) { //省份
List<YgProDto> list = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper).select(YgProDto::getId,YgProDto::getProvince,YgProDto::getName).orderByAsc(YgProDto::getProvince).list();
for (YgProDto pro : list) {
map.setType(pro.getId());map.setJgid(pro.getProvince());map.setJgname(pro.getName());
maps.add(map);
}}
if (type == 2) { //城市
List<YgCityDto> list = new LambdaQueryChainWrapper<YgCityDto>(ygCityDtoMapper).select(YgCityDto::getId,YgCityDto::getCity,YgCityDto::getName).eq(YgCityDto::getProvince, upId).orderByAsc(YgCityDto::getProvince).orderByAsc(YgCityDto::getCity).list();
for (YgCityDto city : list) {
maps.add(new YgjgDto(city.getId(), city.getCity(), city.getName()));
}}
if (type == 3) { //地区
List<YgAreaDto> list = new LambdaQueryChainWrapper<YgAreaDto>(ygAreaDtoMapper).select(YgAreaDto::getId,YgAreaDto::getName).eq(YgAreaDto::getCity, upId).orderByAsc(YgAreaDto::getProvince).orderByAsc(YgAreaDto::getCity).list();
for (YgAreaDto area : list) {
maps.add(new YgjgDto(area.getId(), area.getId(), area.getName()));
}}
//IYgjgDto iYgjgDto = PunishFactory.getPunish(type);
//List<String> strings = iYgjgDto.exePunish();
//System.out.println(strings);
if (!maps.isEmpty()) return ResultUtil.data(maps, "展示籍贯成功");
return ResultUtil.error("输入参数有误!");
}
@PostMapping(value = "/jgp/{id}")
@ApiOperation(value = "显示籍贯省市区", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 66)
public Result<String> selectjg(@CurrentUser UserBean userBean, @PathVariable Integer id) {
String isPro =id.toString().substring(2,4);
String isCity =id.toString().substring(4,6);
if ("00".equals(isPro)) {
YgProDto pro = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper).select(YgProDto::getId,YgProDto::getName).eq(YgProDto::getId, id).one();
if (pro!=null) { return ResultUtil.data(pro.getName(),"显示所在籍贯"); }}
if ("00".equals(isCity)) {
YgCityDto city = new LambdaQueryChainWrapper<YgCityDto>(ygCityDtoMapper).select(YgCityDto::getId,YgCityDto::getName).eq(YgCityDto::getId, id).one();
if (city!=null ) { return ResultUtil.data(city.getName(),"显示所在籍贯"); }}
YgAreaDto area = new LambdaQueryChainWrapper<YgAreaDto>(ygAreaDtoMapper).select(YgAreaDto::getId,YgAreaDto::getName).eq(YgAreaDto::getId, id).one();
if (area!=null ) { return ResultUtil.data(area.getName(),"显示所在籍贯");}
return ResultUtil.error("编码有误,显示不到所在籍贯");
} }
/** /**
* 导出员工 * 导出/批量添加/修改员工
*
* @param * @param
* @return * @return
*/ */
...@@ -1482,7 +1084,7 @@ public class YgglController { ...@@ -1482,7 +1084,7 @@ public class YgglController {
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>(); QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("org_code", orgCode); queryWrapper.eq("org_code", orgCode);
List<YgglMainEmp> ygglMainEmpList = YgglMainEmp.builder().build().selectList(queryWrapper); List<YgglMainEmp> ygglMainEmpList = YgglMainEmp.builder().build().selectList(queryWrapper);
return ResultUtil.data(ygglMainEmpList, "导出员工成功"); return ResultUtil.data(ygglMainEmpList, "导出/批量添加/修改员工成功");
} }
/** /**
...@@ -1525,7 +1127,9 @@ public class YgglController { ...@@ -1525,7 +1127,9 @@ public class YgglController {
List<YgglCartogramDto> ygglCartogramDto11 = ygglMainEmpMapper.queryWorkingAge(userBean); List<YgglCartogramDto> ygglCartogramDto11 = ygglMainEmpMapper.queryWorkingAge(userBean);
map.put("positive", ygglCartogramDto1.getPositive()); map.put("positive", ygglCartogramDto1.getPositive());
map.put("avgAge", ygglCartogramDto2.getAvgAge()); if (ygglCartogramDto2 != null) {
map.put("avgAge", ygglCartogramDto2.getAvgAge());
}
map.put("induction", ygglCartogramDto3.getInduction()); map.put("induction", ygglCartogramDto3.getInduction());
map.put("probation", ygglCartogramDto4.getProbation()); map.put("probation", ygglCartogramDto4.getProbation());
map.put("regular", ygglCartogramDto4.getRegular()); map.put("regular", ygglCartogramDto4.getRegular());
...@@ -1540,7 +1144,7 @@ public class YgglController { ...@@ -1540,7 +1144,7 @@ public class YgglController {
return ResultUtil.data(map, "查询成功"); return ResultUtil.data(map, "查询成功");
} }
/** /**
* 获取员工社保公积金 * 获取员工社保公积金
* *
...@@ -1550,9 +1154,10 @@ public class YgglController { ...@@ -1550,9 +1154,10 @@ public class YgglController {
@GetMapping(value = "/ygsbgjj/{empNum}") @GetMapping(value = "/ygsbgjj/{empNum}")
@ApiOperation(value = "获取员工社保公积金", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取员工社保公积金", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 12) @ApiOperationSupport(order = 12)
public Result<YgglAttaSbgjj> selectygsbgjj(@CurrentUser UserBean userBean,@PathVariable Integer empNum) { public Result<YgglAttaSbgjj> selectygsbgjj(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
YgglAttaSbgjj ygglAttaSbgjj = YgglAttaSbgjj.builder().build().selectOne(new QueryWrapper<YgglAttaSbgjj>().eq("emp_num", empNum)); YgglAttaSbgjj ygglAttaSbgjj = YgglAttaSbgjj.builder().build()
.selectOne(new QueryWrapper<YgglAttaSbgjj>().eq("emp_num", empNum));
return ResultUtil.data(ygglAttaSbgjj, "获取员工社保公积金成功"); return ResultUtil.data(ygglAttaSbgjj, "获取员工社保公积金成功");
} }
...@@ -1566,19 +1171,20 @@ public class YgglController { ...@@ -1566,19 +1171,20 @@ public class YgglController {
@PostMapping(value = "/ygsbgjj") @PostMapping(value = "/ygsbgjj")
@ApiOperation(value = "添加/修改员工社保公积金", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "添加/修改员工社保公积金", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 12) @ApiOperationSupport(order = 12)
public Result<YgglAttaSbgjj> addygsbgjj(@CurrentUser UserBean userBean,@RequestBody YgglAttaSbgjj ygglAttaSbgjj) { public Result<YgglAttaSbgjj> addygsbgjj(@CurrentUser UserBean userBean, @RequestBody YgglAttaSbgjj ygglAttaSbgjj) {
Integer empNum = ygglAttaSbgjj.getEmpNum(); Integer empNum = ygglAttaSbgjj.getEmpNum();
if (empNum == null) { if (empNum == null) {
return ResultUtil.error(); return ResultUtil.error();
} }
YgglAttaSbgjj AttaSbgjj = YgglAttaSbgjj.builder().build().selectOne(new QueryWrapper<YgglAttaSbgjj>().eq("emp_num", empNum)); YgglAttaSbgjj AttaSbgjj = YgglAttaSbgjj.builder().build()
.selectOne(new QueryWrapper<YgglAttaSbgjj>().eq("emp_num", empNum));
if (AttaSbgjj != null) { if (AttaSbgjj != null) {
ygglAttaSbgjj.update(new UpdateWrapper<YgglAttaSbgjj>().eq("emp_num", empNum)); ygglAttaSbgjj.update(new UpdateWrapper<YgglAttaSbgjj>().eq("emp_num", empNum));
}else { } else {
ygglAttaSbgjj.insert(); ygglAttaSbgjj.insert();
} }
return ResultUtil.data(ygglAttaSbgjj, "添加/修改员工社保公积金成功"); return ResultUtil.data(ygglAttaSbgjj, "添加/修改员工社保公积金成功");
} }
} }
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