YgglController.java 68.8 KB
Newer Older
tangzhaoqian committed
1 2 3 4 5 6 7
/**
 * @date 2019年11月15日  
 * @author 翁东州
 * @方法中文名称:
 */
package cn.timer.api.controller.yggl;

8
import java.io.IOException;
tangzhaoqian committed
9 10 11 12 13 14 15 16 17
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;

18 19
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
tangzhaoqian committed
20 21 22
import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
23
import org.springframework.beans.factory.annotation.Value;
tangzhaoqian committed
24
import org.springframework.transaction.interceptor.TransactionAspectSupport;
25
import org.springframework.validation.annotation.Validated;
tangzhaoqian committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
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;
44
import cn.hutool.core.collection.CollUtil;
tangzhaoqian committed
45 46
import cn.hutool.core.date.BetweenFormater.Level;
import cn.hutool.core.date.DateUtil;
47
import cn.hutool.core.io.IoUtil;
tangzhaoqian committed
48 49 50
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNodeConfig;
import cn.hutool.core.lang.tree.TreeUtil;
51
import cn.hutool.core.util.IdcardUtil;
52
import cn.hutool.core.util.ObjectUtil;
53
import cn.hutool.core.util.ReUtil;
tangzhaoqian committed
54
import cn.hutool.core.util.StrUtil;
55
import cn.hutool.json.JSONObject;
tangzhaoqian committed
56
import cn.hutool.json.JSONUtil;
57 58
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
tangzhaoqian committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
import cn.timer.api.bean.clazz.CommonArea;
import cn.timer.api.bean.clazz.SysRegion;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.yggl.YgglAttaClfjb;
import cn.timer.api.bean.yggl.YgglAttaCzjlb;
import cn.timer.api.bean.yggl.YgglAttaGzjlb;
import cn.timer.api.bean.yggl.YgglAttaGzk;
import cn.timer.api.bean.yggl.YgglAttaHtxxb;
import cn.timer.api.bean.yggl.YgglAttaJjlxr;
import cn.timer.api.bean.yggl.YgglAttaJyjlb;
import cn.timer.api.bean.yggl.YgglAttaLxxxb;
import cn.timer.api.bean.yggl.YgglAttaPxjlxxb;
import cn.timer.api.bean.yggl.YgglAttaSbgjj;
import cn.timer.api.bean.yggl.YgglAttaZcxxb;
import cn.timer.api.bean.yggl.YgglAttaZszjb;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.yggl.YgglMainLzb;
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.config.enuminterface.YgEnumInterface;
81
import cn.timer.api.config.enuminterface.YgEnumInterface.jobStatus;
tangzhaoqian committed
82
import cn.timer.api.config.enums.CommonEnum;
83
import cn.timer.api.config.enums.SysRoleType;
84
import cn.timer.api.config.exception.Regular;
85
import cn.timer.api.config.validation.ValidList;
tangzhaoqian committed
86
import cn.timer.api.dao.clazz.CommonAreaMapper;
87
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
tangzhaoqian committed
88 89 90 91 92 93
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.yggl.YgMzDtoMapper;
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;
94
import cn.timer.api.dto.yggl.ImportEmpDto;
tangzhaoqian committed
95 96 97 98 99 100 101 102 103 104 105
import cn.timer.api.dto.yggl.LoginInfoDto;
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.YgCartogramDto;
import cn.timer.api.dto.yggl.YgKVDto;
import cn.timer.api.dto.yggl.YgQueryDto;
import cn.timer.api.dto.yggl.YgbintuDto;
import cn.timer.api.dto.yggl.YgglCartogramDto;
import cn.timer.api.dto.yggl.YgmzDto;
import cn.timer.api.dto.yggl.YgzzDto;
106
import cn.timer.api.utils.DateFormatUtils;
tangzhaoqian committed
107 108 109 110 111 112 113 114 115 116 117 118 119
import cn.timer.api.utils.Md5;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * @date 2019年11月15日
 * @author 翁东州
 * @方法中文名称:
 */
@Api(tags = "3.员工管理")
@RestController
120
@Transactional(rollbackOn = Exception.class)
tangzhaoqian committed
121 122 123
@RequestMapping(value = "/yggl", produces = { "application/json" })
public class YgglController {

124 125
	@Value(value = "${config-8timer.init-password}")
	private String pwd;
126

tangzhaoqian committed
127 128
	@Autowired
	private YgglMainEmpMapper ygglMainEmpMapper;
129 130 131
	
	@Autowired
	private QyzxEmpEntAssoMapper qyzxEmpEntAssoMapper;
tangzhaoqian committed
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152

	@Autowired
	private QyzxEmpLoginMapper qyzxEmpLoginMapper;

	@Autowired
	private YgglMainLzbMapper ygglMainLzbMapper;

	@Autowired
	private ZzglBmgwMMapper zzglBmgwMMapper;

	// weng(民族)
	@Autowired
	private YgMzDtoMapper ygMzDtoMapper;

	/**
	 * 获取员工档案
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/ygda")
153
	@ApiOperation(value = "1.获取员工档案", httpMethod = "GET", notes = "接口发布说明")
tangzhaoqian committed
154 155 156 157
	@ApiOperationSupport(order = 1)
	public Result<YgglMainEmp> selectygda(@CurrentUser UserBean userBean) {
		Integer empNum = userBean.getEmpNum();
		Integer orgCode = userBean.getOrgCode();
158 159 160
		YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
				.eq(YgglMainEmp::getOrgCode, orgCode)
				.eq(YgglMainEmp::getEmpNum, empNum));
tangzhaoqian committed
161 162 163 164
		Date rz = ygglMainEmp.getRzTime();
		if (rz != null) {
			ygglMainEmp.setWorkTime(DateUtil.formatBetween(rz, new Date(), Level.DAY));
		}
165
		return ResultUtil.data(ygglMainEmp);
tangzhaoqian committed
166 167 168 169
	}

	// 获取员工档案
	@GetMapping(value = "/ygda/{empNum}")
170
	@ApiOperation(value = "2.获取员工档案(管)", httpMethod = "GET", notes = "接口发布说明")
tangzhaoqian committed
171 172 173
	@ApiOperationSupport(order = 2)
	public Result<YgglMainEmp> selectygda(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		Integer orgCode = userBean.getOrgCode();
174 175 176
		YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
				.eq(YgglMainEmp::getOrgCode, orgCode)
				.eq(YgglMainEmp::getEmpNum, empNum));
tangzhaoqian committed
177 178 179 180
		Date rz = ygglMainEmp.getRzTime();
		if (rz != null) {
			ygglMainEmp.setWorkTime(DateUtil.formatBetween(ygglMainEmp.getRzTime(), new Date(), Level.DAY));
		}
181
		return ResultUtil.data(ygglMainEmp);
tangzhaoqian committed
182 183 184 185 186 187 188 189 190
	}

	/**
	 * 根据岗位id获取员工档案部门岗位名称
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/ygdabm/{gwid}")
191
	@ApiOperation(value = "3.获取员工档案部门岗位名称", httpMethod = "GET", notes = "接口发布说明")
tangzhaoqian committed
192 193 194
	@ApiOperationSupport(order = 3)
	public Result<String> selectbmgw(@CurrentUser UserBean userBean, @PathVariable Integer gwid) {
		if (gwid == null || gwid == 0) {
195
			return ResultUtil.data("岗位不存在");
tangzhaoqian committed
196 197
		}
		Integer orgCode = userBean.getOrgCode();
198 199 200
		ZzglBmgwM zzglBmgwM = ZzglBmgwM.builder().build().selectOne(new QueryWrapper<ZzglBmgwM>().lambda()
				.eq(ZzglBmgwM::getOrgCode, orgCode)
				.eq(ZzglBmgwM::getId, gwid));
tangzhaoqian committed
201 202 203 204 205 206 207
		String gw = null;
		Integer bmid = null;
		if (zzglBmgwM != null) {
			gw = zzglBmgwM.getName();
			bmid = zzglBmgwM.getUpId();
		}
		ZzglBmgwM z = ZzglBmgwM.builder().build()
208 209 210
				.selectOne(new QueryWrapper<ZzglBmgwM>().lambda()
						.eq(ZzglBmgwM::getOrgCode, orgCode)
						.eq(ZzglBmgwM::getId, bmid));
tangzhaoqian committed
211 212 213 214 215
		String bm = null;
		if (z != null) {
			bm = z.getName();
		}
		String bmgw = bm + "/" + gw;
216
		return ResultUtil.data(bmgw);
tangzhaoqian committed
217 218 219
	}

	/**
220
	 * 添加员工档案
221
	 * 
222 223
	 * @param userBean
	 * @param addygdaDto
tangzhaoqian committed
224 225 226
	 * @return
	 */
	@PostMapping(value = "/addygda")
227
	@ApiOperation(value = "4.添加员工档案", httpMethod = "POST", notes = "接口发布说明")
tangzhaoqian committed
228
	@ApiOperationSupport(order = 4)
229
	public Result<Object> addygda(@CurrentUser UserBean userBean, @Validated @RequestBody AddygdaDto addygdaDto) throws Exception {
tangzhaoqian committed
230 231 232 233 234
		Integer orgCode = userBean.getOrgCode();
		String name = addygdaDto.getName();
		String phone = addygdaDto.getPhone();
		Integer zjType = addygdaDto.getZjType();
		String zjNum = addygdaDto.getZjNum();
235 236 237
		boolean isvalid = true;
		switch (zjType) {
		case 0:
238
			isvalid = IdcardUtil.isValidCard15(zjNum) || IdcardUtil.isValidCard18(zjNum);
239 240
			break;
		case 1:
241 242
			String[] strs = IdcardUtil.isValidCard10(zjNum);
			isvalid = "澳门/香港".contains(strs[0]) && "true".equals(strs[2]);
243 244
			break;
		case 2:
245
			isvalid = IdcardUtil.isValidTWCard(zjNum);
246 247 248 249 250 251 252 253 254 255 256
			break;
		case 3:
			isvalid = ReUtil.isMatch(Regular.PASSPORT1, zjNum) || ReUtil.isMatch(Regular.PASSPORT2, zjNum);
			break;
		default:
			break;
		}
		if (!isvalid) {
			return ResultUtil.error("证件格式不对!");
		}
		
tangzhaoqian committed
257
		Integer jobType = addygdaDto.getJobType();
258
		Date rzTime = addygdaDto.getRzTime() == null ? new Date() : addygdaDto.getRzTime();
tangzhaoqian committed
259 260
		Integer syq = addygdaDto.getSyq();
		Integer sex = addygdaDto.getSex();
261
		Integer bmgwId = addygdaDto.getBmgwId();
262

tangzhaoqian committed
263 264 265
		QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
				.eq(!StrUtil.hasBlank(phone), QyzxEmpLogin::getPhone, phone).one();
		if (login == null) {
266
			// 初始化密码 pwd
267
			QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(phone).pw(Md5.md5(pwd))
tangzhaoqian committed
268 269 270 271 272
					.sts(CommonEnum.U_STS_ON.getType()).orgId(userBean.getOrgCode()).username(name).build();
			if (!qyzxEmpLogin.insert()) {
				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
				return ResultUtil.error("添加员工登录表失败,请检查输入信息");
			}
273 274 275 276 277 278 279
		}
			
		YgglMainEmp ygglMainEmp = ygglMainEmpMapper.selectOne(new QueryWrapper<YgglMainEmp>().lambda()
				.eq(YgglMainEmp::getPhone, phone).eq(YgglMainEmp::getOrgCode, orgCode));

		if (ygglMainEmp == null) {
			QyzxEmpEntAsso.builder()
280
				.empNum(login.getId()).orgCode(orgCode).userType(SysRoleType.U_TYPE_EMP.getType()).status(CommonEnum.U_STS_ON.getType())
281 282 283 284 285 286 287
				.build()
				.insert();
			ygglMainEmp = YgglMainEmp.builder()
					.name(name).phone(phone).zjType(zjType).zjNum(zjNum).jobType(jobType)
					.jobStatus(YgEnumInterface.jobStatus.SHIYONG.getType()).rzTime(rzTime)
					.syq(syq).sex(sex).empNum(login.getId()).orgCode(orgCode).bmgwId(bmgwId)
					.build();
tangzhaoqian committed
288 289
			ygglMainEmp.insert();

290
			return ResultUtil.data(ygglMainEmp, "添加员工成功!");
tangzhaoqian committed
291
		} else {
292
			return ResultUtil.error("该手机号已被使用,请输入正确手机号");
tangzhaoqian committed
293
		}
294
		
tangzhaoqian committed
295 296 297 298 299 300 301 302 303
	}

