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

8 9
import java.text.ParseException;
import java.text.SimpleDateFormat;
10
import java.util.ArrayList;
11
import java.util.Collections;
12 13
import java.util.Date;
import java.util.HashMap;
14
import java.util.Iterator;
15 16
import java.util.List;
import java.util.Map;
17
import java.util.Map.Entry;
18 19
import java.util.regex.Matcher;
import java.util.regex.Pattern;
20
import java.util.stream.Collectors;
21 22 23 24

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
25
import org.springframework.beans.factory.annotation.Value;
26
import org.springframework.transaction.interceptor.TransactionAspectSupport;
27
import org.springframework.validation.annotation.Validated;
28 29 30 31 32 33 34 35
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;

36
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
37 38 39
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
40 41
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
42
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
东州 翁 committed
43
import com.github.pagehelper.util.StringUtil;
44
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
45

46
import cn.hutool.core.bean.BeanUtil;
47 48
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
东州 翁 committed
49 50
import cn.hutool.core.date.BetweenFormater.Level;
import cn.hutool.core.date.DateUtil;
51 52 53
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNodeConfig;
import cn.hutool.core.lang.tree.TreeUtil;
54
import cn.hutool.core.util.StrUtil;
tangzhaoqian committed
55 56
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
57
import cn.timer.api.bean.clazz.CommonArea;
58
import cn.timer.api.bean.clazz.SysRegion;
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
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;
太阳与水 committed
78
import cn.timer.api.config.enuminterface.YgEnumInterface;
79
import cn.timer.api.config.enums.CommonEnum;
80
import cn.timer.api.dao.clazz.CommonAreaMapper;
81
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
82 83 84 85
import cn.timer.api.dao.yggl.YgAreaDtoMapper;
import cn.timer.api.dao.yggl.YgCityDtoMapper;
import cn.timer.api.dao.yggl.YgMzDtoMapper;
import cn.timer.api.dao.yggl.YgProDtoMapper;
86 87 88 89
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;
90
import cn.timer.api.dto.yggl.LoginInfoDto;
91
import cn.timer.api.dto.yggl.LoginerChargeDto;
92 93
import cn.timer.api.dto.yggl.LzbQueryDto;
import cn.timer.api.dto.yggl.LzygQueryDto;
94
import cn.timer.api.dto.yggl.YgAreaDto;
95
import cn.timer.api.dto.yggl.YgCartogramDto;
96 97 98
import cn.timer.api.dto.yggl.YgCityDto;
import cn.timer.api.dto.yggl.YgDrjqbDto;
import cn.timer.api.dto.yggl.YgDrsDto;
99
import cn.timer.api.dto.yggl.YgKVDto;
东州 翁 committed
100
import cn.timer.api.dto.yggl.YgProDto;
101
import cn.timer.api.dto.yggl.YgQueryDto;
102
import cn.timer.api.dto.yggl.YgbintuDto;
103
import cn.timer.api.dto.yggl.YgglCartogramDto;
104
import cn.timer.api.dto.yggl.YgjgDto;
东州 翁 committed
105
import cn.timer.api.dto.yggl.YgmzDto;
106 107 108 109 110 111 112 113 114 115 116 117 118 119
import cn.timer.api.dto.yggl.YgzzDto;
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)
121 122 123
@RequestMapping(value = "/yggl", produces = { "application/json" })
public class YgglController {

124 125 126
	@Value(value = "${config-8timer.init-password}")
	private String pwd;
	
127 128 129 130 131 132 133 134
	@Autowired
	private YgglMainEmpMapper ygglMainEmpMapper;

	@Autowired
	private QyzxEmpLoginMapper qyzxEmpLoginMapper;

	@Autowired
	private YgglMainLzbMapper ygglMainLzbMapper;
邓实川 committed
135

136 137
	@Autowired
	private ZzglBmgwMMapper zzglBmgwMMapper;
邓实川 committed
138 139

	// weng(籍贯)
140 141 142 143 144 145
	@Autowired
	private YgAreaDtoMapper ygAreaDtoMapper;
	@Autowired
	private YgCityDtoMapper ygCityDtoMapper;
	@Autowired
	private YgProDtoMapper ygProDtoMapper;
邓实川 committed
146 147

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

151 152 153 154 155 156 157 158 159
	/**
	 * 获取登录人的相关信息
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/loginmessage")
	@ApiOperation(value = " 获取登录人的相关信息", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 68)
160
	public Result<LoginInfoDto> loginmessage(@CurrentUser UserBean userBean) {
161 162
		Integer empNum = userBean.getEmpNum();
		Integer orgCode = userBean.getOrgCode();
163 164
		LoginInfoDto loginInfo = LoginInfoDto.builder().build();
		YgglMainEmp ygglMainEmp = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
165
				.select(YgglMainEmp::getBmgwId, YgglMainEmp::getName, YgglMainEmp::getRzTime, YgglMainEmp::getZzTime,
166 167 168 169
						YgglMainEmp::getEmpNum)
				.eq(YgglMainEmp::getEmpNum, empNum).eq(YgglMainEmp::getOrgCode, orgCode).one();
		if (ygglMainEmp != null) {
			Integer gw = ygglMainEmp.getBmgwId();
170

171 172 173 174 175 176 177 178 179
			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);
			}
180

181 182 183 184 185 186 187 188
			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());
		}
		return ResultUtil.data(loginInfo, "操作成功!");
189
	}
190

191 192 193 194 195 196 197 198
	/**
	 * 获取登录人和上级主管的empNum和名称
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/loginerChargers")
	@ApiOperation(value = " 获取登录人和上级主管的empNum和名称", httpMethod = "GET", notes = "接口发布说明")
199 200 201 202 203 204
	@ApiOperationSupport(order = 69)
	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();
205 206 207
		List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
				.eq(ZzglBmgwM::getOrgCode, orgCode).list();
		// 获取该员工的上级部门id 的数组list
208 209 210 211
		ZzglBmgwM.getUpDepts(list, gw, zzglBmgwMs);
		List<Integer> leaderList = new ArrayList<Integer>();
		for (Integer zzglId : list) {
			for (ZzglBmgwM zzglBmgwM : zzglBmgwMs) {
212 213
				if (zzglId.equals(zzglBmgwM.getId()) && zzglBmgwM.getLeader() != null) {

214 215 216 217 218
					leaderList.add(zzglBmgwM.getLeader());
				}
			}
		}
		List<YgglMainEmp> ygglMainEmps = empNumsConfirm(orgCode, leaderList);
219
		List<LoginerChargeDto> loginerChargeDtos = new ArrayList<LoginerChargeDto>();
220
		for (YgglMainEmp m : ygglMainEmps) {
221 222 223
			if (m.getHeadUrl() == null) {
				m.setHeadUrl("");
			}
224
			loginerChargeDtos.add(new LoginerChargeDto(m.getEmpNum(), m.getName(), m.getHeadUrl()));
225 226 227 228
		}
		Collections.reverse(loginerChargeDtos);
		return ResultUtil.data(loginerChargeDtos, "获取上级部门的部门id");
	}
229 230 231 232 233

	// 根据传来的empNum获取该人员信息,没有则传全部
	public List<YgglMainEmp> empNumsConfirm(Integer orgCode, List<Integer> empNumList) {
		List<YgglMainEmp> all = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
				.eq(YgglMainEmp::getOrgCode, orgCode).list();
234
		List<YgglMainEmp> ygglMainEmps = new ArrayList<YgglMainEmp>();
235
		if (empNumList.size() != 0) {
236
			for (Integer empNum : empNumList) {
237
				all.stream().filter(item -> empNum.equals(item.getEmpNum())).forEach(action -> {
238 239 240
					ygglMainEmps.add(action);
				});
			}
241
		} else {
242 243
			ygglMainEmps.addAll(all);
		}
244

245 246
		return ygglMainEmps;
	}
247 248 249 250 251

	// 根据传来的empNum获取该人员信息
	public YgglMainEmp empNumConfirm(Integer orgCode, Integer empNum) {
		YgglMainEmp one = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
				.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum).one();
252
		return one;
253
	}
邓实川 committed
254

255
	/**
东州 翁 committed
256
	 * 获取用户头像
257 258 259 260
	 * 
	 * @param
	 * @return
	 */
东州 翁 committed
261 262
	@PostMapping(value = "/headphotos")
	@ApiOperation(value = "获取用户头像", httpMethod = "POST", notes = "接口发布说明")
263
	@ApiOperationSupport(order = 70)
东州 翁 committed
264
	public Result<List<YgglMainEmp>> headphotos(@CurrentUser UserBean userBean, @RequestBody List<Integer> empNumList) {
265
		if (empNumList.size() == 0) {
东州 翁 committed
266 267
			return ResultUtil.error("请输入empNum数组");
		}
268 269 270 271
		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));
东州 翁 committed
272 273 274 275 276 277
		for (YgglMainEmp yg : yglList) {
			if (StringUtil.isEmpty(yg.getHeadUrl())) {
				yg.setHeadUrl("");
			}
		}
		return ResultUtil.data(yglList, "获取用户头像组成功");
278
	}
279

280 281
	/**
	 * 获取员工档案
邓实川 committed
282
	 * 
283 284 285 286 287 288 289 290 291 292 293 294
	 * @param
	 * @return
	 */
	@GetMapping(value = "/ygda")
	@ApiOperation(value = "获取员工档案", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 1)
	public Result<YgglMainEmp> selectygda(@CurrentUser UserBean userBean) {
		Integer empNum = userBean.getEmpNum();
		Integer orgCode = userBean.getOrgCode();
		QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
		queryWrapper.eq("org_code", orgCode).eq("emp_num", empNum);
		YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(queryWrapper);
邓实川 committed
295 296 297 298
		Date rz = ygglMainEmp.getRzTime();
		if (rz != null) {
			ygglMainEmp.setWorkTime(DateUtil.formatBetween(rz, new Date(), Level.DAY));
		}
299 300
		return ResultUtil.data(ygglMainEmp, "获取员工档案成功");
	}
邓实川 committed
301

