Commit 5737ff20 by 东州 翁 Committed by chenzg

添加方法根据传来的empNum获取该人员的岗位,以及上面所有的部门id,返回integer数组,更正发票资料表的对应表名,工作性质从0开始

parent 7f2be3d9
......@@ -40,8 +40,8 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name="qyzx_invoice_data")
@ApiModel("发票资料表")
@Table(name="qyzx_invoice_usual")
@ApiModel("常用发票资料表")
public class QyzxInvoiceUsual extends Model<QyzxInvoiceUsual>{
private static final long serialVersionUID = 2890357568571822258L;
......@@ -82,6 +82,9 @@ public class QyzxInvoiceUsual extends Model<QyzxInvoiceUsual>{
@ApiModelProperty(value="邮箱",example="13144400255@163.com")
private String email;
@ApiModelProperty(value="收货地区",example="广东省广州市白云区")
private String shippingArea;
@ApiModelProperty(value="收货地址",example="白云东平伯曼酒店")
private String shippingAddress;
......
......@@ -127,7 +127,7 @@ public class YgglMainEmp extends Model<YgglMainEmp> {
@ApiModelProperty(value="转正备注 ",example="转正备注")
private String zzRemark;
@ApiModelProperty(value="工作性质 1全职、2实习生、3兼职、4劳务派遣、5劳务、6派遣、7外包、8退休返聘",example="101")
@ApiModelProperty(value="工作性质 0全职、1实习生、2兼职、3劳务派遣、4劳务、5派遣、6外包、7退休返聘",example="101")
private Integer jobType;
@ApiModelProperty(value="员工状态 0试用、1正式、2离职中、3已离职",example="101")
......
......@@ -231,6 +231,12 @@ public class QyzxController {
public Result<QyzxInvoiceUsual> invoiceusual(@CurrentUser UserBean userBean) {
QyzxInvoiceUsual one = new LambdaQueryChainWrapper<QyzxInvoiceUsual>(qyzxInvoiceUsualMapper)
.eq(QyzxInvoiceUsual::getOrgCode, userBean.getOrgCode()).one();
if (one.getShippingArea() == null) {
one.setShippingArea("");
}
if (one.getShippingAddress() == null) {
one.setShippingAddress("");
}
return ResultUtil.data(one, "显示常用的企业开票资料");
}
......
......@@ -8,19 +8,24 @@ package cn.timer.api.controller.yggl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.transaction.Transactional;
import javax.websocket.server.PathParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.DeleteMapping;
......@@ -39,10 +44,10 @@ import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWra
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.util.StringUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.BetweenFormater.Level;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
......@@ -74,13 +79,13 @@ 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.YgglMainLzbMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dto.yggl.AddygdaDto;
import cn.timer.api.dto.yggl.LoginerChargeDto;
import cn.timer.api.dto.yggl.LzbQueryDto;
import cn.timer.api.dto.yggl.LzygQueryDto;
import cn.timer.api.dto.yggl.YgAreaDto;
import cn.timer.api.dto.yggl.YgCartogramDto;
import cn.timer.api.dto.yggl.YgCityDto;
import cn.timer.api.dto.yggl.YgDrjqbDto;
import cn.timer.api.dto.yggl.YgDrsDto;
......@@ -91,6 +96,7 @@ import cn.timer.api.dto.yggl.YgbintuDto;
import cn.timer.api.dto.yggl.YgglCartogramDto;
import cn.timer.api.dto.yggl.YgjgDto;
import cn.timer.api.dto.yggl.YgmzDto;
import cn.timer.api.dto.yggl.YgCartogramDto;
import cn.timer.api.dto.yggl.YgzzDto;
import cn.timer.api.utils.Md5;
import cn.timer.api.utils.Result;
......@@ -145,16 +151,14 @@ public class YgglController {
public Result<YgglMainEmp> loginmessage(@CurrentUser UserBean userBean) {
Integer empNum = userBean.getEmpNum();
Integer orgCode = userBean.getOrgCode();
YgglMainEmp ygglMainEmp = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.select(YgglMainEmp::getBmgwId, YgglMainEmp::getName, YgglMainEmp::getRzTime, YgglMainEmp::getEmpNum)
.eq(YgglMainEmp::getEmpNum, empNum).eq(YgglMainEmp::getOrgCode, orgCode).one();
YgglMainEmp ygglMainEmp=new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.select(YgglMainEmp::getBmgwId,YgglMainEmp::getName,YgglMainEmp::getRzTime,YgglMainEmp::getEmpNum).
eq(YgglMainEmp::getEmpNum, empNum).eq(YgglMainEmp::getOrgCode, orgCode).one();
Integer gw = ygglMainEmp.getBmgwId();
ZzglBmgwM bmid = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).select(ZzglBmgwM::getUpId)
.eq(ZzglBmgwM::getId, gw).eq(ZzglBmgwM::getOrgCode, orgCode).one();
ZzglBmgwM bmid = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).select(ZzglBmgwM::getUpId).eq(ZzglBmgwM::getId, gw).eq(ZzglBmgwM::getOrgCode, orgCode).one();
ygglMainEmp.setUnionid(bmid.toString());
return ResultUtil.data(ygglMainEmp, "部门id返回字段为unionid");
}
/**
* 获取登录人和上级主管的empNum和名称
*
......@@ -169,56 +173,52 @@ public class YgglController {
ArrayList<Integer> list = new ArrayList<Integer>();
Integer empNum = userBean.getEmpNum();
Integer gw = empNumConfirm(orgCode, empNum).getBmgwId();
List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getOrgCode, orgCode).list();
// 获取该员工的上级部门id 的数组list
List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).eq(ZzglBmgwM::getOrgCode, orgCode).list();
//获取该员工的上级部门id 的数组list
ZzglBmgwM.getUpDepts(list, gw, zzglBmgwMs);
List<Integer> leaderList = new ArrayList<Integer>();
for (Integer zzglId : list) {
for (ZzglBmgwM zzglBmgwM : zzglBmgwMs) {
if (zzglId.equals(zzglBmgwM.getId()) && zzglBmgwM.getLeader() != null) {
if (zzglId.equals(zzglBmgwM.getId()) && zzglBmgwM.getLeader()!=null) {
leaderList.add(zzglBmgwM.getLeader());
}
}
}
List<YgglMainEmp> ygglMainEmps = empNumsConfirm(orgCode, leaderList);
List<LoginerChargeDto> loginerChargeDtos = new ArrayList<LoginerChargeDto>();
List<LoginerChargeDto> loginerChargeDtos =new ArrayList<LoginerChargeDto>();
for (YgglMainEmp m : ygglMainEmps) {
if (m.getHeadUrl() == null) {
m.setHeadUrl("");
}
loginerChargeDtos.add(new LoginerChargeDto(m.getEmpNum(), m.getName(), m.getHeadUrl()));
loginerChargeDtos.add(new LoginerChargeDto(m.getEmpNum(),m.getName(),m.getHeadUrl()));
}
Collections.reverse(loginerChargeDtos);
return ResultUtil.data(loginerChargeDtos, "获取上级部门的部门id");
}
// 根据传来的empNum获取该人员信息,没有则传全部
public List<YgglMainEmp> empNumsConfirm(Integer orgCode, List<Integer> empNumList) {
List<YgglMainEmp> all = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.eq(YgglMainEmp::getOrgCode, orgCode).list();
//根据传来的empNum获取该人员信息,没有则传全部
public List<YgglMainEmp> empNumsConfirm(Integer orgCode,List<Integer> empNumList) {
List<YgglMainEmp> all = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper).eq(YgglMainEmp::getOrgCode, orgCode).list();
List<YgglMainEmp> ygglMainEmps = new ArrayList<YgglMainEmp>();
if (empNumList.size() != 0) {
if (empNumList.size()!=0) {
for (Integer empNum : empNumList) {
all.stream().filter(item -> empNum.equals(item.getEmpNum())).forEach(action -> {
all.stream().filter(item -> empNum.equals(item.getEmpNum())).forEach(action ->{
ygglMainEmps.add(action);
});
}
} else {
}else {
ygglMainEmps.addAll(all);
}
return ygglMainEmps;
}
// 根据传来的empNum获取该人员信息
public YgglMainEmp empNumConfirm(Integer orgCode, Integer empNum) {
YgglMainEmp one = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum).one();
//根据传来的empNum获取该人员信息
public YgglMainEmp empNumConfirm(Integer orgCode,Integer empNum) {
YgglMainEmp one = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper).eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum).one();
return one;
}
/**
* 获取用户头像
*
......@@ -229,13 +229,11 @@ public class YgglController {
@ApiOperation(value = "获取用户头像", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 70)
public Result<List<YgglMainEmp>> headphotos(@CurrentUser UserBean userBean, @RequestBody List<Integer> empNumList) {
if (empNumList.size() == 0) {
if (empNumList.size()==0) {
return ResultUtil.error("请输入empNum数组");
}
List<YgglMainEmp> yglList = YgglMainEmp.builder().build()
.selectList(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
.in(YgglMainEmp::getEmpNum, empNumList)
.select(YgglMainEmp::getEmpNum, YgglMainEmp::getName, YgglMainEmp::getHeadUrl));
List<YgglMainEmp> yglList = YgglMainEmp.builder().build().selectList(new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).in(YgglMainEmp::getEmpNum, empNumList).select(YgglMainEmp::getEmpNum,YgglMainEmp::getName,YgglMainEmp::getHeadUrl));
for (YgglMainEmp yg : yglList) {
if (StringUtil.isEmpty(yg.getHeadUrl())) {
yg.setHeadUrl("");
......@@ -243,7 +241,6 @@ public class YgglController {
}
return ResultUtil.data(yglList, "获取用户头像组成功");
}
/**
* 获取员工档案
*
......@@ -359,13 +356,9 @@ public class YgglController {
.build();
ygglMainEmp.insert();
if(addygdaDto.getBmgwId() != null) {
new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.set(addygdaDto.getBmgwId() != null, YgglMainEmp::getBmgwId, addygdaDto.getBmgwId())
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getId, ygglMainEmp.getId()).update();
}
return ResultUtil.data(ygglMainEmp, "新添加员工档案成功!");
} else {
......@@ -428,6 +421,7 @@ public class YgglController {
.eq(ZzglBmgwM::getOrgCode, orgCode).list();
ZzglBmgwM.getDepts(bList, b, zzglBmgwMs);
Integer j = ygQueryDto.getJobStatus();
Integer t = ygQueryDto.getJobType();
String q = ygQueryDto.getQuery();
......@@ -436,11 +430,9 @@ public class YgglController {
ygQueryDto.getTotalPage() == null ? 10 : ygQueryDto.getTotalPage());
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.select("name", "emp_num", "bmgw_id", "rz_time", "job_type", "phone", "job_status")
.ne("job_status", YgEnumInterface.jobStatus.YILIZHI.getType())
.eq("org_code", orgCode)
.eq(t != null && t > -1, "job_type", t).eq(j != null && j > -1, "job_status", j)
.in(!bList.isEmpty(), "bmgw_id", bList)
.and(!StrUtil.hasBlank(q), wq -> wq.like("name", q).or().like("phone", q));
.ne("job_status", YgEnumInterface.jobStatus.YILIZHI.getType()).eq("org_code", orgCode).eq(t != null && t > -1, "job_type", t)
.eq(j != null && j > -1, "job_status", j).in(!bList.isEmpty(), "bmgw_id", bList)
.and(!StrUtil.hasBlank(q), wq -> wq.like("name", q).or().like("phone", q)).orderByDesc("rz_time");
// List<YgglMainEmp> lo = YgglMainEmp.builder().build().selectList(queryWrapper);
IPage<YgglMainEmp> ygglMainEmpPage = YgglMainEmp.builder().build().selectPage(page, queryWrapper);
......@@ -771,9 +763,10 @@ public class YgglController {
// 浴池,洗去选填项字节大于100的选项
public boolean takeshower(String[] bathroom) {
for (String b : bathroom) {
if (b.length() > 100) {
if (b!=null&& b.length() > 100) {
return false;
}
}
return true;
}
......@@ -1509,8 +1502,8 @@ public class YgglController {
UpdateWrapper<YgglMainLzb> updateWrapper1 = new UpdateWrapper<YgglMainLzb>();
updateWrapper1.eq("emp_num", lzygQueryDto.getEmpNum());
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(3).build().update(updateWrapper);
YgglMainLzb.builder().jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).lzTime(lzygQueryDto.getLzTime())
.lzyy(lzygQueryDto.getLzyy()).lzbz(lzygQueryDto.getLzbz()).build().update(updateWrapper1);
YgglMainLzb.builder().jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).lzTime(lzygQueryDto.getLzTime()).lzyy(lzygQueryDto.getLzyy())
.lzbz(lzygQueryDto.getLzbz()).build().update(updateWrapper1);
// 删除员工表
// ygglMainEmp.deleteById();
// 删除员工登陆表
......@@ -1535,10 +1528,9 @@ public class YgglController {
updateWrapper.eq("emp_num", lzygQueryDto.getEmpNum());
UpdateWrapper<YgglMainLzb> updateWrapper1 = new UpdateWrapper<YgglMainLzb>();
updateWrapper1.eq("emp_num", lzygQueryDto.getEmpNum());
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType())
.build().update(updateWrapper);
YgglMainLzb.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType())
.sjlzTime(new Date()).build().update(updateWrapper1);
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).build().update(updateWrapper);
YgglMainLzb.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).sjlzTime(new Date()).build()
.update(updateWrapper1);
// 查询该员工的关联表
QueryWrapper<QyzxEmpEntAsso> queryWrapper1 = new QueryWrapper<QyzxEmpEntAsso>();
queryWrapper1.eq("emp_num", lzygQueryDto.getEmpNum());
......@@ -1632,23 +1624,24 @@ public class YgglController {
@ApiOperationSupport(order = 60)
public Result<List<YgjgDto>> selectjgs(@CurrentUser UserBean userBean) {
List<YgjgDto> oldfather = new ArrayList<YgjgDto>();// 老父亲
List<YgjgDto> oldfather = new ArrayList<YgjgDto>();//老父亲
List<YgProDto> pro = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper).list();// super继承人
List<YgProDto> pro = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper).list();//super继承人
List<YgCityDto> city = new LambdaQueryChainWrapper<YgCityDto>(ygCityDtoMapper).list();
List<YgAreaDto> area = new LambdaQueryChainWrapper<YgAreaDto>(ygAreaDtoMapper).list();
for (YgProDto p : pro) {
Map<String, Object> map = BeanUtil.beanToMap(p);
// 设置别名对应bean
//设置别名对应bean
HashMap<String, String> mapping = CollUtil.newHashMap();
mapping.put("id", "jgid");
mapping.put("name", "jgname");
YgjgDto ygproDto = BeanUtil.mapToBean(map, YgjgDto.class, CopyOptions.create().setFieldMapping(mapping));
// 添加cityList
// 给一个upid
List<YgCityDto> outcity = uptocityList(city, ygproDto.getJgid());
// 新建一个篮子
YgjgDto ygproDto = BeanUtil.mapToBean(map, YgjgDto.class,CopyOptions.create().setFieldMapping(mapping));
//添加cityList
//给一个upid
List<YgCityDto> outcity= uptocityList(city, ygproDto.getJgid());
//新建一个篮子
List<YgjgDto> cityDtos = new ArrayList<YgjgDto>();
for (YgCityDto c : outcity) {
Map<String, Object> map2 = BeanUtil.beanToMap(c);
......@@ -1656,9 +1649,8 @@ public class YgglController {
mapping2.put("id", "jgid");
mapping2.put("name", "jgname");
mapping2.put("province", "upid");
YgjgDto ygcityDto = BeanUtil.mapToBean(map2, YgjgDto.class,
CopyOptions.create().setFieldMapping(mapping2));
// 把果实收起来
YgjgDto ygcityDto = BeanUtil.mapToBean(map2, YgjgDto.class,CopyOptions.create().setFieldMapping(mapping2));
//把果实收起来
cityDtos.add(ygcityDto);
List<YgAreaDto> outarea = uptoareaList(area, ygcityDto.getJgid());
......@@ -1669,8 +1661,7 @@ public class YgglController {
mapping3.put("id", "jgid");
mapping3.put("name", "jgname");
mapping3.put("city", "upid");
YgjgDto ygjgDto3 = BeanUtil.mapToBean(map3, YgjgDto.class,
CopyOptions.create().setFieldMapping(mapping3));
YgjgDto ygjgDto3 = BeanUtil.mapToBean(map3, YgjgDto.class,CopyOptions.create().setFieldMapping(mapping3));
areaDtos.add(ygjgDto3);
}
......@@ -1684,8 +1675,7 @@ public class YgglController {
return ResultUtil.data(oldfather, "老父亲出来了");
}
// 根据上级id抽取出list
//根据上级id抽取出list
public List<YgCityDto> uptocityList(List<YgCityDto> city, Integer jgid) {
List<YgCityDto> outcity = new ArrayList<YgCityDto>();
for (YgCityDto c : city) {
......@@ -1696,7 +1686,6 @@ public class YgglController {
city.removeAll(outcity);
return outcity;
}
public List<YgAreaDto> uptoareaList(List<YgAreaDto> area, Integer jgid) {
List<YgAreaDto> outarea = new ArrayList<YgAreaDto>();
for (YgAreaDto a : area) {
......@@ -1708,16 +1697,17 @@ public class YgglController {
return outarea;
}
/**
* 展示籍贯/展示所有籍贯(威力增强版)
*
* @param
* @return
*/
@PostMapping(value = "/jgshow")
@PostMapping(value = "/jgshow/{jgid}")
@ApiOperation(value = "展示籍贯所有省市区威力增强版", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 388)
public Result<Map<String, String>> selectjgs1(@CurrentUser UserBean userBean, @RequestBody String jgid) {
public Result<Map<String, String>> selectjgs1(@CurrentUser UserBean userBean, @PathVariable String jgid) {
// public Result<List<YgjgDto>> selectjgs1(@CurrentUser UserBean userBean,
// @RequestBody YgjgDto ygjgDto) {
Integer upId = Integer.valueOf(jgid);
......@@ -1744,6 +1734,7 @@ public class YgglController {
return ResultUtil.data(maps, "展示籍贯成功");
}
/**
* 查询员工列表
*
......@@ -1789,9 +1780,7 @@ public class YgglController {
List<YgglCartogramDto> ygglCartogramDto11 = ygglMainEmpMapper.queryWorkingAge(userBean);
map.put("positive", ygglCartogramDto1.getPositive());
if (ygglCartogramDto2 != null) {
map.put("avgAge", ygglCartogramDto2.getAvgAge());
}
map.put("induction", ygglCartogramDto3.getInduction());
map.put("probation", ygglCartogramDto4.getProbation());
map.put("regular", ygglCartogramDto4.getRegular());
......@@ -1868,8 +1857,7 @@ public class YgglController {
ageList.add(new YgKVDto(entry.getKey().toString(), entry.getValue().toString()));
}
// 在职
Integer zaizhi = jobStatus.get(YgEnumInterface.jobStatus.ZHENSHI.getType()).intValue()
+ jobStatus.get(YgEnumInterface.jobStatus.SHIYONG.getType()).intValue();
Integer zaizhi = jobStatus.get(YgEnumInterface.jobStatus.ZHENSHI.getType()).intValue() + jobStatus.get(YgEnumInterface.jobStatus.SHIYONG.getType()).intValue();
// 本月新入职
Integer xinruzhi = workage.get("本月新入职").intValue();
// 本月离职
......
package cn.timer.api.controller.zzgl;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.transaction.Transactional;
......@@ -21,12 +23,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.hutool.core.collection.ListUtil;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglAuth;
import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dao.zzgl.ZzglLogDgjlMapper;
import cn.timer.api.dto.zzgl.LogDgjlsDto;
......@@ -49,6 +52,9 @@ public class ZzglController {
@Autowired
ZzglLogDgjlMapper zzglLogDgjlMapper;
@Autowired
YgglMainEmpMapper ygglMainEmpMapper;
/**
* 架构树/架构图/导出
*
......@@ -64,6 +70,15 @@ public class ZzglController {
return ResultUtil.data(zzglBmgwMs);
}
@GetMapping(value = "/depts")
@ApiOperation(value = "只获取部门", httpMethod = "GET", notes = "接口发布说明")
public Result<List<ZzglBmgwM>> selectdepts(@CurrentUser UserBean userBean) {
Integer orgCode = userBean.getOrgCode();
List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getOrgCode, orgCode).eq(ZzglBmgwM::getType, 0).list();//0:部门;1:岗位
return ResultUtil.data(zzglBmgwMs);
}
/**
* 岗位成员
*
......@@ -161,6 +176,8 @@ public class ZzglController {
@PostMapping(value = "/dept")
@ApiOperation(value = "添加/修改部门", httpMethod = "POST", notes = "接口发布说明")
public Result<ZzglBmgwM> adddept(@CurrentUser UserBean userBean, @RequestBody ZzglBmgwM zzglBmgwM) {
if (zzglBmgwM.getName().trim().length()==0)
return ResultUtil.error("部门岗位名称不能为空");
Boolean a = zzglBmgwM.getId() == null;
if (a && zzglBmgwM.getType() == null)
zzglBmgwM.setType((Integer) 0);
......@@ -171,6 +188,38 @@ public class ZzglController {
return ResultUtil.success();
}
//根据传来的empNum获取该人员的岗位,以及上面所有的部门id,返回integer数组
public List<Integer> empNumupdept(Integer orgCode,Integer empNum) {
Set<Integer> lanzi = new HashSet<Integer>();
//所有部门岗位
List<ZzglBmgwM> bmgws = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).eq(ZzglBmgwM::getOrgCode, orgCode).list();
//个人岗位
YgglMainEmp one = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.select(YgglMainEmp::getBmgwId)
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum).one();
Integer getId = one.getBmgwId();
Set<Integer> all = empNumupdept2(lanzi, bmgws, getId);
return ListUtil.toList(all);
}
//遍历
public Set<Integer> empNumupdept2(Set<Integer> lanzi,List<ZzglBmgwM> bmgws,Integer getId) {
for (ZzglBmgwM z : bmgws) {
if (getId.equals(z.getId())) {
lanzi.add(getId);
if (z.getUpId()==null || z.getUpId() == 0) {
return lanzi;
}
getId = z.getUpId();
empNumupdept2(lanzi, bmgws, getId);
}
}
return lanzi;
}
/**
* 删除部门岗位
*
......
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