	/**
	 * 修改员工档案
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/updateygda")
304
	@ApiOperation(value = "5.修改员工档案", httpMethod = "POST", notes = "接口发布说明")
tangzhaoqian committed
305 306 307 308
	@ApiOperationSupport(order = 5)
	public Result<Object> updateygda(@CurrentUser UserBean userBean, @RequestBody YgglMainEmp ygglMainEmp)
			throws Exception {

309 310 311 312 313
		if (ObjectUtil.isAllNotEmpty(ygglMainEmp.getRzTime(),ygglMainEmp.getZzTime()) && 
			!DateFormatUtils.getCompareDate(ygglMainEmp.getRzTime(), ygglMainEmp.getZzTime())) {
			ResultUtil.error("入职日期 不可以大于 转正日期");
		}
		
tangzhaoqian committed
314
		if (ygglMainEmp.getEmpNum() != null) {
315 316 317 318
			
			ygglMainEmp.update(new UpdateWrapper<YgglMainEmp>().lambda()
					.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
					.eq(YgglMainEmp::getEmpNum, ygglMainEmp.getEmpNum()));
tangzhaoqian committed
319 320 321

			return ResultUtil.data(ygglMainEmp, "修改成功");
		}
322
		return ResultUtil.data(ygglMainEmp, "修改成功");
tangzhaoqian committed
323
	}
324 325
	
	
tangzhaoqian committed
326 327 328 329 330 331 332 333

	/**
	 * 员工搜索
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/ygquery")
334
	@ApiOperation(value = "6.员工搜索/分页", httpMethod = "POST", notes = "接口发布说明")
tangzhaoqian committed
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
	@ApiOperationSupport(order = 6)
	public Result<Object> ygquery(@CurrentUser UserBean userBean, @RequestBody YgQueryDto ygQueryDto) {
		Integer orgCode = userBean.getOrgCode();
		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 t = ygQueryDto.getJobType();
		String q = ygQueryDto.getQuery();
		Page<YgglMainEmp> page = new Page<YgglMainEmp>(
				ygQueryDto.getCurrentPage() == null ? 1 : ygQueryDto.getCurrentPage(),
				ygQueryDto.getTotalPage() == null ? 10 : ygQueryDto.getTotalPage());
		QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
351 352 353 354 355 356
		queryWrapper.lambda()
		.select(YgglMainEmp::getName, YgglMainEmp::getEmpNum, YgglMainEmp::getBmgwId, YgglMainEmp::getRzTime, YgglMainEmp::getJobType, YgglMainEmp::getPhone, YgglMainEmp::getJobStatus)
				.ne(YgglMainEmp::getJobStatus, YgEnumInterface.jobStatus.YILIZHI.getType()).eq(YgglMainEmp::getOrgCode, orgCode)
				.eq(t != null && t > -1, YgglMainEmp::getJobType, t).eq(j != null && j > -1, YgglMainEmp::getJobStatus, j)
				.in(!bList.isEmpty(), YgglMainEmp::getBmgwId, bList)
				.and(!StrUtil.hasBlank(q), wq -> wq.like(YgglMainEmp::getName, q).or().like(YgglMainEmp::getPhone, q));
tangzhaoqian committed
357 358 359 360

//		List<YgglMainEmp> lo = YgglMainEmp.builder().build().selectList(queryWrapper);
		IPage<YgglMainEmp> ygglMainEmpPage = YgglMainEmp.builder().build().selectPage(page, queryWrapper);
		// List<YgglMainEmp> ygglMainEmps = ygglMainEmpPage.getRecords();
361
		return ResultUtil.data(ygglMainEmpPage);
tangzhaoqian committed
362 363
		// return ResultUtil.data(ygglMainEmpPage, ygglMainEmps, "员工搜索成功");
	}
364

tangzhaoqian committed
365 366 367 368
	/**
	 * 导入员工档案
	 */
	@PostMapping(value = "/import_emp_record")
369
	@ApiOperation(value = "7.导入员工档案", httpMethod = "POST", notes = "接口发布说明")
tangzhaoqian committed
370
	@ApiOperationSupport(order = 7)
371 372
	public Result<JSONObject> importEmpRecord(
			@CurrentUser UserBean userBean ,@Validated @RequestBody ValidList<AddygdaDto> listAddygdaDto ) throws Exception {
373

374 375 376 377 378 379 380 381 382 383 384 385 386
		Integer orgCode = userBean.getOrgCode();
		// 查询所有员工手机号
//		List<QyzxEmpLogin> listEl = qyzxEmpLoginMapper
//				.selectList(new QueryWrapper<QyzxEmpLogin>().lambda()
//						.select(QyzxEmpLogin::getPhone));
		
		List<YgglMainEmp> listMe = ygglMainEmpMapper
				.selectList(new QueryWrapper<YgglMainEmp>().lambda()
						.eq(YgglMainEmp::getOrgCode, orgCode)
						.select(YgglMainEmp::getPhone,YgglMainEmp::getZjNum));
		
		
		listMe = listMe != null ? listMe.stream()
387 388 389
				.filter(o -> o != null && o.getPhone() != null).collect(Collectors.toList()) : null;

		// 抽取 登录表 的phone的集合
390 391 392 393 394 395
		List<String> listPhone = listMe.stream().map(YgglMainEmp::getPhone).collect(Collectors.toList());
		// 抽取 登录表 的zjNum的集合
		List<String> listzjNum = listMe.stream().map(YgglMainEmp::getZjNum).collect(Collectors.toList());
		
		List<YgglMainEmp> listYmp = new ArrayList<YgglMainEmp>();
		
396
		// 过滤掉 导入数据中, listPhone已存在 的 phone 的对象集合
397 398
		List<AddygdaDto> list = listAddygdaDto.stream()
		.filter(o -> o != null && !listPhone.contains(o.getPhone()) && !listzjNum.contains(o.getZjNum())).collect(Collectors.toList());
399 400
		
		// 过滤出 导入数据中, listPhone已存在 的 phone 的对象集合
401 402
		List<AddygdaDto> phoneRepetitions = listAddygdaDto.stream()
				.filter(o -> o != null && listPhone.contains(o.getPhone())).collect(Collectors.toList());
403 404
		
		// 过滤出 导入数据中, listzjNum 已存在 的 ZjNum 的对象集合
405
		List<AddygdaDto> idCardRepetitions = listAddygdaDto.stream()
406
				.filter(o -> o != null && listzjNum.contains(o.getZjNum())).collect(Collectors.toList());
407 408
		
		List<YgglMainEmp> insertErrors = new ArrayList<YgglMainEmp>();
409 410 411 412 413 414 415 416 417 418 419
		
		YgglMainEmp yme;
		for (AddygdaDto ad : list) {
			
			String name = ad.getName();
			String phone = ad.getPhone();
			Integer zjType = ad.getZjType();
			String zjNum = ad.getZjNum();
			boolean isvalid = true;
			switch (zjType) {
			case 0:
420
				isvalid = IdcardUtil.isValidCard15(zjNum) || IdcardUtil.isValidCard18(zjNum);
421 422
				break;
			case 1:
423 424
				String[] strs = IdcardUtil.isValidCard10(zjNum);
				isvalid = "澳门/香港".contains(strs[0]) && "true".equals(strs[2]);
425 426
				break;
			case 2:
427
				isvalid = IdcardUtil.isValidTWCard(zjNum);
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454
				break;
			case 3:
				isvalid = ReUtil.isMatch(Regular.PASSPORT1, zjNum) || ReUtil.isMatch(Regular.PASSPORT2, zjNum);
				break;
			default:
				break;
			}
			if (!isvalid) {
				return ResultUtil.error("证件格式不对!");
			}
			Integer jobType = ad.getJobType();
			Date rzTime = ad.getRzTime() == null ? new Date() : ad.getRzTime();
			Integer syq = ad.getSyq();
			Integer sex = ad.getSex();
			Integer bmgwId = ad.getBmgwId();
	
			QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
					.eq(!StrUtil.hasBlank(phone), QyzxEmpLogin::getPhone, phone).one();
			if (login == null) {
				// 初始化密码 pwd
				login = QyzxEmpLogin.builder().phone(phone).pw(Md5.md5(pwd))
						.sts(CommonEnum.U_STS_ON.getType()).orgId(userBean.getOrgCode()).username(name).build();
				if (!login.insert()) {
					TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
					return ResultUtil.error("添加员工登录表失败,请检查输入信息");
				}
			}
tangzhaoqian committed
455

456
			QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(orgCode)
457
					.userType(SysRoleType.U_TYPE_EMP.getType()).status(CommonEnum.U_STS_ON.getType()).build().insert();// usertype2普通员工 status1正常
458 459 460 461 462
			yme = YgglMainEmp.builder()
					.name(name).phone(phone).zjType(zjType).zjNum(zjNum).jobType(jobType)
					.jobStatus(YgEnumInterface.jobStatus.SHIYONG.getType()).rzTime(rzTime)
					.syq(syq).sex(sex).empNum(login.getId()).orgCode(orgCode).bmgwId(bmgwId)
					.build();
463 464
			if (yme.insert()) {
				listYmp.add(yme);
465
			}else {
466
				// 存放 插入失败的 数据
467
				insertErrors.add(yme);
468 469 470 471 472 473 474
			}
			
		}
		
		JSONObject obj = JSONUtil.createObj();
		obj.set("empList", listYmp);
		obj.set("phoneRepetitions", phoneRepetitions);
475 476
		obj.set("idCardRepetitions", idCardRepetitions);
		obj.set("insertErrors", insertErrors);
477 478 479
		
		//listEl.stream().filter(i -> i != null).collect(Collectors.<QyzxEmpLogin>toList());
		return ResultUtil.data(obj, "导入员工档案成功!");
tangzhaoqian committed
480
	}
481
	
tangzhaoqian committed
482
	/**
483
	 * 获取导入模板
tangzhaoqian committed
484 485 486
	 * 
	 * @param
	 * @return
487
	 * @throws IOException 
tangzhaoqian committed
488
	 */
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540
	@GetMapping(value = "/impoet_template")
	@ApiOperation(value = "8.获取导入模板", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 8)
	public Result<Object> getImpoetTemplate(HttpServletResponse response) throws IOException {
		ImportEmpDto ied = ImportEmpDto.builder()
				.name("张三")
				.phone("15219671123")
				// 证件类型 0:身份证;1:港澳居民来往内地通行证;2:台湾居民来往大陆通行证;3:外国护照;4:其他
				.zjType(0)
				.zjNum("445381199611063586")
				// 工作性质 0全职、1实习生、2兼职、3劳务派遣、4劳务、5派遣、6外包、7退休返聘
				.jobType(0)
				.rzTime("2010-10-10 10:10:10")
				// 试用期 0:无试用期;1:1个月;2:2个月;3:3个月;4:4个月;5:5个月;6:6个月(有试用期显示选项)
				.syq(1)
				// 性别 0:男;1:女
				.sex(0)
				.build();
		List<ImportEmpDto> listAd = CollUtil.newArrayList(ied);
		// 通过工具类创建writer
		ExcelWriter writer = ExcelUtil.getWriter(true);

		//自定义标题别名
		writer.addHeaderAlias("name", "姓名");
		writer.addHeaderAlias("phone", "手机号");
		writer.addHeaderAlias("sex", "性别");
		writer.addHeaderAlias("zjType", "证件类型 0:身份证;1:港澳居民来往内地通行证;2:台湾居民来往大陆通行证;3:外国护照;4:其他");
		writer.addHeaderAlias("zjNum", "证件号");
		writer.addHeaderAlias("jobType", "工作性质 0全职、1实习生、2兼职、3劳务派遣、4劳务、5派遣、6外包、7退休返聘");
		writer.addHeaderAlias("syq", "试用期 0:无试用期;1:1个月;2:2个月;3:3个月;4:4个月;5:5个月;6:6个月(有试用期显示选项)");
		writer.addHeaderAlias("rzTime", "入职日期");
		
		// 合并单元格后的标题行,使用默认标题样式
		writer.merge(7, "员工导入模板");
		writer.setFreezePane(2);
		writer.setColumnWidth(1, 15);
		writer.setColumnWidth(4, 22);
		writer.setColumnWidth(7, 20);
		// 一次性写出内容,使用默认样式,强制输出标题
		writer.write(listAd, true);
		
		response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); 
		response.setHeader("Content-Disposition","attachment;filename=8timer_emp_import.xlsx"); 
		ServletOutputStream out = response.getOutputStream();
		writer.flush(out, true);
		