东州 翁 committed
302 303 304 305 306 307 308 309 310
	// 获取员工档案
	@GetMapping(value = "/ygda/{empNum}")
	@ApiOperation(value = "获取员工档案(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 2)
	public Result<YgglMainEmp> selectygda(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		Integer orgCode = userBean.getOrgCode();
		QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
		queryWrapper.eq("org_code", orgCode).eq("emp_num", empNum);
		YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(queryWrapper);
311 312
		Date rz = ygglMainEmp.getRzTime();
		if (rz != null) {
邓实川 committed
313
			ygglMainEmp.setWorkTime(DateUtil.formatBetween(ygglMainEmp.getRzTime(), new Date(), Level.DAY));
东州 翁 committed
314
		}
东州 翁 committed
315 316
		return ResultUtil.data(ygglMainEmp, "获取员工档案成功");
	}
邓实川 committed
317

318 319
	/**
	 * 根据岗位id获取员工档案部门岗位名称
邓实川 committed
320
	 * 
321 322 323
	 * @param
	 * @return
	 */
东州 翁 committed
324
	@GetMapping(value = "/ygdabm/{gwid}")
325
	@ApiOperation(value = "获取员工档案部门岗位名称", httpMethod = "GET", notes = "接口发布说明")
东州 翁 committed
326
	@ApiOperationSupport(order = 3)
邓实川 committed
327 328 329
	public Result<String> selectbmgw(@CurrentUser UserBean userBean, @PathVariable Integer gwid) {
		if (gwid == null || gwid == 0) {
			return ResultUtil.data("无岗位", "获取员工档案部门岗位名称成功");
330
		}
331 332 333
		Integer orgCode = userBean.getOrgCode();
		QueryWrapper<ZzglBmgwM> queryWrapper = new QueryWrapper<>();
		queryWrapper.eq("org_code", orgCode).eq("id", gwid);
邓实川 committed
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
		ZzglBmgwM zzglBmgwM = ZzglBmgwM.builder().build().selectOne(queryWrapper);
		String gw = null;
		Integer bmid = null;
		if (zzglBmgwM != null) {
			gw = zzglBmgwM.getName();
			bmid = zzglBmgwM.getUpId();
		}
		ZzglBmgwM z = ZzglBmgwM.builder().build()
				.selectOne(new QueryWrapper<ZzglBmgwM>().eq("org_code", orgCode).eq("id", bmid));
		String bm = null;
		if (z != null) {
			bm = z.getName();
		}
		String bmgw = bm + "/" + gw;
		return ResultUtil.data(bmgw, "获取员工档案部门岗位名称成功");
	}

351
	/**
352 353 354
	 * 添加员工档案
	 * @param userBean
	 * @param addygdaDto
355 356
	 * @return
	 */
东州 翁 committed
357 358
	@PostMapping(value = "/addygda")
	@ApiOperation(value = "添加员工档案", httpMethod = "POST", notes = "接口发布说明")
359
	@ApiOperationSupport(order = 4)
360
	public Result<Object> addygda(@CurrentUser UserBean userBean,@Validated @RequestBody AddygdaDto addygdaDto) throws Exception{
东州 翁 committed
361 362 363 364 365 366
		Integer orgCode = userBean.getOrgCode();
		String name = addygdaDto.getName();
		String phone = addygdaDto.getPhone();
		Integer zjType = addygdaDto.getZjType();
		String zjNum = addygdaDto.getZjNum();
		Integer jobType = addygdaDto.getJobType();
东州 翁 committed
367
		Date rzTime = new Date();
东州 翁 committed
368 369 370 371 372 373 374 375
		Integer syq = addygdaDto.getSyq();
		Integer sex = addygdaDto.getSex();
		if (StrUtil.hasBlank(phone) || StrUtil.hasBlank(name) || StrUtil.hasBlank(zjNum)) {
			return ResultUtil.error("请输入员工姓名,手机号和身份证号");
		}
		QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
				.eq(!StrUtil.hasBlank(phone), QyzxEmpLogin::getPhone, phone).one();
		if (login == null) {
376 377
			// 初始化密码  pwd
			QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(phone).pw(Md5.md5(pwd))
东州 翁 committed
378 379 380 381 382 383 384 385
					.sts(CommonEnum.U_STS_ON.getType()).orgId(userBean.getOrgCode()).username(name).build();
			if (!qyzxEmpLogin.insert()) {
				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
				return ResultUtil.error("添加员工登录表失败,请检查输入信息");
			}
			// 添加三张表
			// 员工权限表(未定)
			// 员工企业关联表和员工档案,员工成长表(未定)
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
			QyzxEmpEntAsso.builder()
				.empNum(qyzxEmpLogin.getId())
				.orgCode(orgCode)
				.userType(CommonEnum.U_TYPE_EMP.getType())
				.status(1)
				.build()
				.insert();// usertype2普通员工 status1正常
			YgglMainEmp 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(qyzxEmpLogin.getId())
					.orgCode(orgCode)
东州 翁 committed
405 406
					.build();
			ygglMainEmp.insert();
407 408

			if (addygdaDto.getBmgwId() != null) {
409
				new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
410 411
						.set(YgglMainEmp::getBmgwId, addygdaDto.getBmgwId())
						.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getId, ygglMainEmp.getId()).update();
412
			}
413

东州 翁 committed
414 415
			return ResultUtil.data(ygglMainEmp, "新添加员工档案成功!");
		} else {
邓实川 committed
416

417 418 419 420
			YgglMainEmp ishad = ygglMainEmpMapper.selectOne(new QueryWrapper<YgglMainEmp>()
					.lambda()
					.eq(YgglMainEmp::getPhone, phone)
					.eq(YgglMainEmp::getOrgCode, orgCode));
421

东州 翁 committed
422 423 424
			if (ishad == null) {
				// 添加三张表
				// 员工权限表(未定)
425 426 427 428 429 430 431
				QyzxEmpEntAsso.builder()
				.empNum(login.getId())
				.orgCode(orgCode)
				.userType(2)
				.status(1)
				.build()
				.insert();// usertype2普通员工
432
																														// status1正常
433 434 435 436 437 438 439 440 441 442 443 444
				YgglMainEmp 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)
东州 翁 committed
445 446
						.build();
				ygglMainEmp.insert();
447 448 449 450 451
				if (addygdaDto.getBmgwId() != null) {
					new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
							.set(YgglMainEmp::getBmgwId, addygdaDto.getBmgwId())
							.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getId, ygglMainEmp.getId()).update();
				}
东州 翁 committed
452 453 454 455 456 457
				return ResultUtil.data(ygglMainEmp, "添加员工档案成功!");
			} else {
				return ResultUtil.error("该手机号已被使用,请输入正确手机号");
			}
		}
	}
邓实川 committed
458

459
	/**
东州 翁 committed
460
	 * 修改员工档案
邓实川 committed
461
	 * 
462 463 464
	 * @param
	 * @return
	 */
东州 翁 committed
465 466
	@PostMapping(value = "/updateygda")
	@ApiOperation(value = "修改员工档案", httpMethod = "POST", notes = "接口发布说明")
太阳与水 committed
467
	@ApiOperationSupport(order = 5)
468 469
	public Result<Object> updateygda(@CurrentUser UserBean userBean, @RequestBody YgglMainEmp ygglMainEmp)
			throws Exception {
470

东州 翁 committed
471 472 473 474
		if (ygglMainEmp.getEmpNum() != null) {
			UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
			updateWrapper.eq("org_code", userBean.getOrgCode()).eq("emp_num", ygglMainEmp.getEmpNum());
			ygglMainEmp.update(updateWrapper);
475

476 477 478 479 480 481 482
//			Integer count = qyzxEmpLoginMapper.selectCount(new QueryWrapper<QyzxEmpLogin>().lambda().eq(QyzxEmpLogin::getPhone, ygglMainEmp.getPhone()));
//			if (count >= 1) {
//				return ResultUtil.error("手机号已被使用!");
//			}
//			
//			QyzxEmpLogin.builder().phone(ygglMainEmp.getPhone()).build()
//		     .update(new QueryWrapper<QyzxEmpLogin>().lambda().eq(QyzxEmpLogin::getId, userBean.getEmpNum()));
东州 翁 committed
483 484 485 486
			return ResultUtil.data(ygglMainEmp, "修改成功");
		}
		return ResultUtil.error("请确认该员工是否存在!");
	}
邓实川 committed
487

488
	/**
东州 翁 committed
489
	 * 员工搜索
邓实川 committed
490
	 * 
491 492 493
	 * @param
	 * @return
	 */
东州 翁 committed
494 495
	@PostMapping(value = "/ygquery")
	@ApiOperation(value = "员工搜索/分页", httpMethod = "POST", notes = "接口发布说明")
太阳与水 committed
496
	@ApiOperationSupport(order = 6)
东州 翁 committed
497 498 499 500 501
	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)
邓实川 committed
502
				.eq(ZzglBmgwM::getOrgCode, orgCode).list();
东州 翁 committed
503
		ZzglBmgwM.getDepts(bList, b, zzglBmgwMs);
504

东州 翁 committed
505 506 507 508
		Integer j = ygQueryDto.getJobStatus();
		Integer t = ygQueryDto.getJobType();
		String q = ygQueryDto.getQuery();
		Page<YgglMainEmp> page = new Page<YgglMainEmp>(
邓实川 committed
509 510
				ygQueryDto.getCurrentPage() == null ? 1 : ygQueryDto.getCurrentPage(),
				ygQueryDto.getTotalPage() == null ? 10 : ygQueryDto.getTotalPage());
东州 翁 committed
511
		QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
邓实川 committed
512
		queryWrapper.select("name", "emp_num", "bmgw_id", "rz_time", "job_type", "phone", "job_status")
513
				.ne("job_status", YgEnumInterface.jobStatus.YILIZHI.getType()).eq("org_code", orgCode)
514 515 516 517
				.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));

东州 翁 committed
518 519 520 521 522
//		List<YgglMainEmp> lo = YgglMainEmp.builder().build().selectList(queryWrapper);
		IPage<YgglMainEmp> ygglMainEmpPage = YgglMainEmp.builder().build().selectPage(page, queryWrapper);
		// List<YgglMainEmp> ygglMainEmps = ygglMainEmpPage.getRecords();
		return ResultUtil.data(ygglMainEmpPage, "员工搜索成功");
		// return ResultUtil.data(ygglMainEmpPage, ygglMainEmps, "员工搜索成功");
523
	}
tangzhaoqian committed
524 525 526 527 528 529 530 531 532 533 534 535 536
	
	/**
	 * 导入员工档案
	 */
	@PostMapping(value = "/import_emp_record")
	@ApiOperation(value = "导入员工档案", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 7)
	public Result<List<YgDrjqbDto>> importEmpRecord(
			@CurrentUser UserBean userBean/* ,@Validated @RequestBody List<AddygdaDto> listAddygdaDto */) {
			
		
		List<QyzxEmpLogin> listEl = qyzxEmpLoginMapper.selectList(new QueryWrapper<QyzxEmpLogin>().lambda()
				.select(QyzxEmpLogin::getPhone));
tangzhaoqian committed
537 538 539 540 541 542
		listEl = listEl != null ? listEl.stream()
				
				
				.filter(o -> o != null && o.getPhone() != null)
				.collect(Collectors.toList()) : null;
		System.out.println(JSONUtil.parseObj(listEl));
tangzhaoqian committed
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
//		listEl.stream().filter(predicate)
//		listEl.stream().filter(item -> objId.equals(item.getUpId())).forEach(zzglBmgwM -> {
//			list.add(zzglBmgwM.getId());
//			getDepts(list, zzglBmgwM.getId(), objs);
//		});
		
		//抽取 登录表 的phone的集合
		List<String> listPhone = listEl.stream()
				.map(QyzxEmpLogin::getPhone)
				.collect(Collectors.toList());

		System.out.println(JSONUtil.parseObj(listPhone));
		listEl.stream().filter(i -> i != null).collect(Collectors.<QyzxEmpLogin>toList());
		return null;
	}
	
559
	/**
东州 翁 committed
560
	 * 导入威力加强版
邓实川 committed
561
	 * 
562 563 564
	 * @param
	 * @return
	 */
东州 翁 committed
565 566
	@PostMapping(value = "/ygdas")
	@ApiOperation(value = "导入威力加强版", httpMethod = "POST", notes = "接口发布说明")
邓实川 committed
567
	public Result<List<YgDrjqbDto>> ygdr(@CurrentUser UserBean userBean, @RequestBody YgDrsDto drList) {
568
		drList.setErrorList(new ArrayList<YgDrjqbDto>());
东州 翁 committed
569
		drList.setOrgCode(userBean.getOrgCode());
邓实川 committed
570 571 572 573 574 575 576 577
		YgDrsDto tofList = errorFilter(drList);// 滤嘴,过滤信息
		if (tofList.getDrList().size() == 0)
			return ResultUtil.data(tofList.getErrorList(), "导入发生错误人员名单");
		YgDrsDto tof = optFilter(tofList);// 彻底规范好数据
		List<YgDrjqbDto> trueList = tof.getDrList();// 拿出正确的信息
		List<YgDrjqbDto> errorList = tof.getErrorList();// 拿出错误的信息
		if (trueList.size() == 0)
			return ResultUtil.data(errorList, "导入发生错误人员名单");
东州 翁 committed
578
		for (YgDrjqbDto e : trueList) {
邓实川 committed
579 580 581 582 583
			QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
					.eq(QyzxEmpLogin::getPhone, e.getPhone()).one();
			// 证件类型为0
			Integer jobType = Integer.valueOf(e.getJobType());// 工作类型
			Integer syq = Integer.valueOf(e.getSyq());// 试用期
tangzhaoqian committed
584
			Integer sex = Integer.valueOf(e.getSex());// 性别
邓实川 committed
585
			Integer gw = e.getHavebmid();
东州 翁 committed
586 587 588
			String jobNum = e.getYgnbgh();
			Integer jg = e.getJg();
			Date birthday = e.getBirthday();
邓实川 committed
589
			// 入职日期
东州 翁 committed
590
			Date rzdate = new Date();
邓实川 committed
591 592
			SimpleDateFormat straight = new SimpleDateFormat("yyyy-MM-dd");// 正杠
			if (e.getRzTime().indexOf("-") != -1) {
东州 翁 committed
593 594 595 596 597 598 599 600 601
				try {
					rzdate = straight.parse(e.getRzTime());
				} catch (ParseException PException) {
					PException.printStackTrace();
					e.setError("请填写正确的时间格式");
					errorList.add(e);
					continue;
				}
			}
邓实川 committed
602 603
			// 判断是否已有员工登录表
			if (login == null) {// 添加三张表
东州 翁 committed
604 605 606 607 608 609 610 611 612 613
				QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(e.getPhone()).pw(Md5.md5("123456"))
						.sts(CommonEnum.U_STS_ON.getType()).orgId(userBean.getOrgCode()).username(e.getName()).build();
				if (!qyzxEmpLogin.insert()) {
					TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
					e.setError("员工无法添加!");
					errorList.add(e);
					continue;
				}
				// 员工权限表(未定)
				// 员工企业关联表和员工档案,员工成长表(未定)
邓实川 committed
614
				QyzxEmpEntAsso.builder().empNum(qyzxEmpLogin.getId()).orgCode(userBean.getOrgCode()).userType(2)
615
						.status(1).build().insert();// userType2普通员工,status1正常
邓实川 committed
616 617 618 619
				YgglMainEmp emp = YgglMainEmp.builder().name(e.getName()).phone(e.getPhone()).zjType(0).zjNum(e.getZj())
						.jobType(jobType).rzTime(rzdate).updateTime(new Date()).updateMan(userBean.getEmpNum()).syq(syq)
						.sex(sex).jobNum(jobNum).bmgwId(gw).empNum(qyzxEmpLogin.getId()).orgCode(userBean.getOrgCode())
						.build();
东州 翁 committed
620 621
				emp.insert();
				new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
邓实川 committed
622 623 624 625 626 627
						.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).eq(YgglMainEmp::getId, emp.getId())
						.set(birthday != null, YgglMainEmp::getBirthday, birthday)
						.set(jg != null && jg != 0, YgglMainEmp::getJg, jg).update();

				// return ResultUtil.data(ygglMainEmp, "新添加员工档案成功!");
			} else {
东州 翁 committed
628
				// 添加两张表
邓实川 committed
629
				YgglMainEmp ishad = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>()
东州 翁 committed
630 631 632
						.eq("phone", e.getPhone()).eq("org_code", userBean.getOrgCode()));
				if (ishad == null) {
					// 员工权限表(未定)
633 634
					QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(userBean.getOrgCode()).userType(2).status(1)
							.build().insert();// userType2普通员工,status1正常
邓实川 committed
635 636 637 638
					YgglMainEmp emp = YgglMainEmp.builder().name(e.getName()).phone(e.getPhone()).zjType(0)
							.zjNum(e.getZj()).jobType(jobType).rzTime(rzdate).updateTime(new Date())
							.updateMan(userBean.getEmpNum()).syq(syq).sex(sex).jobNum(jobNum).empNum(login.getId())
							.orgCode(userBean.getOrgCode()).build();
东州 翁 committed
639 640
					emp.insert();
					new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
邓实川 committed
641 642 643
							.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).eq(YgglMainEmp::getId, emp.getId())
							.set(birthday != null, YgglMainEmp::getBirthday, birthday)
							.set(jg != null && jg != 0, YgglMainEmp::getJg, jg).update();
东州 翁 committed
644 645 646 647
				} else {
					e.setError("该手机号码已被使用");
					errorList.add(e);
					continue;
邓实川 committed
648

东州 翁 committed
649 650 651
				}
			}
		}
邓实川 committed
652
		if (errorList.size() == 0) {
东州 翁 committed
653 654 655
			return ResultUtil.success("员工全部导入成功!");
		}
		return ResultUtil.data(errorList, "导入发生错误人员名单");
太阳与水 committed
656
	}
邓实川 committed
657 658

	// 错误选项过滤器
东州 翁 committed
659 660 661 662
	public YgDrsDto errorFilter(YgDrsDto ygDrsDto) {
		List<YgDrjqbDto> drList = ygDrsDto.getDrList();
		List<YgDrjqbDto> newList = new ArrayList<YgDrjqbDto>(drList);
		List<YgDrjqbDto> errorList = ygDrsDto.getErrorList();
邓实川 committed
663 664
		Integer orgCode = ygDrsDto.getOrgCode();

东州 翁 committed
665
		Iterator<YgDrjqbDto> itDr = drList.iterator();
东州 翁 committed
666
		@SuppressWarnings("unused")
邓实川 committed
667 668 669 670
		YgDrjqbDto a = drList.get(0);// 一个员工导入
		Integer size = drList.size();
		for (Integer i = 0; i < size; i++) {//
			YgDrjqbDto d = newList.get(i);// 计数器
东州 翁 committed
671
			if (itDr.hasNext()) {
邓实川 committed
672 673
				a = itDr.next();

东州 翁 committed
674
			}
邓实川 committed
675 676 677 678 679 680
			// 请填写必填项
			String name = newList.get(i).getName();
			String phone = newList.get(i).getPhone();
			String sex = newList.get(i).getSex();
			String zj = newList.get(i).getZj();
			if (StrUtil.hasBlank(name) || StrUtil.hasBlank(phone) || StrUtil.hasBlank(sex) || StrUtil.hasBlank(zj)) {
东州 翁 committed
681
				d.setError("请填写必填项");
邓实川 committed
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704
				errorList.add(d);
				itDr.remove();
				i++;
				continue;
			}
			// 手机号码格式不对
			String regex = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,5-9]))\\d{8}$";
			if (phone.length() != 11) {
				d.setError("手机号应为11位数");
				errorList.add(d);
				itDr.remove();
				i++;
				continue;
			}
			Pattern p = Pattern.compile(regex);
			Matcher m = p.matcher(phone);
			boolean isMatch = m.matches();
			if (!isMatch) {
				d.setError("手机号格式不对");
				errorList.add(d);
				itDr.remove();
				i++;
				continue;
东州 翁 committed
705
			}
邓实川 committed
706 707 708 709 710 711 712 713 714
			// 手机号码已被使用
			QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
					.eq(QyzxEmpLogin::getPhone, phone).eq(QyzxEmpLogin::getOrgId, orgCode).one();
			if (login != null) {
				d.setError("手机号码已被使用");
				errorList.add(d);
				itDr.remove();
				i++;
				continue;
东州 翁 committed
715
			}
邓实川 committed
716 717 718 719 720 721 722
			// 证件号码信息有误
			if (zj == null || "".equals(zj)) {
				d.setError("证件号码信息有误");
				errorList.add(d);
				itDr.remove();
				i++;
				continue;
东州 翁 committed
723
			}
邓实川 committed
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784
			String regularExpression = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|"
					+ "(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)";
			boolean matches = zj.matches(regularExpression);
			if (!matches) {
				d.setError("证件号码信息有误");
				errorList.add(d);
				itDr.remove();
				i++;
				continue;
			}
			try {
				if (zj.length() == 18) {
					char[] charArray = zj.toCharArray();
					// 前十七位加权因子
					int[] idCardWi = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
					// 这是除以11后,可能产生的11位余数对应的验证码
					String[] idCardY = { "1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2" };
					int sum = 0;
					for (Integer j = 0; j < idCardWi.length; j++) {
						int current = Integer.parseInt(String.valueOf(charArray[j]));
						int count = current * idCardWi[j];
						sum += count;
					}
					char idCardLast = charArray[17];
					int idCardMod = sum % 11;
					if (idCardY[idCardMod].toUpperCase().equals(String.valueOf(idCardLast).toUpperCase())) {
						// System.out.println("成功,接着完善员工的个人信息");
						String birth = zj.substring(6, 14);
						String birthday = birth.substring(0, 4) + "-" + birth.substring(4, 6) + "-"
								+ birth.substring(6, 8);
						SimpleDateFormat straight = new SimpleDateFormat("yyyy-MM-dd");
						d.setBirthday(straight.parse(birthday));
						d.setJg(Integer.parseInt(zj.substring(0, 6)));
					} else {
						// System.out.println("身份证最后一位:" + String.valueOf(idCardLast).toUpperCase() +
						// "错误,正确的应该是:" + idCardY[idCardMod].toUpperCase());
						// return false;
						d.setError("证件号码信息有误");
						errorList.add(d);
						itDr.remove();
						i++;
						continue;
					}
				} else {
					// 给15位数的添加生日籍贯
					String birth = zj.substring(6, 12);
					String birthday = "19" + birth.substring(0, 2) + "-" + birth.substring(2, 4) + "-"
							+ birth.substring(4, 6);
					SimpleDateFormat straight = new SimpleDateFormat("yyyy-MM-dd");
					d.setBirthday(straight.parse(birthday));
					d.setJg(Integer.parseInt(zj.substring(0, 6)));
				}
			} catch (Exception e) {
				e.printStackTrace();
				// System.out.println("异常:" + zj);
				// return false;
				d.setError("证件号码信息有误");
				errorList.add(d);
				itDr.remove();
				i++;
				continue;
东州 翁 committed
785
			}
邓实川 committed
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805
			// 部门岗位有误
			String oneb = newList.get(i).getOneb();
			String twob = newList.get(i).getTwob();
			String threeb = newList.get(i).getThreeb();
			String fourb = newList.get(i).getFourb();
			String gw = newList.get(i).getGw();
			String[] bms = { oneb, twob, threeb, fourb };
			if (StrUtil.hasBlank(gw) && StrUtil.hasBlank(oneb) && StrUtil.hasBlank(twob) && StrUtil.hasBlank(threeb)
					&& StrUtil.hasBlank(fourb)) { // 没填写岗位,通过~ //
			} else {
				// 填写了部门岗位,办他!
				Integer isHaveBmgw = isHavebmgw(bms, gw, orgCode);
				if (isHaveBmgw == 0) {
					d.setError("部门岗位有误");
					errorList.add(d);
					itDr.remove();
					i++;
					continue;
				} else {
					// 获取到部门岗位id啦!
东州 翁 committed
806 807 808
					d.setHavebmid(isHaveBmgw);
				}
			}
邓实川 committed
809 810

		} // for循环完毕!
东州 翁 committed
811
		YgDrsDto tofList = new YgDrsDto(drList, errorList, orgCode);
邓实川 committed
812
		return tofList;
太阳与水 committed
813
	}
邓实川 committed
814 815

	// 选填项过滤器
东州 翁 committed
816 817 818 819 820
	public YgDrsDto optFilter(YgDrsDto ygDrsDto) {
		List<YgDrjqbDto> drList = ygDrsDto.getDrList();
		List<YgDrjqbDto> newList = new ArrayList<YgDrjqbDto>(drList);
		List<YgDrjqbDto> errorList = ygDrsDto.getErrorList();
		Integer orgCode = ygDrsDto.getOrgCode();
邓实川 committed
821

东州 翁 committed
822
		Iterator<YgDrjqbDto> itDr = drList.iterator();
东州 翁 committed
823
		@SuppressWarnings("unused")
邓实川 committed
824 825 826 827
		YgDrjqbDto a = drList.get(0);// 一个员工导入
		Integer size = drList.size();
		for (Integer i = 0; i < size; i++) {//
			YgDrjqbDto d = newList.get(i);// 计数器
东州 翁 committed
828
			if (itDr.hasNext()) {
邓实川 committed
829
				a = itDr.next();
东州 翁 committed
830
			}
邓实川 committed
831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847
			// for (YgDrjqbDto d : drList) {
			String ygnbgh = d.getYgnbgh();
			String sex = d.getSex();
			String jobType = d.getJobType();
			String jobStatus = d.getJobStatus();
			String rzTime = d.getRzTime();
			String syq = d.getSyq();

			String zy = d.getZy();
			String address = d.getAddress();
			String hjAddress = d.getHkAddress();
			String qq = d.getQq();
			String weixin = d.getWeixin();
			String email = d.getEmail();
			String[] bathroom = { ygnbgh, sex, jobType, jobStatus, rzTime, syq, zy, address, hjAddress, qq, weixin,
					email };
			boolean child = takeshower(bathroom);
东州 翁 committed
848 849
			if (child == false) {
				d.setError("填写内容不要大于50字数");
邓实川 committed
850 851 852 853
				errorList.add(d);
				itDr.remove();
				i++;
				continue;
东州 翁 committed
854
			}
邓实川 committed
855
			// 公司内部工号
东州 翁 committed
856 857
			if (ygnbgh != null && ygnbgh.length() != 0) {
				d.setYgnbgh(ygnbgh.trim());
邓实川 committed
858
			} else {
tangzhaoqian committed
859
				SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
邓实川 committed
860
				String bh = format.format(new Date()) + orgCode + i + System.currentTimeMillis();
东州 翁 committed
861 862
				d.setYgnbgh(bh);
			}
邓实川 committed
863
			// 男女(最大优化)
东州 翁 committed
864
			d.setSex(YgEnumInterface.sex.isMan(sex));
邓实川 committed
865
			// 工作性质(最大优化)
东州 翁 committed
866
			d.setJobType(YgEnumInterface.YgJobType.choose(jobType));
邓实川 committed
867
			// 员工状态(最大优化)
东州 翁 committed
868
			d.setJobStatus(YgEnumInterface.jobStatus.isZhen(jobStatus));
邓实川 committed
869
			// 入职日期(最大优化)
870 871
			d.setRzTime(
					rzTime != null ? YgEnumInterface.rzTime.tranTime2(YgEnumInterface.rzTime.tranTime(rzTime)) : null);
邓实川 committed
872
			// 试用期(最大优化)
东州 翁 committed
873 874
			d.setSyq(YgEnumInterface.syq.choose(syq));
		}
邓实川 committed
875
		YgDrsDto clear = new YgDrsDto(drList, errorList, orgCode);
东州 翁 committed
876 877
		return clear;
	}