		// 关闭writer,释放内存
		writer.close();
		//此处记得关闭输出Servlet流
		IoUtil.close(out);
		
		return ResultUtil.data(null, "获取模板成功");
tangzhaoqian committed
541 542 543 544 545 546 547 548 549 550

	}

	/**
	 * 导出员工
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/ygdas")
551 552
	@ApiOperation(value = "9.导出员工", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 9)
tangzhaoqian committed
553 554
	public Result<List<YgglMainEmp>> selectygdas(@CurrentUser UserBean userBean) {
		List<YgglMainEmp> list = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
555
				.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).in(YgglMainEmp::getJobStatus, 1,2,3).list();
tangzhaoqian committed
556 557 558 559 560 561 562 563 564 565
		return ResultUtil.data(list, "导出员工成功");
	}

	/**
	 * 获取员工教育经历表
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/jyjlb")
566 567
	@ApiOperation(value = "10.获取员工教育经历表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 10)
tangzhaoqian committed
568 569
	public Result<List<YgglAttaJyjlb>> selectjyjlb(@CurrentUser UserBean userBean) {
		List<YgglAttaJyjlb> ygglAttaJyjlbss = YgglAttaJyjlb.builder().build()
570 571 572
				.selectList(new QueryWrapper<YgglAttaJyjlb>().lambda()
						.eq(YgglAttaJyjlb::getOrgCode, userBean.getOrgCode())
						.eq(YgglAttaJyjlb::getEmpNum,userBean.getEmpNum()));
573
		return ResultUtil.data(ygglAttaJyjlbss);
tangzhaoqian committed
574 575 576 577
	}

	// 获取员工教育经历表
	@GetMapping(value = "/jyjlb/{empNum}")
578 579
	@ApiOperation(value = "11.获取员工教育经历表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 11)
tangzhaoqian committed
580 581
	public Result<List<YgglAttaJyjlb>> selectjyjlb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaJyjlb> ygglAttaJyjlbs = YgglAttaJyjlb.builder().build().selectList(
582 583 584
				new QueryWrapper<YgglAttaJyjlb>().lambda()
				.eq(YgglAttaJyjlb::getOrgCode, userBean.getOrgCode())
				.eq(YgglAttaJyjlb::getEmpNum, empNum));
585
		return ResultUtil.data(ygglAttaJyjlbs);
tangzhaoqian committed
586 587 588 589 590 591 592 593 594
	}

	/**
	 * 添加/修改员工教育经历表
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/jyjlb")
595 596
	@ApiOperation(value = "12.添加/修改员工教育经历表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 12)
tangzhaoqian committed
597 598 599 600
	public Result<YgglAttaJyjlb> addjyjlb(@CurrentUser UserBean userBean, @RequestBody YgglAttaJyjlb ygglAttaJyjlb) {
		ygglAttaJyjlb.setEmpNum(ygglAttaJyjlb.getEmpNum());
		ygglAttaJyjlb.setOrgCode(userBean.getOrgCode());
		ygglAttaJyjlb.insertOrUpdate();
601
		return ResultUtil.data(ygglAttaJyjlb, "修改员工教育经历表成功");
tangzhaoqian committed
602 603 604 605 606 607 608 609 610
	}

	/**
	 * 删除员工教育经历表
	 * 
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/jyjlb/{id}")
611 612
	@ApiOperation(value = "13.删除员工教育经历表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 13)
tangzhaoqian committed
613 614 615
	public Result<Boolean> deljyjlb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaJyjlb.builder().build()
616 617 618
				.delete(new QueryWrapper<YgglAttaJyjlb>().lambda()
						.eq(YgglAttaJyjlb::getOrgCode, orgCode)
						.eq(YgglAttaJyjlb::getId, id)), "删除员工教育经历表成功");
tangzhaoqian committed
619 620 621 622 623 624 625 626 627
	}

	/**
	 * 获取员工培训经历信息表
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/pxjlxxb")
628 629
	@ApiOperation(value = "14.获取员工培训经历信息表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 14)
tangzhaoqian committed
630 631
	public Result<List<YgglAttaPxjlxxb>> selectpxjlxxb(@CurrentUser UserBean userBean) {
		List<YgglAttaPxjlxxb> ygglAttaPxjlxxbs = YgglAttaPxjlxxb.builder().build()
632 633 634
				.selectList(new QueryWrapper<YgglAttaPxjlxxb>().lambda()
						.eq(YgglAttaPxjlxxb::getOrgCode, userBean.getOrgCode())
						.eq(YgglAttaPxjlxxb::getEmpNum, userBean.getEmpNum()));
635
		return ResultUtil.data(ygglAttaPxjlxxbs);
tangzhaoqian committed
636 637 638 639
	}

	// 获取员工培训经历信息表
	@GetMapping(value = "/pxjlxxb/{empNum}")
640 641
	@ApiOperation(value = "15.获取员工培训经历信息表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 15)
tangzhaoqian committed
642 643
	public Result<List<YgglAttaPxjlxxb>> selectpxjlxxb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaPxjlxxb> ygglAttaPxjlxxbs = YgglAttaPxjlxxb.builder().build().selectList(
644 645 646
				new QueryWrapper<YgglAttaPxjlxxb>().lambda()
				.eq(YgglAttaPxjlxxb::getOrgCode, userBean.getOrgCode())
				.eq(YgglAttaPxjlxxb::getEmpNum, empNum));
647
		return ResultUtil.data(ygglAttaPxjlxxbs);
tangzhaoqian committed
648 649 650 651 652 653 654 655 656
	}

	/**
	 * 添加/修改员工培训经历信息表
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/pxjlxxb")
657 658
	@ApiOperation(value = "16.添加/修改员工培训经历信息表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 16)
tangzhaoqian committed
659 660 661 662 663
	public Result<YgglAttaPxjlxxb> addpxjlxxb(@CurrentUser UserBean userBean,
			@RequestBody YgglAttaPxjlxxb ygglAttaPxjlxxb) {
		ygglAttaPxjlxxb.setEmpNum(ygglAttaPxjlxxb.getEmpNum());
		ygglAttaPxjlxxb.setOrgCode(userBean.getOrgCode());
		ygglAttaPxjlxxb.insertOrUpdate();
664
		return ResultUtil.data(ygglAttaPxjlxxb, "修改员工培训经历信息表成功");
tangzhaoqian committed
665 666 667 668 669 670 671 672 673
	}

	/**
	 * 删除员工培训经历信息表
	 * 
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/pxjlxxb/{id}")
674 675
	@ApiOperation(value = "17.删除员工培训经历信息表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 17)
tangzhaoqian committed
676 677 678
	public Result<Boolean> delpxjlxxb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaPxjlxxb.builder().build()
679 680 681
				.delete(new QueryWrapper<YgglAttaPxjlxxb>().lambda()
						.eq(YgglAttaPxjlxxb::getOrgCode, orgCode)
						.eq(YgglAttaPxjlxxb::getId, id)), "删除员工培训经历信息表成功");
tangzhaoqian committed
682 683 684 685 686 687 688 689 690
	}

	/**
	 * 获取员工工作经历表
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/gzjlb")
691 692
	@ApiOperation(value = "18.获取员工工作经历表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 18)
tangzhaoqian committed
693 694
	public Result<List<YgglAttaGzjlb>> selectgzjlb(@CurrentUser UserBean userBean) {
		List<YgglAttaGzjlb> ygglAttaGzjlbs = YgglAttaGzjlb.builder().build()
695 696 697
				.selectList(new QueryWrapper<YgglAttaGzjlb>().lambda()
						.eq(YgglAttaGzjlb::getOrgCode, userBean.getOrgCode())
						.eq(YgglAttaGzjlb::getEmpNum, userBean.getEmpNum()));
698
		return ResultUtil.data(ygglAttaGzjlbs);
tangzhaoqian committed
699 700 701 702
	}

	// 获取员工工作经历表
	@GetMapping(value = "/gzjlb/{empNum}")
703 704
	@ApiOperation(value = "19.获取员工工作经历表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 19)
tangzhaoqian committed
705 706
	public Result<List<YgglAttaGzjlb>> selectgzjlb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaGzjlb> ygglAttaGzjlbs = YgglAttaGzjlb.builder().build().selectList(
707 708 709
				new QueryWrapper<YgglAttaGzjlb>().lambda()
				.eq(YgglAttaGzjlb::getOrgCode, userBean.getOrgCode())
				.eq(YgglAttaGzjlb::getEmpNum, empNum));
710
		return ResultUtil.data(ygglAttaGzjlbs);
tangzhaoqian committed
711 712 713 714 715 716 717 718 719
	}

	/**
	 * 添加/修改员工工作经历表
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/gzjlb")
720 721
	@ApiOperation(value = "20.添加/修改员工工作经历表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 20)
tangzhaoqian committed
722 723 724 725
	public Result<YgglAttaGzjlb> addgzjlb(@CurrentUser UserBean userBean, @RequestBody YgglAttaGzjlb ygglAttaGzjlb) {
		ygglAttaGzjlb.setEmpNum(ygglAttaGzjlb.getEmpNum());
		ygglAttaGzjlb.setOrgCode(userBean.getOrgCode());
		ygglAttaGzjlb.insertOrUpdate();
726
		return ResultUtil.data(ygglAttaGzjlb, "修改员工工作经历表成功");
tangzhaoqian committed
727 728 729 730 731 732 733 734 735
	}

	/**
	 * 删除员工工作经历表
	 * 
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/gzjlb/{id}")
736 737
	@ApiOperation(value = "21.删除员工工作经历表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 21)
tangzhaoqian committed
738 739 740
	public Result<Boolean> delgzjlb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaGzjlb.builder().build()
741 742 743
				.delete(new QueryWrapper<YgglAttaGzjlb>().lambda()
						.eq(YgglAttaGzjlb::getOrgCode, orgCode)
						.eq(YgglAttaGzjlb::getId, id)), "删除员工工作经历表成功");
tangzhaoqian committed
744 745 746 747 748 749 750 751 752
	}

	/**
	 * 获取员工职称信息表
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/zcxxb")
753 754
	@ApiOperation(value = "22.获取员工职称信息表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 22)
tangzhaoqian committed
755 756
	public Result<List<YgglAttaZcxxb>> selectzcxxb(@CurrentUser UserBean userBean) {
		List<YgglAttaZcxxb> ygglAttaZcxxbs = YgglAttaZcxxb.builder().build()
757 758 759
				.selectList(new QueryWrapper<YgglAttaZcxxb>().lambda()
						.eq(YgglAttaZcxxb::getOrgCode, userBean.getOrgCode())
						.eq(YgglAttaZcxxb::getEmpNum, userBean.getEmpNum()));
760
		return ResultUtil.data(ygglAttaZcxxbs);
tangzhaoqian committed
761 762 763 764
	}

	// 获取员工职称信息表
	@GetMapping(value = "/zcxxb/{empNum}")
765 766
	@ApiOperation(value = "23.获取员工职称信息表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 23)
tangzhaoqian committed
767 768
	public Result<List<YgglAttaZcxxb>> selectzcxxb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaZcxxb> ygglAttaZcxxbs = YgglAttaZcxxb.builder().build().selectList(
769 770 771
				new QueryWrapper<YgglAttaZcxxb>().lambda()
				.eq(YgglAttaZcxxb::getOrgCode, userBean.getOrgCode())
				.eq(YgglAttaZcxxb::getEmpNum, empNum));
772
		return ResultUtil.data(ygglAttaZcxxbs);
tangzhaoqian committed
773 774 775 776 777 778 779 780 781
	}

	/**
	 * 添加/修改员工职称信息表
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/zcxxb")
782 783
	@ApiOperation(value = "24.添加/修改员工职称信息表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 24)
tangzhaoqian committed
784 785 786 787
	public Result<YgglAttaZcxxb> addzcxxb(@CurrentUser UserBean userBean, @RequestBody YgglAttaZcxxb ygglAttaZcxxb) {
		ygglAttaZcxxb.setEmpNum(ygglAttaZcxxb.getEmpNum());
		ygglAttaZcxxb.setOrgCode(userBean.getOrgCode());
		ygglAttaZcxxb.insertOrUpdate();
788
		return ResultUtil.data(ygglAttaZcxxb, "修改员工职称信息表成功");
tangzhaoqian committed
789 790 791 792 793 794 795 796 797
	}

	/**
	 * 删除员工职称信息表
	 * 
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/zcxxb/{id}")
798 799
	@ApiOperation(value = "25.删除员工职称信息表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 25)
tangzhaoqian committed
800 801 802
	public Result<Boolean> delzcxxb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaZcxxb.builder().build()
803 804 805
				.delete(new QueryWrapper<YgglAttaZcxxb>().lambda()
						.eq(YgglAttaZcxxb::getOrgCode, orgCode)
						.eq(YgglAttaZcxxb::getId, id)), "删除员工职称信息表成功");
tangzhaoqian committed
806 807 808 809 810 811 812 813 814
	}

	/**
	 * 获取员工证书证件表
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/zszjb")
815 816
	@ApiOperation(value = "26.获取员工证书证件表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 26)
tangzhaoqian committed
817 818
	public Result<List<YgglAttaZszjb>> selectzszjb(@CurrentUser UserBean userBean) {
		List<YgglAttaZszjb> ygglAttaZszjbs = YgglAttaZszjb.builder().build()
819 820 821
				.selectList(new QueryWrapper<YgglAttaZszjb>().lambda()
						.eq(YgglAttaZszjb::getOrgCode, userBean.getOrgCode())
						.eq(YgglAttaZszjb::getEmpNum,userBean.getEmpNum()));
822
		return ResultUtil.data(ygglAttaZszjbs);
tangzhaoqian committed
823 824 825 826
	}

	// 获取员工证书证件表
	@GetMapping(value = "/zszjb/{empNum}")
827 828
	@ApiOperation(value = "27.获取员工证书证件表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 27)
tangzhaoqian committed
829 830
	public Result<List<YgglAttaZszjb>> selectzszjb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaZszjb> ygglAttaZszjbs = YgglAttaZszjb.builder().build().selectList(
831 832 833
				new QueryWrapper<YgglAttaZszjb>().lambda()
				.eq(YgglAttaZszjb::getOrgCode, userBean.getOrgCode())
				.eq(YgglAttaZszjb::getEmpNum, empNum));
834
		return ResultUtil.data(ygglAttaZszjbs);
tangzhaoqian committed
835 836 837 838 839 840 841 842 843
	}

	/**
	 * 添加/修改员工证书证件表
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/zszjb")
844 845
	@ApiOperation(value = "28.添加/修改员工证书证件表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 28)
tangzhaoqian committed
846 847 848 849
	public Result<YgglAttaZszjb> addzszjb(@CurrentUser UserBean userBean, @RequestBody YgglAttaZszjb ygglAttaZszjb) {
		ygglAttaZszjb.setEmpNum(ygglAttaZszjb.getEmpNum());
		ygglAttaZszjb.setOrgCode(userBean.getOrgCode());
		ygglAttaZszjb.insertOrUpdate();
850
		return ResultUtil.data(ygglAttaZszjb, "修改员工证书证件表成功");
tangzhaoqian committed
851 852 853 854 855 856 857 858 859
	}

	/**
	 * 删除员工证书证件表
	 * 
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/zszjb/{id}")
860 861
	@ApiOperation(value = "29.删除员工证书证件表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 29)
tangzhaoqian committed
862 863 864
	public Result<Boolean> delzszjb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaZszjb.builder().build()
865 866 867
				.delete(new QueryWrapper<YgglAttaZszjb>().lambda()
						.eq(YgglAttaZszjb::getOrgCode, orgCode)
						.eq(YgglAttaZszjb::getId, id)), "删除员工证书证件表成功");
tangzhaoqian committed
868 869 870 871 872 873 874 875 876
	}

	/**
	 * 获取员工联系信息表
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/lxxxb")
877 878
	@ApiOperation(value = "30.获取员工联系信息表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 30)
tangzhaoqian committed
879 880
	public Result<List<YgglAttaLxxxb>> selectlxxxb(@CurrentUser UserBean userBean) {
		List<YgglAttaLxxxb> ygglAttaLxxxbs = YgglAttaLxxxb.builder().build()
881 882 883
				.selectList(new QueryWrapper<YgglAttaLxxxb>().lambda()
						.eq(YgglAttaLxxxb::getOrgCode, userBean.getOrgCode())
						.eq(YgglAttaLxxxb::getEmpNum, userBean.getEmpNum()));
884
		return ResultUtil.data(ygglAttaLxxxbs);
tangzhaoqian committed
885 886 887 888
	}

	// 获取员工联系信息表
	@GetMapping(value = "/lxxxb/{empNum}")
889 890
	@ApiOperation(value = "31.获取员工联系信息表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 31)
tangzhaoqian committed
891 892
	public Result<List<YgglAttaLxxxb>> selectlxxxb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaLxxxb> ygglAttaLxxxbs = YgglAttaLxxxb.builder().build().selectList(
893 894 895
				new QueryWrapper<YgglAttaLxxxb>().lambda()
				.eq(YgglAttaLxxxb::getOrgCode, userBean.getOrgCode())
				.eq(YgglAttaLxxxb::getEmpNum, empNum));
896
		return ResultUtil.data(ygglAttaLxxxbs);
tangzhaoqian committed
897 898 899 900 901 902 903 904 905
	}

	/**
	 * 添加/修改员工联系信息表
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/lxxxb")
906 907
	@ApiOperation(value = "32.添加/修改员工联系信息表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 32)
tangzhaoqian committed
908 909 910 911
	public Result<YgglAttaLxxxb> addlxxxb(@CurrentUser UserBean userBean, @RequestBody YgglAttaLxxxb ygglAttaLxxxb) {
		ygglAttaLxxxb.setEmpNum(ygglAttaLxxxb.getEmpNum());
		ygglAttaLxxxb.setOrgCode(userBean.getOrgCode());
		ygglAttaLxxxb.insertOrUpdate();
912
		return ResultUtil.data(ygglAttaLxxxb, "修改员工联系信息表成功");
tangzhaoqian committed
913 914 915 916 917 918 919 920 921
	}

	/**
	 * 删除员工联系信息表
	 * 
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/lxxxb/{id}")
922 923
	@ApiOperation(value = "33.删除员工联系信息表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 33)
tangzhaoqian committed
924 925 926
	public Result<Boolean> dellxxxb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaLxxxb.builder().build()
927 928 929
				.delete(new QueryWrapper<YgglAttaLxxxb>().lambda()
						.eq(YgglAttaLxxxb::getOrgCode, orgCode)
						.eq(YgglAttaLxxxb::getId, id)), "删除员工联系信息表成功");
tangzhaoqian committed
930 931 932 933 934 935 936 937 938
	}

	/**
	 * 获取员工紧急联系人表
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/jjlxr")
939 940
	@ApiOperation(value = "34.获取员工紧急联系人表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 34)
tangzhaoqian committed
941 942
	public Result<List<YgglAttaJjlxr>> selectjjlxr(@CurrentUser UserBean userBean) {
		List<YgglAttaJjlxr> ygglAttaJjlxrs = YgglAttaJjlxr.builder().build()
943 944 945
				.selectList(new QueryWrapper<YgglAttaJjlxr>().lambda()
						.eq(YgglAttaJjlxr::getOrgCode, userBean.getOrgCode())
						.eq(YgglAttaJjlxr::getEmpNum, userBean.getEmpNum()));
946
		return ResultUtil.data(ygglAttaJjlxrs);
tangzhaoqian committed
947 948 949 950
	}

	// 获取员工紧急联系人表
	@GetMapping(value = "/jjlxr/{empNum}")
951 952
	@ApiOperation(value = "35.获取员工紧急联系人表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 35)
tangzhaoqian committed
953 954
	public Result<List<YgglAttaJjlxr>> selectjjlxr(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaJjlxr> ygglAttaJjlxrs = YgglAttaJjlxr.builder().build().selectList(
955 956 957
				new QueryWrapper<YgglAttaJjlxr>().lambda()
				.eq(YgglAttaJjlxr::getOrgCode, userBean.getOrgCode())
				.eq(YgglAttaJjlxr::getEmpNum, empNum));
958
		return ResultUtil.data(ygglAttaJjlxrs);
tangzhaoqian committed
959 960 961 962 963 964 965 966 967
	}

	/**
	 * 添加/修改员工紧急联系人表
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/jjlxr")
968 969
	@ApiOperation(value = "36.添加/修改员工紧急联系人表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 36)
tangzhaoqian committed
970 971 972 973
	public Result<YgglAttaJjlxr> addjjlxr(@CurrentUser UserBean userBean, @RequestBody YgglAttaJjlxr ygglAttaJjlxr) {
		ygglAttaJjlxr.setEmpNum(ygglAttaJjlxr.getEmpNum());
		ygglAttaJjlxr.setOrgCode(userBean.getOrgCode());
		ygglAttaJjlxr.insertOrUpdate();
974
		return ResultUtil.data(ygglAttaJjlxr, "修改员工紧急联系人表成功");
tangzhaoqian committed
975 976 977 978 979 980 981 982 983
	}

	/**
	 * 删除员工紧急联系人表
	 * 
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/jjlxr/{id}")
984 985
	@ApiOperation(value = "37.删除员工紧急联系人表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 37)
tangzhaoqian committed
986 987 988
	public Result<Boolean> deljjlxr(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaJjlxr.builder().build()
989 990 991
				.delete(new QueryWrapper<YgglAttaJjlxr>().lambda()
						.eq(YgglAttaJjlxr::getOrgCode, orgCode)
						.eq(YgglAttaJjlxr::getId, id)), "删除员工紧急联系人表成功");
tangzhaoqian committed
992 993 994 995 996 997 998 999 1000 1001
	}

	// 获取工资卡信息
	/**
	 * 获取员工工资卡信息
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/gzk")
1002 1003
	@ApiOperation(value = "38.获取员工工资卡信息", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 38)
tangzhaoqian committed
1004
	public Result<List<YgglAttaGzk>> selectgzk(@CurrentUser UserBean userBean) {
1005 1006 1007 1008
		List<YgglAttaGzk> ygglAttaGzks = YgglAttaGzk.builder().build()
				.selectList(new QueryWrapper<YgglAttaGzk>().lambda()
						.eq(YgglAttaGzk::getOrgCode, userBean.getOrgCode())
						.eq(YgglAttaGzk::getEmpNum, userBean.getEmpNum()));
1009
		return ResultUtil.data(ygglAttaGzks);
tangzhaoqian committed
1010 1011 1012 1013
	}

	// 获取工资卡信息
	@GetMapping(value = "/gzk/{empNum}")
1014 1015
	@ApiOperation(value = "39.获取员工工资卡信息(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 39)
tangzhaoqian committed
1016 1017
	public Result<List<YgglAttaGzk>> selectgzk(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaGzk> ygglAttaGzks = YgglAttaGzk.builder().build().selectList(
1018 1019 1020
				new QueryWrapper<YgglAttaGzk>().lambda()
				.eq(YgglAttaGzk::getOrgCode, userBean.getOrgCode())
				.eq(YgglAttaGzk::getEmpNum, empNum));
1021
		return ResultUtil.data(ygglAttaGzks);
tangzhaoqian committed
1022 1023 1024 1025 1026 1027 1028 1029 1030
	}

	/**
	 * 添加/修改工资卡信息
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/gzk")
1031 1032
	@ApiOperation(value = "40.添加/修改工资卡信息", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 40)
tangzhaoqian committed
1033 1034 1035 1036
	public Result<YgglAttaGzk> addgzk(@CurrentUser UserBean userBean, @RequestBody YgglAttaGzk ygglAttaGzk) {
		ygglAttaGzk.setEmpNum(ygglAttaGzk.getEmpNum());
		ygglAttaGzk.setOrgCode(userBean.getOrgCode());
		ygglAttaGzk.insertOrUpdate();
1037
		return ResultUtil.data(ygglAttaGzk, "修改工资卡信息成功");
tangzhaoqian committed
1038 1039 1040 1041 1042 1043 1044 1045 1046
	}

	/**
	 * 删除工资卡信息
	 * 
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/gzk/{id}")
1047 1048
	@ApiOperation(value = "41.删除工资卡信息", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 41)
tangzhaoqian committed
1049 1050 1051
	public Result<Boolean> delgzk(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaGzk.builder().build()
1052 1053 1054
				.delete(new QueryWrapper<YgglAttaGzk>().lambda()
						.eq(YgglAttaGzk::getOrgCode, orgCode)
						.eq(YgglAttaGzk::getId, id)), "删除工资卡信息成功");
tangzhaoqian committed
1055 1056 1057 1058 1059 1060 1061 1062 1063
	}

	/**
	 * 获取员工合同信息表
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/htxxb")
1064 1065
	@ApiOperation(value = "42.获取员工合同信息表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 42)
tangzhaoqian committed
1066 1067
	public Result<List<YgglAttaHtxxb>> selecthtxxb(@CurrentUser UserBean userBean) {
		List<YgglAttaHtxxb> ygglAttaHtxxbs = YgglAttaHtxxb.builder().build()
1068 1069 1070
				.selectList(new QueryWrapper<YgglAttaHtxxb>().lambda()
						.eq(YgglAttaHtxxb::getOrgCode, userBean.getOrgCode())
						.eq(YgglAttaHtxxb::getEmpNum, userBean.getEmpNum()));
1071
		return ResultUtil.data(ygglAttaHtxxbs);
tangzhaoqian committed
1072 1073 1074 1075
	}

	// 获取员工合同信息表
	@GetMapping(value = "/htxxb/{empNum}")
1076 1077
	@ApiOperation(value = "43.获取员工合同信息表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 43)
tangzhaoqian committed
1078 1079
	public Result<List<YgglAttaHtxxb>> selecthtxxb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaHtxxb> ygglAttaHtxxbs = YgglAttaHtxxb.builder().build().selectList(
1080 1081 1082
				new QueryWrapper<YgglAttaHtxxb>().lambda()
				.eq(YgglAttaHtxxb::getOrgCode, userBean.getOrgCode())
				.eq(YgglAttaHtxxb::getEmpNum, empNum));
1083
		return ResultUtil.data(ygglAttaHtxxbs);
tangzhaoqian committed
1084 1085 1086 1087 1088 1089 1090 1091 1092
	}

	/**
	 * 添加/修改员工合同信息表
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/htxxb")
1093 1094
	@ApiOperation(value = "44.添加/修改员工合同信息表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 44)
tangzhaoqian committed
1095 1096 1097 1098
	public Result<YgglAttaHtxxb> addhtxxb(@CurrentUser UserBean userBean, @RequestBody YgglAttaHtxxb ygglAttaHtxxb) {
		ygglAttaHtxxb.setEmpNum(ygglAttaHtxxb.getEmpNum());
		ygglAttaHtxxb.setOrgCode(userBean.getOrgCode());
		ygglAttaHtxxb.insertOrUpdate();
1099
		return ResultUtil.data(ygglAttaHtxxb, "修改员工合同信息表成功");
tangzhaoqian committed
1100 1101 1102 1103 1104 1105 1106 1107 1108
	}

	/**
	 * 删除员工合同信息表
	 * 
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/htxxb/{id}")
1109 1110
	@ApiOperation(value = "45.删除员工合同信息表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 45)
tangzhaoqian committed
1111 1112 1113
	public Result<Boolean> delhtxxb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaHtxxb.builder().build()
1114 1115 1116
				.delete(new QueryWrapper<YgglAttaHtxxb>().lambda()
						.eq(YgglAttaHtxxb::getOrgCode, orgCode)
						.eq(YgglAttaHtxxb::getId, id)), "删除员工合同信息表成功");
tangzhaoqian committed
1117 1118 1119 1120 1121 1122 1123 1124 1125
	}

	/**
	 * 获取员工材料附件表
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/clfjb")
1126 1127
	@ApiOperation(value = "46.获取员工材料附件表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 46)
tangzhaoqian committed
1128 1129
	public Result<List<YgglAttaClfjb>> selectclfjb(@CurrentUser UserBean userBean) {
		List<YgglAttaClfjb> ygglAttaClfjbs = YgglAttaClfjb.builder().build()
1130 1131 1132
				.selectList(new QueryWrapper<YgglAttaClfjb>().lambda()
						.eq(YgglAttaClfjb::getOrgCode, userBean.getOrgCode())
						.eq(YgglAttaClfjb::getEmpNum, userBean.getEmpNum()));
1133
		return ResultUtil.data(ygglAttaClfjbs);
tangzhaoqian committed
1134 1135 1136 1137
	}

	// 获取员工材料附件表
	@GetMapping(value = "/clfjb/{empNum}")
1138 1139
	@ApiOperation(value = "47.获取员工材料附件表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 47)
tangzhaoqian committed
1140 1141
	public Result<List<YgglAttaClfjb>> selectclfjb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaClfjb> ygglAttaClfjbs = YgglAttaClfjb.builder().build().selectList(
1142 1143 1144
				new QueryWrapper<YgglAttaClfjb>().lambda()
				.eq(YgglAttaClfjb::getOrgCode, userBean.getOrgCode())
				.eq(YgglAttaClfjb::getEmpNum, empNum));
1145
		return ResultUtil.data(ygglAttaClfjbs);
tangzhaoqian committed
1146 1147 1148 1149 1150 1151 1152 1153 1154
	}

	/**
	 * 添加/修改员工材料附件表
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/clfjb")
1155 1156
	@ApiOperation(value = "48.添加/修改员工材料附件表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 48)
tangzhaoqian committed
1157 1158 1159 1160
	public Result<YgglAttaClfjb> addclfjb(@CurrentUser UserBean userBean, @RequestBody YgglAttaClfjb ygglAttaClfjb) {
		ygglAttaClfjb.setOrgCode(userBean.getOrgCode());
		ygglAttaClfjb.setEmpNum(ygglAttaClfjb.getEmpNum());
		ygglAttaClfjb.insertOrUpdate();
1161
		return ResultUtil.data(ygglAttaClfjb, "修改员工材料附件表成功");
tangzhaoqian committed
1162 1163 1164 1165 1166 1167 1168 1169 1170
	}

	/**
	 * 删除员工材料附件表
	 * 
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/clfjb/{id}")
1171 1172
	@ApiOperation(value = "49.删除员工材料附件表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 49)
tangzhaoqian committed
1173 1174 1175
	public Result<Boolean> delclfjb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaClfjb.builder().build()
1176 1177 1178
				.delete(new QueryWrapper<YgglAttaClfjb>().lambda()
						.eq(YgglAttaClfjb::getOrgCode, orgCode)
						.eq(YgglAttaClfjb::getId, id)), "删除员工材料附件表成功");
tangzhaoqian committed
1179 1180 1181 1182 1183 1184 1185 1186 1187
	}

	/**
	 * 获取成长记录表
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/czjlb")
1188 1189
	@ApiOperation(value = "50.获取成长记录表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 50)
tangzhaoqian committed
1190 1191
	public Result<List<YgglAttaCzjlb>> selectczjlb(@CurrentUser UserBean userBean) {
		List<YgglAttaCzjlb> ygglAttaCzjlbs = YgglAttaCzjlb.builder().build()
1192 1193 1194
				.selectList(new QueryWrapper<YgglAttaCzjlb>().lambda()
						.eq(YgglAttaCzjlb::getOrgCode, userBean.getOrgCode())
						.eq(YgglAttaCzjlb::getEmpNum, userBean.getEmpNum()));
1195
		return ResultUtil.data(ygglAttaCzjlbs);
tangzhaoqian committed
1196 1197 1198 1199
	}

	// 获取成长记录表
	@GetMapping(value = "/czjlb/{empNum}")
1200 1201
	@ApiOperation(value = "51.获取成长记录表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 51)
tangzhaoqian committed
1202 1203
	public Result<List<YgglAttaCzjlb>> selectczjlb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaCzjlb> ygglAttaCzjlbs = YgglAttaCzjlb.builder().build().selectList(
1204 1205 1206
				new QueryWrapper<YgglAttaCzjlb>().lambda()
				.eq(YgglAttaCzjlb::getOrgCode, userBean.getOrgCode())
				.eq(YgglAttaCzjlb::getEmpNum, empNum));
1207
		return ResultUtil.data(ygglAttaCzjlbs);
tangzhaoqian committed
1208 1209 1210 1211 1212 1213 1214 1215 1216
	}

	/**
	 * 添加/修改成长记录表
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/czjlb")
1217 1218
	@ApiOperation(value = "52.添加/修改成长记录表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 52)
tangzhaoqian committed
1219 1220 1221 1222
	public Result<YgglAttaCzjlb> addczjlb(@CurrentUser UserBean userBean, @RequestBody YgglAttaCzjlb ygglAttaCzjlb) {
		ygglAttaCzjlb.setEmpNum(ygglAttaCzjlb.getEmpNum());
		ygglAttaCzjlb.setOrgCode(userBean.getOrgCode());
		ygglAttaCzjlb.insertOrUpdate();
1223
		return ResultUtil.data(ygglAttaCzjlb, "修改成长记录表成功");
tangzhaoqian committed
1224 1225 1226 1227 1228 1229 1230 1231 1232
	}

	/**
	 * 获取单个离职员工信息(管)
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/lzb/{empNum}")
1233 1234
	@ApiOperation(value = "53.获取单个离职员工信息(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 53)
tangzhaoqian committed
1235 1236 1237
	public Result<YgglMainLzb> selectlzb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		YgglMainLzb lzyg = new LambdaQueryChainWrapper<YgglMainLzb>(ygglMainLzbMapper)
				.eq(YgglMainLzb::getOrgCode, userBean.getOrgCode()).eq(YgglMainLzb::getEmpNum, empNum).one();
1238
		return ResultUtil.data(lzyg);
tangzhaoqian committed
1239 1240 1241 1242 1243 1244 1245 1246 1247
	}

	/**
	 * 员工转正
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/ygzz")
1248 1249
	@ApiOperation(value = "54.员工转正", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 54)
tangzhaoqian committed
1250
	public Result<Void> ygzz(@CurrentUser UserBean userBean, @RequestBody YgzzDto ygzzDto) {
1251 1252 1253 1254
		
		YgglMainEmp.builder().jobStatus(jobStatus.ZHENSHI.getType()).zzTime(ygzzDto.getZzTime()).sjzzTime(new Date())
				.zzRemark(ygzzDto.getZzRemark()).build().update(new UpdateWrapper<YgglMainEmp>().lambda()
						.eq(YgglMainEmp::getEmpNum, ygzzDto.getEmpNum()));
1255
		return ResultUtil.success("转正成功!");
tangzhaoqian committed
1256 1257 1258 1259 1260 1261 1262 1263 1264
	}

	/**
	 * 计划离职 type2-3
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/addlzjh")
1265 1266
	@ApiOperation(value = "55.添加离职计划", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 55)
tangzhaoqian committed
1267 1268 1269 1270
	public Result<YgglMainLzb> addjhlz(@CurrentUser UserBean userBean, @RequestBody LzygQueryDto lzygQueryDto) {

		Integer empNum = lzygQueryDto.getEmpNum();

1271 1272 1273
		YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
				.eq(YgglMainEmp::getEmpNum, empNum)
				.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
tangzhaoqian committed
1274 1275
		YgglMainLzb ygglMainLzb = YgglMainLzb.builder().empNum(lzygQueryDto.getEmpNum()).build();
		// 移动员工表数据到离职表
1276
		BeanUtil.copyProperties(ygglMainEmp, ygglMainLzb,"before_leaving_sts");
tangzhaoqian committed
1277 1278
		ygglMainLzb.insert();

1279 1280

		
1281
		YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).beforeLeavingSts(ygglMainEmp.getJobStatus())
1282
				.build().update(new UpdateWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, empNum));
tangzhaoqian committed
1283
		YgglMainLzb.builder().jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).lzTime(lzygQueryDto.getLzTime())
1284
				.lzyy(lzygQueryDto.getLzyy()).lzbz(lzygQueryDto.getLzbz()).build().update(new UpdateWrapper<YgglMainLzb>().lambda().eq(YgglMainLzb::getEmpNum, empNum));
tangzhaoqian committed
1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295

		return ResultUtil.data(ygglMainLzb, "添加待离职员工成功");
	}

	/**
	 * 确认离职 type3-4
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/qrlz")
1296 1297
	@ApiOperation(value = "56.确认离职", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 56)
tangzhaoqian committed
1298 1299
	public Result<Void> addlzb(@CurrentUser UserBean userBean, @RequestBody LzygQueryDto lzygQueryDto) {
		Integer empNum = lzygQueryDto.getEmpNum();
1300 1301
		// 删除员工档案表
		ygglMainEmpMapper.delete(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, empNum));
1302

tangzhaoqian committed
1303
		YgglMainLzb.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).sjlzTime(new Date())
1304
				.build().update(new UpdateWrapper<YgglMainLzb>().lambda().eq(YgglMainLzb::getEmpNum, empNum));
1305

1306 1307
		LambdaQueryWrapper<QyzxEmpEntAsso> queryWrapper = new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getEmpNum, empNum);
		
tangzhaoqian committed
1308
		// 确认离职 删除员工关联表
1309
		qyzxEmpEntAssoMapper.delete(queryWrapper);
tangzhaoqian committed
1310 1311 1312 1313

		// 初始化 部门主管
		zzglBmgwMMapper.update(ZzglBmgwM.builder().leader(null).build(),
				new UpdateWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getLeader, empNum));
1314 1315 1316 1317 1318 1319
		
		// 更新当前企业
		List<QyzxEmpEntAsso> listEEA = qyzxEmpEntAssoMapper.selectList(queryWrapper);
		if (listEEA != null && listEEA.size() > 0) {
			QyzxEmpLogin.builder().id(empNum).orgId(CollUtil.getFirst(listEEA).getOrgCode()).build().updateById();
		}
tangzhaoqian committed
1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330

		return ResultUtil.success("确认离职员工成功");
	}

	/**
	 * 放弃离职 type3-2
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/fqlz")
1331 1332
	@ApiOperation(value = "57.放弃离职", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 57)
tangzhaoqian committed
1333
	public Result<Void> fqlz(@CurrentUser UserBean userBean, @RequestBody LzygQueryDto lzygQueryDto) {
1334 1335 1336 1337 1338 1339 1340
		
		
		YgglMainEmp ygglMainEmp = ygglMainEmpMapper.selectOne(
				new QueryWrapper<YgglMainEmp>().lambda()
				.eq(YgglMainEmp::getEmpNum, lzygQueryDto.getEmpNum())
				.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
		
1341 1342 1343
		
		YgglMainEmp.builder().jobStatus(ygglMainEmp.getBeforeLeavingSts()).build().update(new UpdateWrapper<YgglMainEmp>().lambda()
				.eq(YgglMainEmp::getEmpNum, lzygQueryDto.getEmpNum()));
tangzhaoqian committed
1344
		// 删除离职表
1345 1346
		YgglMainLzb.builder().id(lzygQueryDto.getEmpNum()).build().delete(new QueryWrapper<YgglMainLzb>().lambda()
				.eq(YgglMainLzb::getEmpNum, lzygQueryDto.getEmpNum()));
tangzhaoqian committed
1347 1348 1349 1350 1351

		return ResultUtil.success("放弃成功");
	}

	@PostMapping(value = "/tzlzyy")
1352 1353
	@ApiOperation(value = "58.调整离职", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 58)
tangzhaoqian committed
1354 1355 1356
	public Result<YgglMainLzb> tzlzyy(@CurrentUser UserBean userBean, @RequestBody YgglMainLzb ygglMainLzb) {

		if (ygglMainLzb.getEmpNum() != null) {
1357 1358 1359
			ygglMainLzb.update(new UpdateWrapper<YgglMainLzb>().lambda()
					.eq(YgglMainLzb::getOrgCode, userBean.getOrgCode())
					.eq(YgglMainLzb::getEmpNum, ygglMainLzb.getEmpNum()));
tangzhaoqian committed
1360 1361
			return ResultUtil.data(ygglMainLzb, "修改成功");
		}
1362
		return ResultUtil.error("请确认该员工是否存在!");
tangzhaoqian committed
1363 1364 1365 1366 1367 1368 1369 1370 1371 1372

	}

	/**
	 * 查询离职员工列表
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/querylzyg")
1373 1374
	@ApiOperation(value = "59.查询离职员工列表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 59)
tangzhaoqian committed
1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391
	public Result<Object> querylzyg(@CurrentUser UserBean userBean, @RequestBody LzbQueryDto lzygQueryDto) {
		lzygQueryDto.setOrgCode(userBean.getOrgCode());

		IPage<YgglMainLzb> page = new Page<YgglMainLzb>(
				lzygQueryDto.getCurrentPage() == null ? 1 : lzygQueryDto.getCurrentPage(),
				lzygQueryDto.getTotalPage() == null ? 10 : lzygQueryDto.getTotalPage());
		List<YgglMainLzb> lzb = ygglMainLzbMapper.queryLzb(page, lzygQueryDto);
		return ResultUtil.data(page, lzb, "离职员工搜索成功");
	}

	/**
	 * 展示民族/展示所有民族
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/mz/{id}")
1392 1393
	@ApiOperation(value = "60.展示民族/展示所有民族", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 60)
tangzhaoqian committed
1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406
	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, "展示该民族");
	}

	@Autowired
	CommonAreaMapper commonAreaMapper;

	/**
1407
	 * 籍贯树
tangzhaoqian committed
1408 1409 1410 1411 1412
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/native_place")
1413 1414
	@ApiOperation(value = "61.籍贯树", httpMethod = "GET", notes = "籍贯树")
	@ApiOperationSupport(order = 61)
tangzhaoqian committed
1415 1416 1417
	public Result<List<CommonArea>> selectNativePlace() {

		List<CommonArea> listCommonArea = commonAreaMapper.AllAreaForTree();
1418
		return ResultUtil.data(listCommonArea);
tangzhaoqian committed
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428

	}

	/**
	 * 查询员工列表
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/queryemp")
1429
	@ApiOperation(value = "62.查询员工列表", httpMethod = "GET", notes = "接口发布说明")
tangzhaoqian committed
1430 1431 1432 1433 1434 1435 1436 1437
	@ApiOperationSupport(order = 62)
	public Result<List<YgQueryDto>> queryEmpMessage(@CurrentUser UserBean userBean) {
		List<YgQueryDto> ygQueryDto = ygglMainEmpMapper.queryEmpMessage(userBean.getOrgCode());
		for (YgQueryDto yg : ygQueryDto) {
			if (StringUtil.isEmpty(yg.getHeadUrl())) {
				yg.setHeadUrl("");
			}
		}
1438
		return ResultUtil.data(ygQueryDto);
tangzhaoqian committed
1439 1440 1441 1442 1443 1444 1445 1446 1447
	}

	/*************** 统计图 ***************/
	/**
	 * 查询统计图
	 * 
	 * @return 成功信息
	 */
	@GetMapping("/yggl")
1448
	@ApiOperation(value = "63.获取员工管理统计图信息", httpMethod = "GET", notes = "接口发布说明")
tangzhaoqian committed
1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481
	@ApiOperationSupport(order = 63)
	public Result<Map<String, Object>> queryYgglCartogram(@CurrentUser UserBean userBean) {

		Map<String, Object> map = new HashMap<String, Object>();
		YgglCartogramDto ygglCartogramDto1 = ygglMainEmpMapper.queryPositive(userBean);
		YgglCartogramDto ygglCartogramDto2 = ygglMainEmpMapper.queryAvgAge(userBean);
		YgglCartogramDto ygglCartogramDto3 = ygglMainEmpMapper.queryInduction(userBean);
		YgglCartogramDto ygglCartogramDto4 = ygglMainEmpMapper.queryInservice(userBean);
		YgglCartogramDto ygglCartogramDto5 = ygglMainLzbMapper.queryDeparture(userBean);

		List<YgglCartogramDto> ygglCartogramDto6 = ygglMainEmpMapper.queryDepartmentNum(userBean);
		List<YgglCartogramDto> ygglCartogramDto7 = ygglMainEmpMapper.queryEducation(userBean);
		List<YgglCartogramDto> ygglCartogramDto8 = ygglMainEmpMapper.queryJobsNum(userBean);
		List<YgglCartogramDto> ygglCartogramDto9 = ygglMainEmpMapper.queryEmpAge(userBean);
		List<YgglCartogramDto> ygglCartogramDto10 = ygglMainEmpMapper.queryNativeplace(userBean);
		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());
		map.put("departure", ygglCartogramDto5.getDepartureNum());

		map.put("department", ygglCartogramDto6);
		map.put("education", ygglCartogramDto7);
		map.put("jobs", ygglCartogramDto8);
		map.put("empAge", ygglCartogramDto9);
		map.put("nativeplace", ygglCartogramDto10);
		map.put("workingAge", ygglCartogramDto11);