邓实川 committed
878 879 880

	// 浴池,洗去选填项字节大于100的选项
	public boolean takeshower(String[] bathroom) {
东州 翁 committed
881
		for (String b : bathroom) {
882
			if (b != null && b.length() > 100) {
邓实川 committed
883 884
				return false;
			}
885

邓实川 committed
886 887 888 889 890 891 892
		}
		return true;
	}

	// 判断是否导入组织部门
	public Integer isHavebmgw(String[] bms, String gw, Integer orgCode) {
		// 将姓名转为部门岗位对象
东州 翁 committed
893
		List<ZzglBmgwM> gwList = new ArrayList<ZzglBmgwM>();
邓实川 committed
894
		// 判断有几个部门,且这几个部门是否属实,里面不包括岗位
东州 翁 committed
895
		for (String bm : bms) {
邓实川 committed
896 897 898 899 900 901
			if (!StrUtil.hasBlank(bm)) {
				ZzglBmgwM ibm = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).eq(ZzglBmgwM::getName, bm)
						.eq(ZzglBmgwM::getOrgCode, orgCode).eq(ZzglBmgwM::getType, 0).one(); // 选择部门类型0为部门,1为岗位
				if (ibm == null) {
					return 0;
				} // 找不到有相关名称的部门则报错
东州 翁 committed
902
				gwList.add(ibm);
邓实川 committed
903
			} else {
东州 翁 committed
904 905 906
				break;
			}
		}
邓实川 committed
907 908 909 910 911
		Integer qiantao = qiantao(gwList, gw, 0, orgCode);
		if (qiantao != 0) {
			return qiantao;// 组织部门成立!
		} else {
			return 0;// 失败
东州 翁 committed
912
		}
邓实川 committed
913

东州 翁 committed
914
	};
邓实川 committed
915 916 917 918 919

	// 判断是否导入组织部门的嵌套并寻找到正确岗位id
	public Integer qiantao(List<ZzglBmgwM> gwList, String gw, Integer upid, Integer orgCode) {
		// 重写
		if (upid != 0 && !gwList.get(0).getUpId().equals(upid)) {
东州 翁 committed
920 921 922
			return 0;
		}
		upid = gwList.get(0).getId();
邓实川 committed
923

东州 翁 committed
924
		if (gwList.size() == 1) {
邓实川 committed
925 926 927
			ZzglBmgwM igw = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).eq(ZzglBmgwM::getName, gw)
					.eq(ZzglBmgwM::getUpId, upid).eq(ZzglBmgwM::getOrgCode, orgCode).eq(ZzglBmgwM::getType, 1).one();
			if (igw == null) {
东州 翁 committed
928 929 930 931 932
				return 0;
			}
			return igw.getId();
		}
		gwList.remove(0);
邓实川 committed
933
		Integer q = qiantao(gwList, gw, upid, orgCode);
东州 翁 committed
934 935
		return q;
	};
邓实川 committed
936

太阳与水 committed
937
	/**
东州 翁 committed
938
	 * 导出员工
邓实川 committed
939
	 * 
太阳与水 committed
940 941 942
	 * @param
	 * @return
	 */
东州 翁 committed
943 944 945 946
	@GetMapping(value = "/ygdas")
	@ApiOperation(value = "导出", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 8)
	public Result<List<YgglMainEmp>> selectygdas(@CurrentUser UserBean userBean) {
邓实川 committed
947 948 949
		int[] jList = { 1, 2, 3 };
		List<YgglMainEmp> list = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
				.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).in(YgglMainEmp::getJobStatus, jList).list();
东州 翁 committed
950
		return ResultUtil.data(list, "导出员工成功");
太阳与水 committed
951
	}
邓实川 committed
952

太阳与水 committed
953
	/**
东州 翁 committed
954
	 * 获取员工教育经历表
邓实川 committed
955
	 * 
太阳与水 committed
956 957 958
	 * @param
	 * @return
	 */