1482
		return ResultUtil.data(map);
tangzhaoqian committed
1483 1484 1485 1486 1487 1488 1489 1490
	}

	/**
	 * 员工信息统计图
	 * 
	 * @return 成功信息(weng)
	 */
	@GetMapping("/Cartogram")
1491 1492
	@ApiOperation(value = "64.获取员工管理统计图信息", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 64)
tangzhaoqian committed
1493 1494 1495
	public Result<YgCartogramDto> ygCartogram(@CurrentUser UserBean userBean) {
		Integer orgCode = userBean.getOrgCode();
		List<YgbintuDto> bintu = ygglMainEmpMapper.rsybp(orgCode);
1496

tangzhaoqian committed
1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559
		Map<String, Long> gw = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getGw, Collectors.counting()));
		List<YgKVDto> gwList = new ArrayList<YgKVDto>();
		for (Map.Entry<String, Long> entry : gw.entrySet()) {
			gwList.add(new YgKVDto(entry.getKey(), entry.getValue().toString()));
		}
		Map<String, Long> bm = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getBm, Collectors.counting()));
		List<YgKVDto> bmList = new ArrayList<YgKVDto>();
		for (Map.Entry<String, Long> entry : bm.entrySet()) {
			bmList.add(new YgKVDto(entry.getKey(), entry.getValue().toString()));
		}
		Map<String, Long> edu = bintu.stream()
				.collect(Collectors.groupingBy(YgbintuDto::getEduname, Collectors.counting()));
		List<YgKVDto> eduList = new ArrayList<YgKVDto>();
		for (Map.Entry<String, Long> entry : edu.entrySet()) {
			eduList.add(new YgKVDto(entry.getKey(), entry.getValue().toString()));
		}
		Map<Integer, Long> jobStatus = bintu.stream()
				.collect(Collectors.groupingBy(YgbintuDto::getJobStatus, Collectors.counting()));
		List<YgKVDto> jobStatusList = new ArrayList<YgKVDto>();
		for (Entry<Integer, Long> entry : jobStatus.entrySet()) {
			jobStatusList.add(new YgKVDto(entry.getKey().toString(), entry.getValue().toString()));
		}
		Map<String, Long> proname = bintu.stream()
				.collect(Collectors.groupingBy(YgbintuDto::getProname, Collectors.counting()));
		List<YgKVDto> pronameList = new ArrayList<YgKVDto>();
		for (Entry<String, Long> entry : proname.entrySet()) {
			pronameList.add(new YgKVDto(entry.getKey().toString(), entry.getValue().toString()));
		}
		Map<String, Integer> workage = YgEnumInterface.workage.choose(bintu);
		List<YgKVDto> workageList = new ArrayList<YgKVDto>();
		for (Entry<String, Integer> entry : workage.entrySet()) {
			workageList.add(new YgKVDto(entry.getKey().toString(), entry.getValue().toString()));
		}
		Map<String, Integer> age = YgEnumInterface.age.choose(bintu);
		List<YgKVDto> ageList = new ArrayList<YgKVDto>();
		for (Entry<String, Integer> entry : age.entrySet()) {
			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 xinruzhi = workage.get("本月新入职").intValue();
		// 本月离职
		Integer lizhi = ygglMainEmpMapper.benyueLz(orgCode);
		// 本月转正
		Integer zhuanzhen = ygglMainEmpMapper.benyueZz(orgCode);
		// 平均年龄
		Integer nianlin = age.get("平均年龄").intValue();
		YgCartogramDto ybp = new YgCartogramDto();
		ybp.setOnTheJob(zaizhi);
		ybp.setNewRecruits(xinruzhi);
		ybp.setDimission(lizhi);
		ybp.setRegularization(zhuanzhen);
		ybp.setAverageAge(nianlin);

		ybp.setDepartment(bmList);
		ybp.setPosition(gwList);
		ybp.setEdu(eduList);
		ybp.setJobStatus(jobStatusList);
		ybp.setProname(pronameList);
		ybp.setWorkage(workageList);
		ybp.setAge(ageList);
1560
		return ResultUtil.data(ybp);
tangzhaoqian committed
1561 1562 1563 1564 1565 1566 1567 1568 1569
	}

	/**
	 * 获取员工社保公积金
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/ygsbgjj")
1570 1571
	@ApiOperation(value = "65.获取员工社保公积金", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 65)
tangzhaoqian committed
1572
	public Result<List<YgglAttaSbgjj>> selectygsbgjj(@CurrentUser UserBean userBean) {
1573 1574 1575
		List<YgglAttaSbgjj> ygglAttaSbgjj = YgglAttaSbgjj.builder().build().selectList(new QueryWrapper<YgglAttaSbgjj>().lambda()
				.eq(YgglAttaSbgjj::getOrgCode, userBean.getOrgCode())
				.eq(YgglAttaSbgjj::getEmpNum, userBean.getEmpNum()));
1576
		return ResultUtil.data(ygglAttaSbgjj);
tangzhaoqian committed
1577 1578 1579 1580 1581 1582 1583 1584 1585
	}

	/**
	 * 获取员工社保公积金
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/ygsbgjj/{empNum}")
1586 1587
	@ApiOperation(value = "66.获取员工社保公积金", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 66)
tangzhaoqian committed
1588 1589 1590
	public Result<YgglAttaSbgjj> selectygsbgjj(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {

		YgglAttaSbgjj ygglAttaSbgjj = YgglAttaSbgjj.builder().build()
1591
				.selectOne(new QueryWrapper<YgglAttaSbgjj>().lambda().eq(YgglAttaSbgjj::getEmpNum, empNum));
tangzhaoqian committed
1592

1593
		return ResultUtil.data(ygglAttaSbgjj);
tangzhaoqian committed
1594 1595 1596 1597 1598 1599 1600 1601 1602
	}

	/**
	 * 添加/修改员工社保公积金
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/ygsbgjj")
1603 1604
	@ApiOperation(value = "67.添加/修改员工社保公积金", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 67)
tangzhaoqian committed
1605 1606 1607 1608 1609 1610
	public Result<YgglAttaSbgjj> addygsbgjj(@CurrentUser UserBean userBean, @RequestBody YgglAttaSbgjj ygglAttaSbgjj) {
		Integer empNum = ygglAttaSbgjj.getEmpNum();
		if (empNum == null) {
			return ResultUtil.error();
		}
		YgglAttaSbgjj AttaSbgjj = YgglAttaSbgjj.builder().build()
1611
				.selectOne(new QueryWrapper<YgglAttaSbgjj>().lambda().eq(YgglAttaSbgjj::getEmpNum, empNum));
tangzhaoqian committed
1612
		if (AttaSbgjj != null) {
1613
			ygglAttaSbgjj.update(new UpdateWrapper<YgglAttaSbgjj>().lambda().eq(YgglAttaSbgjj::getEmpNum, empNum));
tangzhaoqian committed
1614 1615 1616 1617
		} else {
			ygglAttaSbgjj.insert();
		}

1618
		return ResultUtil.data(ygglAttaSbgjj);
tangzhaoqian committed
1619 1620 1621 1622 1623 1624 1625 1626 1627
	}

	/**
	 * 删除员工社保公积金
	 * 
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/ygsbgjj/{id}")
1628 1629
	@ApiOperation(value = "68.删除员工社保公积金", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 68)
tangzhaoqian committed
1630 1631 1632
	public Result<Boolean> delygsbgjj(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaSbgjj.builder().build()
1633 1634
				.delete(new QueryWrapper<YgglAttaSbgjj>().lambda()
						.eq(YgglAttaSbgjj::getOrgCode, orgCode)
1635
						.eq(YgglAttaSbgjj::getId, id)));
tangzhaoqian committed
1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660
	}

	@GetMapping(value = "/sysRegion")
	@ApiOperation(value = "省市区字典(贼全)", httpMethod = "GET", notes = "接口发布说明")
	public Result<List<Tree<String>>> sysRegion() {
		List<SysRegion> nodeList = SysRegion.builder().build()
				.selectList(new LambdaQueryWrapper<SysRegion>().select(SysRegion::getKeyId, SysRegion::getRegionCode,
						SysRegion::getRegionName, SysRegion::getMerName, SysRegion::getLevel));

		// 配置
		TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
		// 自定义属性名 都要默认值的
		treeNodeConfig.setIdKey("key_id");
		treeNodeConfig.setParentIdKey("region_code");
		// 最大递归深度
		treeNodeConfig.setDeep(4);

		List<Tree<String>> treeNodes = TreeUtil.build(nodeList, "0", treeNodeConfig, (treeNode, tree) -> {
			tree.setId(treeNode.getKeyId().toString());
			tree.setParentId(treeNode.getRegionCode());
			tree.setName(treeNode.getRegionName());
			// 扩展属性 ...
			tree.putExtra("mer_name", treeNode.getMerName());
		});

1661
		return ResultUtil.data(treeNodes);
tangzhaoqian committed
1662
	}
1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702
	
	/**
	 * 获取登录人的相关信息
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/loginmessage")
	@ApiOperation(value = "69.获取登录人的相关信息", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 69)
	public Result<LoginInfoDto> loginmessage(@CurrentUser UserBean userBean) {
		Integer empNum = userBean.getEmpNum();
		Integer orgCode = userBean.getOrgCode();
		LoginInfoDto loginInfo = LoginInfoDto.builder().build();
		YgglMainEmp ygglMainEmp = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
				.select(YgglMainEmp::getBmgwId, YgglMainEmp::getName, YgglMainEmp::getRzTime, YgglMainEmp::getZzTime,
						YgglMainEmp::getEmpNum)
				.eq(YgglMainEmp::getEmpNum, empNum).eq(YgglMainEmp::getOrgCode, orgCode).one();
		if (ygglMainEmp != null) {
			Integer gw = ygglMainEmp.getBmgwId();

			ZzglBmgwM gwObj = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
					.select(ZzglBmgwM::getUpId, ZzglBmgwM::getName).eq(ZzglBmgwM::getId, gw)
					.eq(ZzglBmgwM::getOrgCode, orgCode).one();

			if (gwObj != null) {
				ZzglBmgwM bmObj = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
						.select(ZzglBmgwM::getId, ZzglBmgwM::getName).eq(ZzglBmgwM::getId, gwObj.getUpId())
						.eq(ZzglBmgwM::getOrgCode, orgCode).one();
				loginInfo.setBmId(bmObj != null ? bmObj.getId() : null);
				loginInfo.setBmName(bmObj != null ? bmObj.getName() : null);
			}

			loginInfo.setEmpNum(ygglMainEmp.getEmpNum());
			loginInfo.setName(ygglMainEmp.getName());
			loginInfo.setGwId(gw);
			loginInfo.setGwName(gwObj != null ? gwObj.getName() : "");
			loginInfo.setEntryTime(ygglMainEmp.getRzTime());
			loginInfo.setRegularTime(ygglMainEmp.getRzTime());
		}
1703
		return ResultUtil.data(loginInfo);
1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736
	}

	/**
	 * 获取登录人和上级主管的empNum和名称
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/loginerChargers")
	@ApiOperation(value = "70.获取登录人和上级主管的empNum和名称", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 70)
	public Result<List<LoginerChargeDto>> loginerChargers(@CurrentUser UserBean userBean) {
		Integer orgCode = userBean.getOrgCode();
		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
		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) {

					leaderList.add(zzglBmgwM.getLeader());
				}
			}
		}
		List<YgglMainEmp> ygglMainEmps = empNumsConfirm(orgCode, leaderList);
		List<LoginerChargeDto> loginerChargeDtos = new ArrayList<LoginerChargeDto>();
		for (YgglMainEmp m : ygglMainEmps) {
			if (m.getHeadUrl() == null) {
1737
				m.setHeadUrl(CommonEnum.NULL_STR.getDesc());
1738 1739 1740 1741
			}
			loginerChargeDtos.add(new LoginerChargeDto(m.getEmpNum(), m.getName(), m.getHeadUrl()));
		}
		Collections.reverse(loginerChargeDtos);
1742
		return ResultUtil.data(loginerChargeDtos);
1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788
	}

	// 根据传来的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) {
			for (Integer empNum : empNumList) {
				all.stream().filter(item -> empNum.equals(item.getEmpNum())).forEach(action -> {
					ygglMainEmps.add(action);
				});
			}
		} 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();
		return one;
	}

	/**
	 * 获取用户头像
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/headphotos")
	@ApiOperation(value = "71.获取用户头像", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 71)
	public Result<List<YgglMainEmp>> headphotos(@CurrentUser UserBean userBean, @RequestBody List<Integer> empNumList) {
		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));
		for (YgglMainEmp yg : yglList) {
			if (StringUtil.isEmpty(yg.getHeadUrl())) {
1789
				yg.setHeadUrl(CommonEnum.NULL_STR.getDesc());
1790 1791
			}
		}
1792
		return ResultUtil.data(yglList);
1793
	}
tangzhaoqian committed
1794 1795

}