东州 翁 committed
959 960 961 962
	@GetMapping(value = "/jyjlb")
	@ApiOperation(value = "获取员工教育经历表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 9)
	public Result<List<YgglAttaJyjlb>> selectjyjlb(@CurrentUser UserBean userBean) {
邓实川 committed
963 964 965
		List<YgglAttaJyjlb> ygglAttaJyjlbss = YgglAttaJyjlb.builder().build()
				.selectList(new QueryWrapper<YgglAttaJyjlb>().eq("org_code", userBean.getOrgCode()).eq("emp_num",
						userBean.getEmpNum()));
东州 翁 committed
966 967
		return ResultUtil.data(ygglAttaJyjlbss, "获取员工教育经历表成功");
	}
邓实川 committed
968

东州 翁 committed
969 970 971 972 973 974 975 976 977
	// 获取员工教育经历表
	@GetMapping(value = "/jyjlb/{empNum}")
	@ApiOperation(value = "获取员工教育经历表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 10)
	public Result<List<YgglAttaJyjlb>> selectjyjlb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaJyjlb> ygglAttaJyjlbs = YgglAttaJyjlb.builder().build().selectList(
				new QueryWrapper<YgglAttaJyjlb>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
		return ResultUtil.data(ygglAttaJyjlbs, "获取员工教育经历表成功");
	}
邓实川 committed
978

东州 翁 committed
979 980
	/**
	 * 添加/修改员工教育经历表
邓实川 committed
981
	 * 
太阳与水 committed
982 983 984
	 * @param
	 * @return
	 */
东州 翁 committed
985 986 987 988 989 990 991 992
	@PostMapping(value = "/jyjlb")
	@ApiOperation(value = "添加/修改员工教育经历表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 11)
	public Result<YgglAttaJyjlb> addjyjlb(@CurrentUser UserBean userBean, @RequestBody YgglAttaJyjlb ygglAttaJyjlb) {
		ygglAttaJyjlb.setEmpNum(ygglAttaJyjlb.getEmpNum());
		ygglAttaJyjlb.setOrgCode(userBean.getOrgCode());
		ygglAttaJyjlb.insertOrUpdate();
		return ResultUtil.data(ygglAttaJyjlb, "添加/修改员工教育经历表成功");
太阳与水 committed
993
	}
邓实川 committed
994

太阳与水 committed
995
	/**
东州 翁 committed
996
	 * 删除员工教育经历表
邓实川 committed
997
	 * 
东州 翁 committed
998 999
	 * @param
	 * @return
太阳与水 committed
1000
	 */
东州 翁 committed
1001 1002 1003 1004
	@DeleteMapping(value = "/jyjlb/{id}")
	@ApiOperation(value = "删除员工教育经历表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 12)
	public Result<Boolean> deljyjlb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
太阳与水 committed
1005
		Integer orgCode = userBean.getOrgCode();
东州 翁 committed
1006 1007
		return ResultUtil.data(YgglAttaJyjlb.builder().build()
				.delete(new QueryWrapper<YgglAttaJyjlb>().eq("org_code", orgCode).eq("id", id)), "删除员工教育经历表成功");
太阳与水 committed
1008
	}
邓实川 committed
1009

东州 翁 committed
1010 1011
	/**
	 * 获取员工培训经历信息表
邓实川 committed
1012
	 * 
东州 翁 committed
1013 1014 1015 1016 1017 1018 1019
	 * @param
	 * @return
	 */
	@GetMapping(value = "/pxjlxxb")
	@ApiOperation(value = "获取员工培训经历信息表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 13)
	public Result<List<YgglAttaPxjlxxb>> selectpxjlxxb(@CurrentUser UserBean userBean) {
邓实川 committed
1020 1021 1022
		List<YgglAttaPxjlxxb> ygglAttaPxjlxxbs = YgglAttaPxjlxxb.builder().build()
				.selectList(new QueryWrapper<YgglAttaPxjlxxb>().eq("org_code", userBean.getOrgCode()).eq("emp_num",
						userBean.getEmpNum()));
东州 翁 committed
1023 1024
		return ResultUtil.data(ygglAttaPxjlxxbs, "获取员工培训经历信息表成功");
	}
邓实川 committed
1025

东州 翁 committed
1026 1027 1028 1029 1030 1031 1032 1033 1034
	// 获取员工培训经历信息表
	@GetMapping(value = "/pxjlxxb/{empNum}")
	@ApiOperation(value = "获取员工培训经历信息表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 14)
	public Result<List<YgglAttaPxjlxxb>> selectpxjlxxb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaPxjlxxb> ygglAttaPxjlxxbs = YgglAttaPxjlxxb.builder().build().selectList(
				new QueryWrapper<YgglAttaPxjlxxb>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
		return ResultUtil.data(ygglAttaPxjlxxbs, "获取员工培训经历信息表成功");
	}
邓实川 committed
1035

东州 翁 committed
1036 1037
	/**
	 * 添加/修改员工培训经历信息表
邓实川 committed
1038
	 * 
东州 翁 committed
1039 1040 1041 1042 1043
	 * @param
	 * @return
	 */
	@PostMapping(value = "/pxjlxxb")
	@ApiOperation(value = "添加/修改员工培训经历信息表", httpMethod = "POST", notes = "接口发布说明")
1044
	@ApiOperationSupport(order = 15)
东州 翁 committed
1045 1046 1047 1048 1049 1050
	public Result<YgglAttaPxjlxxb> addpxjlxxb(@CurrentUser UserBean userBean,
			@RequestBody YgglAttaPxjlxxb ygglAttaPxjlxxb) {
		ygglAttaPxjlxxb.setEmpNum(ygglAttaPxjlxxb.getEmpNum());
		ygglAttaPxjlxxb.setOrgCode(userBean.getOrgCode());
		ygglAttaPxjlxxb.insertOrUpdate();
		return ResultUtil.data(ygglAttaPxjlxxb, "添加/修改员工培训经历信息表成功");
1051
	}
邓实川 committed
1052

东州 翁 committed
1053 1054
	/**
	 * 删除员工培训经历信息表
邓实川 committed
1055
	 * 
东州 翁 committed
1056 1057 1058 1059 1060
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/pxjlxxb/{id}")
	@ApiOperation(value = "删除员工培训经历信息表", httpMethod = "DELETE", notes = "接口发布说明")
1061
	@ApiOperationSupport(order = 16)
东州 翁 committed
1062 1063 1064 1065 1066
	public Result<Boolean> delpxjlxxb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaPxjlxxb.builder().build()
				.delete(new QueryWrapper<YgglAttaPxjlxxb>().eq("org_code", orgCode).eq("id", id)), "删除员工培训经历信息表成功");
	}
邓实川 committed
1067

东州 翁 committed
1068 1069
	/**
	 * 获取员工工作经历表
邓实川 committed
1070
	 * 
东州 翁 committed
1071 1072 1073 1074 1075 1076 1077
	 * @param
	 * @return
	 */
	@GetMapping(value = "/gzjlb")
	@ApiOperation(value = "获取员工工作经历表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 17)
	public Result<List<YgglAttaGzjlb>> selectgzjlb(@CurrentUser UserBean userBean) {
邓实川 committed
1078 1079 1080
		List<YgglAttaGzjlb> ygglAttaGzjlbs = YgglAttaGzjlb.builder().build()
				.selectList(new QueryWrapper<YgglAttaGzjlb>().eq("org_code", userBean.getOrgCode()).eq("emp_num",
						userBean.getEmpNum()));
东州 翁 committed
1081
		return ResultUtil.data(ygglAttaGzjlbs, "获取员工工作经历表成功");
太阳与水 committed
1082
	}
邓实川 committed
1083

太阳与水 committed
1084 1085 1086
	// 获取员工工作经历表
	@GetMapping(value = "/gzjlb/{empNum}")
	@ApiOperation(value = "获取员工工作经历表(管)", httpMethod = "GET", notes = "接口发布说明")
东州 翁 committed
1087
	@ApiOperationSupport(order = 18)
太阳与水 committed
1088 1089 1090 1091 1092
	public Result<List<YgglAttaGzjlb>> selectgzjlb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaGzjlb> ygglAttaGzjlbs = YgglAttaGzjlb.builder().build().selectList(
				new QueryWrapper<YgglAttaGzjlb>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
		return ResultUtil.data(ygglAttaGzjlbs, "获取员工工作经历表成功");
	}
邓实川 committed
1093

东州 翁 committed
1094 1095
	/**
	 * 添加/修改员工工作经历表
邓实川 committed
1096
	 * 
东州 翁 committed
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108
	 * @param
	 * @return
	 */
	@PostMapping(value = "/gzjlb")
	@ApiOperation(value = "添加/修改员工工作经历表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 19)
	public Result<YgglAttaGzjlb> addgzjlb(@CurrentUser UserBean userBean, @RequestBody YgglAttaGzjlb ygglAttaGzjlb) {
		ygglAttaGzjlb.setEmpNum(ygglAttaGzjlb.getEmpNum());
		ygglAttaGzjlb.setOrgCode(userBean.getOrgCode());
		ygglAttaGzjlb.insertOrUpdate();
		return ResultUtil.data(ygglAttaGzjlb, "添加/修改员工工作经历表成功");
	}
邓实川 committed
1109

东州 翁 committed
1110 1111
	/**
	 * 删除员工工作经历表
邓实川 committed
1112
	 * 
东州 翁 committed
1113 1114 1115 1116 1117 1118 1119 1120 1121
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/gzjlb/{id}")
	@ApiOperation(value = "删除员工工作经历表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 20)
	public Result<Boolean> delgzjlb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaGzjlb.builder().build()
邓实川 committed
1122
				.delete(new QueryWrapper<YgglAttaGzjlb>().eq("org_code", orgCode).eq("id", id)), "删除员工工作经历表成功");
东州 翁 committed
1123
	}
邓实川 committed
1124

东州 翁 committed
1125 1126
	/**
	 * 获取员工职称信息表
邓实川 committed
1127
	 * 
东州 翁 committed
1128 1129 1130 1131 1132 1133 1134
	 * @param
	 * @return
	 */
	@GetMapping(value = "/zcxxb")
	@ApiOperation(value = "获取员工职称信息表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 21)
	public Result<List<YgglAttaZcxxb>> selectzcxxb(@CurrentUser UserBean userBean) {
邓实川 committed
1135 1136 1137
		List<YgglAttaZcxxb> ygglAttaZcxxbs = YgglAttaZcxxb.builder().build()
				.selectList(new QueryWrapper<YgglAttaZcxxb>().eq("org_code", userBean.getOrgCode()).eq("emp_num",
						userBean.getEmpNum()));
东州 翁 committed
1138 1139
		return ResultUtil.data(ygglAttaZcxxbs, "获取员工职称信息表成功");
	}
邓实川 committed
1140

太阳与水 committed
1141 1142 1143
	// 获取员工职称信息表
	@GetMapping(value = "/zcxxb/{empNum}")
	@ApiOperation(value = "获取员工职称信息表(管)", httpMethod = "GET", notes = "接口发布说明")
东州 翁 committed
1144
	@ApiOperationSupport(order = 22)
太阳与水 committed
1145 1146 1147 1148 1149
	public Result<List<YgglAttaZcxxb>> selectzcxxb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaZcxxb> ygglAttaZcxxbs = YgglAttaZcxxb.builder().build().selectList(
				new QueryWrapper<YgglAttaZcxxb>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
		return ResultUtil.data(ygglAttaZcxxbs, "获取员工职称信息表成功");
	}
邓实川 committed
1150

东州 翁 committed
1151 1152
	/**
	 * 添加/修改员工职称信息表
邓实川 committed
1153
	 * 
东州 翁 committed
1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165
	 * @param
	 * @return
	 */
	@PostMapping(value = "/zcxxb")
	@ApiOperation(value = "添加/修改员工职称信息表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 23)
	public Result<YgglAttaZcxxb> addzcxxb(@CurrentUser UserBean userBean, @RequestBody YgglAttaZcxxb ygglAttaZcxxb) {
		ygglAttaZcxxb.setEmpNum(ygglAttaZcxxb.getEmpNum());
		ygglAttaZcxxb.setOrgCode(userBean.getOrgCode());
		ygglAttaZcxxb.insertOrUpdate();
		return ResultUtil.data(ygglAttaZcxxb, "添加/修改员工职称信息表成功");
	}
邓实川 committed
1166

东州 翁 committed
1167 1168
	/**
	 * 删除员工职称信息表
邓实川 committed
1169
	 * 
东州 翁 committed
1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/zcxxb/{id}")
	@ApiOperation(value = "删除员工职称信息表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 24)
	public Result<Boolean> delzcxxb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaZcxxb.builder().build()
				.delete(new QueryWrapper<YgglAttaZcxxb>().eq("org_code", orgCode).eq("id", id)), "删除员工职称信息表成功");
	}
邓实川 committed
1181

东州 翁 committed
1182 1183
	/**
	 * 获取员工证书证件表
邓实川 committed
1184
	 * 
东州 翁 committed
1185 1186 1187 1188 1189 1190 1191
	 * @param
	 * @return
	 */
	@GetMapping(value = "/zszjb")
	@ApiOperation(value = "获取员工证书证件表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 25)
	public Result<List<YgglAttaZszjb>> selectzszjb(@CurrentUser UserBean userBean) {
邓实川 committed
1192 1193 1194
		List<YgglAttaZszjb> ygglAttaZszjbs = YgglAttaZszjb.builder().build()
				.selectList(new QueryWrapper<YgglAttaZszjb>().eq("org_code", userBean.getOrgCode()).eq("emp_num",
						userBean.getEmpNum()));
东州 翁 committed
1195 1196
		return ResultUtil.data(ygglAttaZszjbs, "获取员工证书证件表成功");
	}
邓实川 committed
1197

太阳与水 committed
1198 1199 1200
	// 获取员工证书证件表
	@GetMapping(value = "/zszjb/{empNum}")
	@ApiOperation(value = "获取员工证书证件表(管)", httpMethod = "GET", notes = "接口发布说明")
东州 翁 committed
1201
	@ApiOperationSupport(order = 26)
太阳与水 committed
1202 1203
	public Result<List<YgglAttaZszjb>> selectzszjb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaZszjb> ygglAttaZszjbs = YgglAttaZszjb.builder().build().selectList(
邓实川 committed
1204
				new QueryWrapper<YgglAttaZszjb>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
太阳与水 committed
1205 1206
		return ResultUtil.data(ygglAttaZszjbs, "获取员工证书证件表成功");
	}
邓实川 committed
1207

东州 翁 committed
1208 1209
	/**
	 * 添加/修改员工证书证件表
邓实川 committed
1210
	 * 
东州 翁 committed
1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221
	 * @param
	 * @return
	 */
	@PostMapping(value = "/zszjb")
	@ApiOperation(value = "添加/修改员工证书证件表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 27)
	public Result<YgglAttaZszjb> addzszjb(@CurrentUser UserBean userBean, @RequestBody YgglAttaZszjb ygglAttaZszjb) {
		ygglAttaZszjb.setEmpNum(ygglAttaZszjb.getEmpNum());
		ygglAttaZszjb.setOrgCode(userBean.getOrgCode());
		ygglAttaZszjb.insertOrUpdate();
		return ResultUtil.data(ygglAttaZszjb, "添加/修改员工证书证件表成功");
太阳与水 committed
1222
	}
邓实川 committed
1223

东州 翁 committed
1224 1225
	/**
	 * 删除员工证书证件表
邓实川 committed
1226
	 * 
东州 翁 committed
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/zszjb/{id}")
	@ApiOperation(value = "删除员工证书证件表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 28)
	public Result<Boolean> delzszjb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaZszjb.builder().build()
				.delete(new QueryWrapper<YgglAttaZszjb>().eq("org_code", orgCode).eq("id", id)), "删除员工证书证件表成功");
太阳与水 committed
1237
	}
邓实川 committed
1238

东州 翁 committed
1239 1240
	/**
	 * 获取员工联系信息表
邓实川 committed
1241
	 * 
东州 翁 committed
1242 1243 1244 1245 1246 1247 1248
	 * @param
	 * @return
	 */
	@GetMapping(value = "/lxxxb")
	@ApiOperation(value = "获取员工联系信息表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 29)
	public Result<List<YgglAttaLxxxb>> selectlxxxb(@CurrentUser UserBean userBean) {
邓实川 committed
1249 1250 1251
		List<YgglAttaLxxxb> ygglAttaLxxxbs = YgglAttaLxxxb.builder().build()
				.selectList(new QueryWrapper<YgglAttaLxxxb>().eq("org_code", userBean.getOrgCode()).eq("emp_num",
						userBean.getEmpNum()));
东州 翁 committed
1252 1253
		return ResultUtil.data(ygglAttaLxxxbs, "获取员工联系信息表成功");
	}
邓实川 committed
1254

东州 翁 committed
1255 1256 1257 1258 1259 1260 1261 1262 1263
	// 获取员工联系信息表
	@GetMapping(value = "/lxxxb/{empNum}")
	@ApiOperation(value = "获取员工联系信息表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 30)
	public Result<List<YgglAttaLxxxb>> selectlxxxb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaLxxxb> ygglAttaLxxxbs = YgglAttaLxxxb.builder().build().selectList(
				new QueryWrapper<YgglAttaLxxxb>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
		return ResultUtil.data(ygglAttaLxxxbs, "获取员工联系信息表成功");
	}
邓实川 committed
1264

东州 翁 committed
1265 1266
	/**
	 * 添加/修改员工联系信息表
邓实川 committed
1267
	 * 
东州 翁 committed
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279
	 * @param
	 * @return
	 */
	@PostMapping(value = "/lxxxb")
	@ApiOperation(value = "添加/修改员工联系信息表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 31)
	public Result<YgglAttaLxxxb> addlxxxb(@CurrentUser UserBean userBean, @RequestBody YgglAttaLxxxb ygglAttaLxxxb) {
		ygglAttaLxxxb.setEmpNum(ygglAttaLxxxb.getEmpNum());
		ygglAttaLxxxb.setOrgCode(userBean.getOrgCode());
		ygglAttaLxxxb.insertOrUpdate();
		return ResultUtil.data(ygglAttaLxxxb, "添加/修改员工联系信息表成功");
	}
邓实川 committed
1280

东州 翁 committed
1281 1282
	/**
	 * 删除员工联系信息表
邓实川 committed
1283
	 * 
东州 翁 committed
1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/lxxxb/{id}")
	@ApiOperation(value = "删除员工联系信息表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 32)
	public Result<Boolean> dellxxxb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaLxxxb.builder().build()
				.delete(new QueryWrapper<YgglAttaLxxxb>().eq("org_code", orgCode).eq("id", id)), "删除员工联系信息表成功");
	}
邓实川 committed
1295

东州 翁 committed
1296 1297
	/**
	 * 获取员工紧急联系人表
邓实川 committed
1298
	 * 
东州 翁 committed
1299 1300 1301 1302 1303 1304 1305
	 * @param
	 * @return
	 */
	@GetMapping(value = "/jjlxr")
	@ApiOperation(value = "获取员工紧急联系人表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 33)
	public Result<List<YgglAttaJjlxr>> selectjjlxr(@CurrentUser UserBean userBean) {
邓实川 committed
1306 1307 1308
		List<YgglAttaJjlxr> ygglAttaJjlxrs = YgglAttaJjlxr.builder().build()
				.selectList(new QueryWrapper<YgglAttaJjlxr>().eq("org_code", userBean.getOrgCode()).eq("emp_num",
						userBean.getEmpNum()));
东州 翁 committed
1309 1310
		return ResultUtil.data(ygglAttaJjlxrs, "获取员工紧急联系人表成功");
	}
邓实川 committed
1311

东州 翁 committed
1312 1313
	// 获取员工紧急联系人表
	@GetMapping(value = "/jjlxr/{empNum}")
1314
	@ApiOperation(value = "获取员工紧急联系人表(管)", httpMethod = "GET", notes = "接口发布说明")
东州 翁 committed
1315
	@ApiOperationSupport(order = 34)
1316 1317 1318 1319
	public Result<List<YgglAttaJjlxr>> selectjjlxr(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaJjlxr> ygglAttaJjlxrs = YgglAttaJjlxr.builder().build().selectList(
				new QueryWrapper<YgglAttaJjlxr>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
		return ResultUtil.data(ygglAttaJjlxrs, "获取员工紧急联系人表成功");
太阳与水 committed
1320
	}
邓实川 committed
1321

东州 翁 committed
1322 1323
	/**
	 * 添加/修改员工紧急联系人表
邓实川 committed
1324
	 * 
东州 翁 committed
1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336
	 * @param
	 * @return
	 */
	@PostMapping(value = "/jjlxr")
	@ApiOperation(value = "添加/修改员工紧急联系人表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 35)
	public Result<YgglAttaJjlxr> addjjlxr(@CurrentUser UserBean userBean, @RequestBody YgglAttaJjlxr ygglAttaJjlxr) {
		ygglAttaJjlxr.setEmpNum(ygglAttaJjlxr.getEmpNum());
		ygglAttaJjlxr.setOrgCode(userBean.getOrgCode());
		ygglAttaJjlxr.insertOrUpdate();
		return ResultUtil.data(ygglAttaJjlxr, "添加/修改员工紧急联系人表成功");
	}
邓实川 committed
1337

东州 翁 committed
1338 1339
	/**
	 * 删除员工紧急联系人表
邓实川 committed
1340
	 * 
东州 翁 committed
1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/jjlxr/{id}")
	@ApiOperation(value = "删除员工紧急联系人表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 36)
	public Result<Boolean> deljjlxr(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaJjlxr.builder().build()
				.delete(new QueryWrapper<YgglAttaJjlxr>().eq("org_code", orgCode).eq("id", id)), "删除员工紧急联系人表成功");
	}
邓实川 committed
1352

东州 翁 committed
1353 1354 1355
	// 获取工资卡信息
	/**
	 * 获取员工工资卡信息
邓实川 committed
1356
	 * 
东州 翁 committed
1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367
	 * @param
	 * @return
	 */
	@GetMapping(value = "/gzk")
	@ApiOperation(value = "获取员工工资卡信息", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 37)
	public Result<List<YgglAttaGzk>> selectgzk(@CurrentUser UserBean userBean) {
		List<YgglAttaGzk> ygglAttaGzks = YgglAttaGzk.builder().build().selectList(new QueryWrapper<YgglAttaGzk>()
				.eq("org_code", userBean.getOrgCode()).eq("emp_num", userBean.getEmpNum()));
		return ResultUtil.data(ygglAttaGzks, "获取工资卡信息成功");
	}
邓实川 committed
1368

太阳与水 committed
1369 1370 1371
	// 获取工资卡信息
	@GetMapping(value = "/gzk/{empNum}")
	@ApiOperation(value = "获取员工工资卡信息(管)", httpMethod = "GET", notes = "接口发布说明")
东州 翁 committed
1372
	@ApiOperationSupport(order = 38)
太阳与水 committed
1373 1374 1375 1376 1377
	public Result<List<YgglAttaGzk>> selectgzk(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaGzk> ygglAttaGzks = YgglAttaGzk.builder().build().selectList(
				new QueryWrapper<YgglAttaGzk>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
		return ResultUtil.data(ygglAttaGzks, "获取工资卡信息成功");
	}
邓实川 committed
1378

东州 翁 committed
1379 1380
	/**
	 * 添加/修改工资卡信息
邓实川 committed
1381
	 * 
东州 翁 committed
1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393
	 * @param
	 * @return
	 */
	@PostMapping(value = "/gzk")
	@ApiOperation(value = "添加/修改工资卡信息", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 39)
	public Result<YgglAttaGzk> addgzk(@CurrentUser UserBean userBean, @RequestBody YgglAttaGzk ygglAttaGzk) {
		ygglAttaGzk.setEmpNum(ygglAttaGzk.getEmpNum());
		ygglAttaGzk.setOrgCode(userBean.getOrgCode());
		ygglAttaGzk.insertOrUpdate();
		return ResultUtil.data(ygglAttaGzk, "添加/修改工资卡信息成功");
	}
邓实川 committed
1394

东州 翁 committed
1395 1396
	/**
	 * 删除工资卡信息
邓实川 committed
1397
	 * 
东州 翁 committed
1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/gzk/{id}")
	@ApiOperation(value = "删除工资卡信息", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 40)
	public Result<Boolean> delgzk(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaGzk.builder().build()
				.delete(new QueryWrapper<YgglAttaGzk>().eq("org_code", orgCode).eq("id", id)), "删除工资卡信息成功");
	}
邓实川 committed
1409

东州 翁 committed
1410 1411
	/**
	 * 获取员工合同信息表
邓实川 committed
1412
	 * 
东州 翁 committed
1413 1414 1415 1416 1417 1418 1419
	 * @param
	 * @return
	 */
	@GetMapping(value = "/htxxb")
	@ApiOperation(value = "获取员工合同信息表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 41)
	public Result<List<YgglAttaHtxxb>> selecthtxxb(@CurrentUser UserBean userBean) {
邓实川 committed
1420 1421 1422
		List<YgglAttaHtxxb> ygglAttaHtxxbs = YgglAttaHtxxb.builder().build()
				.selectList(new QueryWrapper<YgglAttaHtxxb>().eq("org_code", userBean.getOrgCode()).eq("emp_num",
						userBean.getEmpNum()));
东州 翁 committed
1423 1424
		return ResultUtil.data(ygglAttaHtxxbs, "获取员工合同信息表成功");
	}
邓实川 committed
1425

太阳与水 committed
1426 1427 1428
	// 获取员工合同信息表
	@GetMapping(value = "/htxxb/{empNum}")
	@ApiOperation(value = "获取员工合同信息表(管)", httpMethod = "GET", notes = "接口发布说明")
东州 翁 committed
1429
	@ApiOperationSupport(order = 42)
太阳与水 committed
1430 1431 1432 1433 1434
	public Result<List<YgglAttaHtxxb>> selecthtxxb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaHtxxb> ygglAttaHtxxbs = YgglAttaHtxxb.builder().build().selectList(
				new QueryWrapper<YgglAttaHtxxb>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
		return ResultUtil.data(ygglAttaHtxxbs, "获取员工合同信息表成功");
	}
邓实川 committed
1435

太阳与水 committed
1436
	/**
东州 翁 committed
1437
	 * 添加/修改员工合同信息表
邓实川 committed
1438
	 * 
太阳与水 committed
1439 1440 1441
	 * @param
	 * @return
	 */
东州 翁 committed
1442 1443 1444 1445 1446 1447 1448 1449
	@PostMapping(value = "/htxxb")
	@ApiOperation(value = "添加/修改员工合同信息表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 43)
	public Result<YgglAttaHtxxb> addhtxxb(@CurrentUser UserBean userBean, @RequestBody YgglAttaHtxxb ygglAttaHtxxb) {
		ygglAttaHtxxb.setEmpNum(ygglAttaHtxxb.getEmpNum());
		ygglAttaHtxxb.setOrgCode(userBean.getOrgCode());
		ygglAttaHtxxb.insertOrUpdate();
		return ResultUtil.data(ygglAttaHtxxb, "添加/修改员工合同信息表成功");
太阳与水 committed
1450
	}
邓实川 committed
1451

太阳与水 committed
1452
	/**
东州 翁 committed
1453
	 * 删除员工合同信息表
邓实川 committed
1454
	 * 
太阳与水 committed
1455 1456 1457
	 * @param
	 * @return
	 */
东州 翁 committed
1458 1459 1460 1461 1462 1463 1464
	@DeleteMapping(value = "/htxxb/{id}")
	@ApiOperation(value = "删除员工合同信息表", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 44)
	public Result<Boolean> delhtxxb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaHtxxb.builder().build()
				.delete(new QueryWrapper<YgglAttaHtxxb>().eq("org_code", orgCode).eq("id", id)), "删除员工合同信息表成功");
太阳与水 committed
1465
	}
邓实川 committed
1466

太阳与水 committed
1467
	/**
东州 翁 committed
1468
	 * 获取员工材料附件表
1469
	 * 
1470 1471 1472
	 * @param
	 * @return
	 */
东州 翁 committed
1473 1474 1475 1476
	@GetMapping(value = "/clfjb")
	@ApiOperation(value = "获取员工材料附件表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 45)
	public Result<List<YgglAttaClfjb>> selectclfjb(@CurrentUser UserBean userBean) {
邓实川 committed
1477 1478 1479
		List<YgglAttaClfjb> ygglAttaClfjbs = YgglAttaClfjb.builder().build()
				.selectList(new QueryWrapper<YgglAttaClfjb>().eq("org_code", userBean.getOrgCode()).eq("emp_num",
						userBean.getEmpNum()));
东州 翁 committed
1480
		return ResultUtil.data(ygglAttaClfjbs, "获取员工材料附件表成功");
1481
	}
邓实川 committed
1482

东州 翁 committed
1483 1484 1485 1486 1487 1488 1489 1490
	// 获取员工材料附件表
	@GetMapping(value = "/clfjb/{empNum}")
	@ApiOperation(value = "获取员工材料附件表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 46)
	public Result<List<YgglAttaClfjb>> selectclfjb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaClfjb> ygglAttaClfjbs = YgglAttaClfjb.builder().build().selectList(
				new QueryWrapper<YgglAttaClfjb>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
		return ResultUtil.data(ygglAttaClfjbs, "获取员工材料附件表成功");
1491
	}
邓实川 committed
1492

1493
	/**
东州 翁 committed
1494
	 * 添加/修改员工材料附件表
邓实川 committed
1495
	 * 
1496 1497 1498
	 * @param
	 * @return
	 */
东州 翁 committed
1499 1500 1501 1502 1503 1504 1505 1506
	@PostMapping(value = "/clfjb")
	@ApiOperation(value = "添加/修改员工材料附件表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 47)
	public Result<YgglAttaClfjb> addclfjb(@CurrentUser UserBean userBean, @RequestBody YgglAttaClfjb ygglAttaClfjb) {
		ygglAttaClfjb.setOrgCode(userBean.getOrgCode());
		ygglAttaClfjb.setEmpNum(ygglAttaClfjb.getEmpNum());
		ygglAttaClfjb.insertOrUpdate();
		return ResultUtil.data(ygglAttaClfjb, "添加/修改员工材料附件表成功");
1507
	}
邓实川 committed
1508

1509
	/**
东州 翁 committed
1510
	 * 删除员工材料附件表
邓实川 committed
1511
	 * 
1512 1513 1514 1515 1516
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/clfjb/{id}")
	@ApiOperation(value = "删除员工材料附件表", httpMethod = "DELETE", notes = "接口发布说明")
东州 翁 committed
1517 1518 1519 1520 1521
	@ApiOperationSupport(order = 48)
	public Result<Boolean> delclfjb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaClfjb.builder().build()
				.delete(new QueryWrapper<YgglAttaClfjb>().eq("org_code", orgCode).eq("id", id)), "删除员工材料附件表成功");
1522
	}
邓实川 committed
1523

东州 翁 committed
1524 1525
	/**
	 * 获取成长记录表
邓实川 committed
1526
	 * 
东州 翁 committed
1527 1528 1529 1530 1531 1532 1533
	 * @param
	 * @return
	 */
	@GetMapping(value = "/czjlb")
	@ApiOperation(value = "获取成长记录表", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 49)
	public Result<List<YgglAttaCzjlb>> selectczjlb(@CurrentUser UserBean userBean) {
邓实川 committed
1534 1535 1536
		List<YgglAttaCzjlb> ygglAttaCzjlbs = YgglAttaCzjlb.builder().build()
				.selectList(new QueryWrapper<YgglAttaCzjlb>().eq("org_code", userBean.getOrgCode()).eq("emp_num",
						userBean.getEmpNum()));
东州 翁 committed
1537 1538
		return ResultUtil.data(ygglAttaCzjlbs, "获取成长记录表成功");
	}
邓实川 committed
1539

东州 翁 committed
1540 1541 1542 1543 1544 1545 1546 1547 1548
	// 获取成长记录表
	@GetMapping(value = "/czjlb/{empNum}")
	@ApiOperation(value = "获取成长记录表(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 50)
	public Result<List<YgglAttaCzjlb>> selectczjlb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
		List<YgglAttaCzjlb> ygglAttaCzjlbs = YgglAttaCzjlb.builder().build().selectList(
				new QueryWrapper<YgglAttaCzjlb>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
		return ResultUtil.data(ygglAttaCzjlbs, "获取员工成长记录表成功");
	}
邓实川 committed
1549

东州 翁 committed
1550 1551
	/**
	 * 添加/修改成长记录表
邓实川 committed
1552
	 * 
东州 翁 committed
1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564
	 * @param
	 * @return
	 */
	@PostMapping(value = "/czjlb")
	@ApiOperation(value = "添加/修改成长记录表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 51)
	public Result<YgglAttaCzjlb> addczjlb(@CurrentUser UserBean userBean, @RequestBody YgglAttaCzjlb ygglAttaCzjlb) {
		ygglAttaCzjlb.setEmpNum(ygglAttaCzjlb.getEmpNum());
		ygglAttaCzjlb.setOrgCode(userBean.getOrgCode());
		ygglAttaCzjlb.insertOrUpdate();
		return ResultUtil.data(ygglAttaCzjlb, "添加/修改成长记录表成功");
	}
邓实川 committed
1565

东州 翁 committed
1566 1567
	/**
	 * 获取单个离职员工信息(管)
邓实川 committed
1568
	 * 
东州 翁 committed
1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579
	 * @param
	 * @return
	 */
	@GetMapping(value = "/lzb/{empNum}")
	@ApiOperation(value = "获取单个离职员工信息(管)", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 52)
	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();
		return ResultUtil.data(lzyg, "获取单个离职员工信息(管)成功");
	}
邓实川 committed
1580

东州 翁 committed
1581 1582
	/**
	 * 员工转正
邓实川 committed
1583
	 * 
东州 翁 committed
1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596
	 * @param
	 * @return
	 */
	@PostMapping(value = "/ygzz")
	@ApiOperation(value = "员工转正", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 53)
	public Result<Void> ygzz(@CurrentUser UserBean userBean, @RequestBody YgzzDto ygzzDto) {
		UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
		updateWrapper.eq("emp_num", ygzzDto.getEmpNum());
		YgglMainEmp.builder().jobStatus(2).zzTime(ygzzDto.getZzTime()).sjzzTime(new Date())
				.zzRemark(ygzzDto.getZzRemark()).build().update(updateWrapper);
		return ResultUtil.success("转正成功!");
	}
邓实川 committed
1597

东州 翁 committed
1598 1599
	/**
	 * 计划离职 type2-3
邓实川 committed
1600
	 * 
东州 翁 committed
1601 1602 1603 1604 1605 1606 1607
	 * @param
	 * @return
	 */
	@PostMapping(value = "/addlzjh")
	@ApiOperation(value = "添加离职计划", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 54)
	public Result<YgglMainLzb> addjhlz(@CurrentUser UserBean userBean, @RequestBody LzygQueryDto lzygQueryDto) {
1608

1609
		Integer empNum = lzygQueryDto.getEmpNum();
1610

东州 翁 committed
1611
		QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<YgglMainEmp>();
1612
		queryWrapper.eq("emp_num", empNum).eq("org_code", userBean.getOrgCode());
东州 翁 committed
1613 1614 1615 1616 1617
		YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(queryWrapper);
		YgglMainLzb ygglMainLzb = YgglMainLzb.builder().empNum(lzygQueryDto.getEmpNum()).build();
		// 移动员工表数据到离职表
		BeanUtil.copyProperties(ygglMainEmp, ygglMainLzb);
		ygglMainLzb.insert();
1618

东州 翁 committed
1619
		UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
1620
		updateWrapper.eq("emp_num", empNum);
东州 翁 committed
1621
		UpdateWrapper<YgglMainLzb> updateWrapper1 = new UpdateWrapper<YgglMainLzb>();
1622
		updateWrapper1.eq("emp_num", empNum);
1623
		YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).build().update(updateWrapper);
1624 1625
		YgglMainLzb.builder().jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).lzTime(lzygQueryDto.getLzTime())
				.lzyy(lzygQueryDto.getLzyy()).lzbz(lzygQueryDto.getLzbz()).build().update(updateWrapper1);
1626

东州 翁 committed
1627 1628
		return ResultUtil.data(ygglMainLzb, "添加待离职员工成功");
	}
邓实川 committed
1629

1630
	/**
东州 翁 committed
1631
	 * 确认离职 type3-4
邓实川 committed
1632
	 * 
太阳与水 committed
1633 1634
	 * @param
	 * @return
东州 翁 committed
1635 1636 1637 1638 1639
	 */
	@PostMapping(value = "/qrlz")
	@ApiOperation(value = "确认离职", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 55)
	public Result<Void> addlzb(@CurrentUser UserBean userBean, @RequestBody LzygQueryDto lzygQueryDto) {
1640
		Integer empNum = lzygQueryDto.getEmpNum();
1641 1642
		// 删除员工档案表
		ygglMainEmpMapper.delete(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, empNum));
1643
		
1644 1645
		YgglMainLzb.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).sjlzTime(new Date())
				.build().update(new UpdateWrapper<YgglMainLzb>().lambda().eq(YgglMainLzb::getEmpNum, empNum));
1646
		
1647 1648 1649 1650 1651 1652 1653 1654
		// 确认离职 删除员工关联表
		QyzxEmpEntAsso.builder().empNum(lzygQueryDto.getEmpNum()).build()
		.delete(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getEmpNum, empNum));

		// 初始化 部门主管
		zzglBmgwMMapper.update(ZzglBmgwM.builder().leader(null).build(),
				new UpdateWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getLeader, empNum));

东州 翁 committed
1655 1656
		return ResultUtil.success("确认离职员工成功");
	}
邓实川 committed
1657

东州 翁 committed
1658 1659
	/**
	 * 放弃离职 type3-2
邓实川 committed
1660
	 * 
东州 翁 committed
1661 1662 1663 1664 1665 1666 1667 1668 1669
	 * @param
	 * @return
	 */
	@PostMapping(value = "/fqlz")
	@ApiOperation(value = "放弃离职", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 56)
	public Result<Void> fqlz(@CurrentUser UserBean userBean, @RequestBody LzygQueryDto lzygQueryDto) {
		UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
		updateWrapper.eq("emp_num", lzygQueryDto.getEmpNum());
1670
		YgglMainEmp.builder().jobStatus(YgEnumInterface.jobStatus.ZHENSHI.getType()).build().update(updateWrapper);
东州 翁 committed
1671 1672 1673 1674 1675 1676 1677
		QueryWrapper<YgglMainLzb> queryWrapper = new QueryWrapper<YgglMainLzb>();
		queryWrapper.eq("emp_num", lzygQueryDto.getEmpNum());
		// 删除离职表
		YgglMainLzb.builder().id(lzygQueryDto.getEmpNum()).build().delete(queryWrapper);

		return ResultUtil.success("放弃成功");
	}
邓实川 committed
1678

东州 翁 committed
1679 1680 1681 1682 1683
	@PostMapping(value = "/tzlzyy")
	@ApiOperation(value = "调整离职", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 56)
	public Result<YgglMainLzb> tzlzyy(@CurrentUser UserBean userBean, @RequestBody YgglMainLzb ygglMainLzb) {

邓实川 committed
1684 1685 1686 1687 1688 1689 1690 1691
		if (ygglMainLzb.getEmpNum() != null) {
			UpdateWrapper<YgglMainLzb> updateWrapper = new UpdateWrapper<YgglMainLzb>();
			updateWrapper.eq("org_code", userBean.getOrgCode()).eq("emp_num", ygglMainLzb.getEmpNum());
			ygglMainLzb.update(updateWrapper);
			return ResultUtil.data(ygglMainLzb, "修改成功");
		}
		return ResultUtil.error("请确认该员工是否存在!");

东州 翁 committed
1692
	}
邓实川 committed
1693

东州 翁 committed
1694 1695
	/**
	 * 查询离职员工列表
邓实川 committed
1696
	 * 
东州 翁 committed
1697 1698 1699 1700 1701 1702 1703 1704
	 * @param
	 * @return
	 */
	@PostMapping(value = "/querylzyg")
	@ApiOperation(value = "查询离职员工列表", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 57)
	public Result<Object> querylzyg(@CurrentUser UserBean userBean, @RequestBody LzbQueryDto lzygQueryDto) {
		lzygQueryDto.setOrgCode(userBean.getOrgCode());
邓实川 committed
1705

东州 翁 committed
1706 1707 1708 1709 1710
		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, "离职员工搜索成功");
太阳与水 committed
1711
	}
邓实川 committed
1712

1713 1714
	/**
	 * 展示民族/展示所有民族
邓实川 committed
1715
	 * 
1716 1717
	 * @param
	 * @return
邓实川 committed
1718
	 */
1719 1720
	@PostMapping(value = "/mz/{id}")
	@ApiOperation(value = "展示民族/展示所有民族", httpMethod = "POST", notes = "接口发布说明")
东州 翁 committed
1721
	@ApiOperationSupport(order = 59)
1722
	public Result<List<YgmzDto>> selectmzs(@CurrentUser UserBean userBean, @PathVariable Integer id) {
邓实川 committed
1723 1724 1725
		if (id == null || id == 0) {
			List<YgmzDto> allmz = new LambdaQueryChainWrapper<YgmzDto>(ygMzDtoMapper).list();
			return ResultUtil.data(allmz, "展示所有民族");
1726
		}
邓实川 committed
1727 1728
		List<YgmzDto> mz = new LambdaQueryChainWrapper<YgmzDto>(ygMzDtoMapper).eq(YgmzDto::getNumber, id).list();
		return ResultUtil.data(mz, "展示该民族");
1729
	}
1730

1731 1732
	@Autowired
	CommonAreaMapper commonAreaMapper;
1733

1734 1735 1736 1737 1738 1739 1740 1741 1742 1743
	/**
	 * 籍贯树-Mini
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/native_place")
	@ApiOperation(value = "籍贯树-Mini", httpMethod = "GET", notes = "籍贯树-Mini")
	@ApiOperationSupport(order = 60)
	public Result<List<CommonArea>> selectNativePlace() {
1744

1745 1746
		List<CommonArea> listCommonArea = commonAreaMapper.AllAreaForTree();
		return ResultUtil.data(listCommonArea, "操作成功!");
1747

1748
	}
邓实川 committed
1749

1750 1751 1752 1753 1754 1755
	/**
	 * 展示籍贯/展示所有籍贯
	 * 
	 * @param
	 * @return
	 */
1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767
	@PostMapping(value = "/jg")
	@ApiOperation(value = "展示籍贯所有省市区", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 60)
	public Result<List<YgjgDto>> selectjgs(@CurrentUser UserBean userBean) {

		List<YgjgDto> oldfather = new ArrayList<YgjgDto>();// 老父亲

		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) {
1768
			Map<String, Object> map = BeanUtil.beanToMap(p);
1769
			// 设置别名对应bean
1770 1771 1772
			HashMap<String, String> mapping = CollUtil.newHashMap();
			mapping.put("id", "jgid");
			mapping.put("name", "jgname");
1773 1774 1775 1776 1777
			YgjgDto ygproDto = BeanUtil.mapToBean(map, YgjgDto.class, CopyOptions.create().setFieldMapping(mapping));
			// 添加cityList
			// 给一个upid
			List<YgCityDto> outcity = uptocityList(city, ygproDto.getJgid());
			// 新建一个篮子
1778 1779 1780 1781 1782 1783 1784
			List<YgjgDto> cityDtos = new ArrayList<YgjgDto>();
			for (YgCityDto c : outcity) {
				Map<String, Object> map2 = BeanUtil.beanToMap(c);
				HashMap<String, String> mapping2 = CollUtil.newHashMap();
				mapping2.put("id", "jgid");
				mapping2.put("name", "jgname");
				mapping2.put("province", "upid");
1785 1786 1787
				YgjgDto ygcityDto = BeanUtil.mapToBean(map2, YgjgDto.class,
						CopyOptions.create().setFieldMapping(mapping2));
				// 把果实收起来
1788
				cityDtos.add(ygcityDto);
1789 1790
				List<YgAreaDto> outarea = uptoareaList(area, ygcityDto.getJgid());

1791 1792 1793 1794 1795 1796 1797
				List<YgjgDto> areaDtos = new ArrayList<YgjgDto>();
				for (YgAreaDto a : outarea) {
					Map<String, Object> map3 = BeanUtil.beanToMap(a);
					HashMap<String, String> mapping3 = CollUtil.newHashMap();
					mapping3.put("id", "jgid");
					mapping3.put("name", "jgname");
					mapping3.put("city", "upid");
1798 1799
					YgjgDto ygjgDto3 = BeanUtil.mapToBean(map3, YgjgDto.class,
							CopyOptions.create().setFieldMapping(mapping3));
1800 1801 1802 1803 1804
					areaDtos.add(ygjgDto3);

				}
				ygcityDto.setYgjgDtoList(areaDtos);
				areaDtos.add(ygcityDto);
1805

1806 1807 1808
			}
			ygproDto.setYgjgDtoList(cityDtos);
			oldfather.add(ygproDto);
1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819
		}

		return ResultUtil.data(oldfather, "老父亲出来了");
	}

	// 根据上级id抽取出list
	public List<YgCityDto> uptocityList(List<YgCityDto> city, Integer jgid) {
		List<YgCityDto> outcity = new ArrayList<YgCityDto>();
		for (YgCityDto c : city) {
			if (c.getProvince().equals(jgid)) {
				outcity.add(c);
1820
			}
1821 1822 1823 1824 1825 1826 1827 1828 1829 1830
		}
		city.removeAll(outcity);
		return outcity;
	}

	public List<YgAreaDto> uptoareaList(List<YgAreaDto> area, Integer jgid) {
		List<YgAreaDto> outarea = new ArrayList<YgAreaDto>();
		for (YgAreaDto a : area) {
			if (a.getCity().equals(jgid)) {
				outarea.add(a);
1831
			}
1832 1833 1834 1835
		}
		area.removeAll(outarea);
		return outarea;
	}
1836 1837 1838 1839 1840 1841

	/**
	 * 展示籍贯/展示所有籍贯(威力增强版)
	 * 
	 * @param
	 * @return
1842
	 */
1843
	@PostMapping(value = "/jgshow/{jgid}")
1844 1845
	@ApiOperation(value = "展示籍贯所有省市区威力增强版", httpMethod = "POST", notes = "接口发布说明")
	@ApiOperationSupport(order = 388)
1846
	public Result<Map<String, String>> selectjgs1(@CurrentUser UserBean userBean, @PathVariable String jgid) {
1847 1848 1849 1850 1851 1852
		// public Result<List<YgjgDto>> selectjgs1(@CurrentUser UserBean userBean,
		// @RequestBody YgjgDto ygjgDto) {
		Integer upId = Integer.valueOf(jgid);
		// List<YgjgDto> maps = new ArrayList<YgjgDto>();
		Map<String, String> maps = new HashMap<String, String>();
		if (upId == null || upId % 100 != 0) { // 省份
邓实川 committed
1853 1854 1855
			List<YgProDto> list = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper)
					.select(YgProDto::getId, YgProDto::getProvince, YgProDto::getName).orderByAsc(YgProDto::getProvince)
					.list();
1856 1857
			list.forEach((item) -> maps.put((item.getId()).toString(), item.getName()));
		} else if (upId % 10000 == 0) {
邓实川 committed
1858
			List<YgCityDto> list = new LambdaQueryChainWrapper<YgCityDto>(ygCityDtoMapper)
1859 1860 1861 1862 1863 1864
					.select(YgCityDto::getId, YgCityDto::getProvince, YgCityDto::getCity, YgCityDto::getName)
					.eq(YgCityDto::getProvince, upId).orderByAsc(YgCityDto::getProvince).orderByAsc(YgCityDto::getCity)
					.list();
			list.forEach((item) -> maps.put((item.getId()).toString(), item.getName()));

		} else if (upId % 100 == 0) {
邓实川 committed
1865 1866 1867
			List<YgAreaDto> list = new LambdaQueryChainWrapper<YgAreaDto>(ygAreaDtoMapper)
					.select(YgAreaDto::getId, YgAreaDto::getName).eq(YgAreaDto::getCity, upId)
					.orderByAsc(YgAreaDto::getProvince).orderByAsc(YgAreaDto::getCity).list();
1868
			list.forEach((item) -> maps.put((item.getId()).toString(), item.getName()));
邓实川 committed
1869
		}
1870
		return ResultUtil.data(maps, "展示籍贯成功");
1871
	}
邓实川 committed
1872

1873 1874
	/**
	 * 查询员工列表
邓实川 committed
1875
	 * 
1876 1877 1878 1879 1880
	 * @param
	 * @return
	 */
	@GetMapping(value = "/queryemp")
	@ApiOperation(value = "查询员工列表", httpMethod = "GET", notes = "接口发布说明")
东州 翁 committed
1881
	@ApiOperationSupport(order = 62)
1882
	public Result<List<YgQueryDto>> queryEmpMessage(@CurrentUser UserBean userBean) {
1883
		List<YgQueryDto> ygQueryDto = ygglMainEmpMapper.queryEmpMessage(userBean.getOrgCode());
1884 1885 1886 1887 1888
		for (YgQueryDto yg : ygQueryDto) {
			if (StringUtil.isEmpty(yg.getHeadUrl())) {
				yg.setHeadUrl("");
			}
		}
1889 1890
		return ResultUtil.data(ygQueryDto, "查询成功");
	}
邓实川 committed
1891

1892 1893 1894
	/*************** 统计图 ***************/
	/**
	 * 查询统计图
邓实川 committed
1895
	 * 
1896 1897 1898 1899
	 * @return 成功信息
	 */
	@GetMapping("/yggl")
	@ApiOperation(value = "获取员工管理统计图信息", httpMethod = "GET", notes = "接口发布说明")
东州 翁 committed
1900
	@ApiOperationSupport(order = 63)
1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917
	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());
1918 1919 1920
		if (ygglCartogramDto2 != null) {
			map.put("avgAge", ygglCartogramDto2.getAvgAge());
		}
1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934
		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);

		return ResultUtil.data(map, "查询成功");
	}
邓实川 committed
1935

东州 翁 committed
1936
	/**
1937
	 * 员工信息统计图
1938
	 * 
1939 1940 1941 1942 1943 1944 1945 1946
	 * @return 成功信息(weng)
	 */
	@GetMapping("/Cartogram")
	@ApiOperation(value = "获取员工管理统计图信息", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 99)
	public Result<YgCartogramDto> ygCartogram(@CurrentUser UserBean userBean) {
		Integer orgCode = userBean.getOrgCode();
		List<YgbintuDto> bintu = ygglMainEmpMapper.rsybp(orgCode);
1947 1948 1949 1950 1951 1952 1953 1954 1955
		/*
		 * bintu.stream().filter(bean ->{ if (bean.getAge() == null) { bean.setAge(0); }
		 * if (bean.getBm() == null) { bean.setBm("未分配"); } if (bean.getGw() == null) {
		 * bean.setGw("未分配"); } if (bean.getProname() == null) { bean.setProname("未分配");
		 * } if (bean.getEduname() == null) { bean.setEduname("未分配"); } if
		 * (bean.getJobStatus() == null) { bean.setJobStatus(-1); } if
		 * (bean.getWorkage() == null) { bean.setWorkage(-1); } return true;
		 * }).collect(Collectors.toList());
		 */
1956
		Map<String, Long> gw = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getGw, Collectors.counting()));
1957
		List<YgKVDto> gwList = new ArrayList<YgKVDto>();
1958 1959
		for (Map.Entry<String, Long> entry : gw.entrySet()) {
			gwList.add(new YgKVDto(entry.getKey(), entry.getValue().toString()));
1960
		}
1961
		Map<String, Long> bm = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getBm, Collectors.counting()));
1962
		List<YgKVDto> bmList = new ArrayList<YgKVDto>();
1963 1964
		for (Map.Entry<String, Long> entry : bm.entrySet()) {
			bmList.add(new YgKVDto(entry.getKey(), entry.getValue().toString()));
1965
		}
1966 1967 1968 1969
		// Map<String, Map<String, Long>> bmgw =
		// bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getBm,Collectors.groupingBy(YgbintuDto::getGw,Collectors.counting())));
		Map<String, Long> edu = bintu.stream()
				.collect(Collectors.groupingBy(YgbintuDto::getEduname, Collectors.counting()));
1970
		List<YgKVDto> eduList = new ArrayList<YgKVDto>();
1971 1972
		for (Map.Entry<String, Long> entry : edu.entrySet()) {
			eduList.add(new YgKVDto(entry.getKey(), entry.getValue().toString()));
1973
		}
1974 1975
		Map<Integer, Long> jobStatus = bintu.stream()
				.collect(Collectors.groupingBy(YgbintuDto::getJobStatus, Collectors.counting()));
1976
		List<YgKVDto> jobStatusList = new ArrayList<YgKVDto>();
1977 1978
		for (Entry<Integer, Long> entry : jobStatus.entrySet()) {
			jobStatusList.add(new YgKVDto(entry.getKey().toString(), entry.getValue().toString()));
1979
		}
1980 1981
		Map<String, Long> proname = bintu.stream()
				.collect(Collectors.groupingBy(YgbintuDto::getProname, Collectors.counting()));
1982
		List<YgKVDto> pronameList = new ArrayList<YgKVDto>();
1983 1984
		for (Entry<String, Long> entry : proname.entrySet()) {
			pronameList.add(new YgKVDto(entry.getKey().toString(), entry.getValue().toString()));
1985
		}
1986
		Map<String, Integer> workage = YgEnumInterface.workage.choose(bintu);
1987
		List<YgKVDto> workageList = new ArrayList<YgKVDto>();
1988 1989
		for (Entry<String, Integer> entry : workage.entrySet()) {
			workageList.add(new YgKVDto(entry.getKey().toString(), entry.getValue().toString()));
1990
		}
1991
		Map<String, Integer> age = YgEnumInterface.age.choose(bintu);
1992
		List<YgKVDto> ageList = new ArrayList<YgKVDto>();
1993 1994
		for (Entry<String, Integer> entry : age.entrySet()) {
			ageList.add(new YgKVDto(entry.getKey().toString(), entry.getValue().toString()));
1995
		}
1996
		// 在职
1997 1998
		Integer zaizhi = jobStatus.get(YgEnumInterface.jobStatus.ZHENSHI.getType()).intValue()
				+ jobStatus.get(YgEnumInterface.jobStatus.SHIYONG.getType()).intValue();
1999
		// 本月新入职
2000
		Integer xinruzhi = workage.get("本月新入职").intValue();
2001
		// 本月离职
2002
		Integer lizhi = ygglMainEmpMapper.benyueLz(orgCode);
2003
		// 本月转正
2004
		Integer zhuanzhen = ygglMainEmpMapper.benyueZz(orgCode);
2005
		// 平均年龄
2006 2007
		Integer nianlin = age.get("平均年龄").intValue();
		YgCartogramDto ybp = new YgCartogramDto();
2008 2009 2010 2011 2012
		ybp.setOnTheJob(zaizhi);
		ybp.setNewRecruits(xinruzhi);
		ybp.setDimission(lizhi);
		ybp.setRegularization(zhuanzhen);
		ybp.setAverageAge(nianlin);
2013

2014 2015
		ybp.setDepartment(bmList);
		ybp.setPosition(gwList);
2016 2017 2018 2019 2020
		ybp.setEdu(eduList);
		ybp.setJobStatus(jobStatusList);
		ybp.setProname(pronameList);
		ybp.setWorkage(workageList);
		ybp.setAge(ageList);
2021 2022
		return ResultUtil.data(ybp, "获取员工管理统计图信息成功!");
	}
2023

2024 2025
	/**
	 * 获取员工社保公积金
邓实川 committed
2026
	 * 
东州 翁 committed
2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037
	 * @param
	 * @return
	 */
	@GetMapping(value = "/ygsbgjj")
	@ApiOperation(value = "获取员工社保公积金", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 64)
	public Result<List<YgglAttaSbgjj>> selectygsbgjj(@CurrentUser UserBean userBean) {
		List<YgglAttaSbgjj> ygglAttaSbgjj = YgglAttaSbgjj.builder().build().selectList(new QueryWrapper<YgglAttaSbgjj>()
				.eq("org_code", userBean.getOrgCode()).eq("emp_num", userBean.getEmpNum()));
		return ResultUtil.data(ygglAttaSbgjj, "获取员工社保公积金成功");
	}
邓实川 committed
2038

2039 2040
	/**
	 * 获取员工社保公积金
邓实川 committed
2041
	 * 
2042 2043 2044 2045 2046
	 * @param
	 * @return
	 */
	@GetMapping(value = "/ygsbgjj/{empNum}")
	@ApiOperation(value = "获取员工社保公积金", httpMethod = "GET", notes = "接口发布说明")
东州 翁 committed
2047
	@ApiOperationSupport(order = 65)
邓实川 committed
2048 2049 2050 2051
	public Result<YgglAttaSbgjj> selectygsbgjj(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {

		YgglAttaSbgjj ygglAttaSbgjj = YgglAttaSbgjj.builder().build()
				.selectOne(new QueryWrapper<YgglAttaSbgjj>().eq("emp_num", empNum));
2052 2053 2054

		return ResultUtil.data(ygglAttaSbgjj, "获取员工社保公积金成功");
	}
邓实川 committed
2055

2056 2057
	/**
	 * 添加/修改员工社保公积金
邓实川 committed
2058
	 * 
2059 2060 2061 2062 2063
	 * @param
	 * @return
	 */
	@PostMapping(value = "/ygsbgjj")
	@ApiOperation(value = "添加/修改员工社保公积金", httpMethod = "POST", notes = "接口发布说明")
东州 翁 committed
2064
	@ApiOperationSupport(order = 66)
邓实川 committed
2065
	public Result<YgglAttaSbgjj> addygsbgjj(@CurrentUser UserBean userBean, @RequestBody YgglAttaSbgjj ygglAttaSbgjj) {
2066 2067 2068 2069
		Integer empNum = ygglAttaSbgjj.getEmpNum();
		if (empNum == null) {
			return ResultUtil.error();
		}
邓实川 committed
2070 2071
		YgglAttaSbgjj AttaSbgjj = YgglAttaSbgjj.builder().build()
				.selectOne(new QueryWrapper<YgglAttaSbgjj>().eq("emp_num", empNum));
2072 2073
		if (AttaSbgjj != null) {
			ygglAttaSbgjj.update(new UpdateWrapper<YgglAttaSbgjj>().eq("emp_num", empNum));
邓实川 committed
2074
		} else {
2075 2076 2077 2078 2079
			ygglAttaSbgjj.insert();
		}

		return ResultUtil.data(ygglAttaSbgjj, "添加/修改员工社保公积金成功");
	}
邓实川 committed
2080

东州 翁 committed
2081 2082
	/**
	 * 删除员工社保公积金
邓实川 committed
2083
	 * 
东州 翁 committed
2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094
	 * @param
	 * @return
	 */
	@DeleteMapping(value = "/ygsbgjj/{id}")
	@ApiOperation(value = "删除员工社保公积金", httpMethod = "DELETE", notes = "接口发布说明")
	@ApiOperationSupport(order = 67)
	public Result<Boolean> delygsbgjj(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		return ResultUtil.data(YgglAttaSbgjj.builder().build()
				.delete(new QueryWrapper<YgglAttaSbgjj>().eq("org_code", orgCode).eq("id", id)), "删除员工社保公积金成功");
	}
邓实川 committed
2095

2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121
	@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());
		});

		return ResultUtil.data(treeNodes, "获取成功");
	}

2122
}