TransferPositionBusiness.java 3.05 KB
Newer Older
1 2
package cn.timer.api.utils.router.business;

3
import org.springframework.beans.factory.annotation.Autowired;
tangzhaoqian committed
4
import org.springframework.stereotype.Service;
5

ilal committed
6 7
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

tangzhaoqian committed
8
import cn.hutool.core.convert.Convert;
9
import cn.hutool.core.util.ObjectUtil;
10
import cn.hutool.json.JSONObject;
ilal committed
11
import cn.timer.api.bean.zzgl.ZzglBmgwM;
tangzhaoqian committed
12
import cn.timer.api.config.exception.CustomException;
13
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
14
import cn.timer.api.dto.spmk.FromData;
15
import cn.timer.api.dto.zzgl.UpEmpDeptDto;
16 17 18 19 20 21 22
import lombok.Builder;

/**
 * 调岗-业务
 * @author Tang
 *
 */
tangzhaoqian committed
23 24

@Service
25 26
public class TransferPositionBusiness extends SpmkAssoBusiness {

27 28 29
	@Autowired
	ZzglBmgwMService zzglBmgwMService;
	
30 31 32 33
	@Override
	public void handleApprove(JSONObject jsonObj) {
		// TODO Auto-generated method stub
		// 发起人企业id
tangzhaoqian committed
34
		Integer orgCode = ObjectUtil.isNull(jsonObj.get("orgCode")) ? null : Convert.toInt(jsonObj.get("orgCode"));
35
		// 发起人id
tangzhaoqian committed
36
		Integer id = jsonObj.getInt("id");
37 38
		
		// 申请人
39
		String applicant = ObjectUtil.isNull(jsonObj.get("__applicant",FromData.class)) ? null : jsonObj.get("__applicant",FromData.class).getValue();
40
		// 申请原因
41
		String ReasonForApplication = ObjectUtil.isNull(jsonObj.get("__ReasonForApplication",FromData.class)) ? null : jsonObj.get("__ReasonForApplication",FromData.class).getValue();
42
		// 调入部门
tangzhaoqian committed
43
		Integer TransferInDepartment = ObjectUtil.isNull(jsonObj.get("__TransferInDepartment",FromData.class)) ? null : Convert.toInt(jsonObj.get("__TransferInDepartment",FromData.class).getValue());
lal committed
44
		
ilal committed
45 46
		/* __TransferInPosition */
		if(!("").equals(jsonObj.get("__TransferInDepartment",FromData.class).getValue())) {
lal committed
47
			// 调入岗位
ilal committed
48
			Integer TransferInPosition = ObjectUtil.isNull(jsonObj.get("__TransferInDepartment",FromData.class)) ? null : Integer.parseInt(jsonObj.get("__TransferInDepartment",FromData.class).getValue());
lal committed
49 50
		}
		
tangzhaoqian committed
51
		if (TransferInDepartment == null) {
tangzhaoqian committed
52 53
			throw new CustomException("部门或岗位 未填写,审批失败");
		}
54
		// 生效日期
55
		String effectiveDate = ObjectUtil.isNull(jsonObj.get("__effectiveDate",FromData.class)) ? null : jsonObj.get("__effectiveDate",FromData.class).getValue();
56
		// 备注
57
		String Remarks = ObjectUtil.isNull(jsonObj.get("Remarks",FromData.class)) ? null : jsonObj.get("Remarks",FromData.class).getValue();
58
		// 上传文件
59
		String UploadAttachment = ObjectUtil.isNull(jsonObj.get("UploadAttachment",FromData.class)) ? null : jsonObj.get("UploadAttachment",FromData.class).getValue();
60
		
61 62 63 64 65
		UpEmpDeptDto upEmpDeptDto = UpEmpDeptDto.builder()
				.dpetId(TransferInDepartment)
				.isdg(1)
				.build();
		
tangzhaoqian committed
66
		System.out.println("调岗:"+upEmpDeptDto);
ilal committed
67 68 69 70 71 72
		
		ZzglBmgwM bmg = ZzglBmgwM.builder().build().selectOne(new QueryWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getOrgCode, orgCode).eq(ZzglBmgwM::getLeader, id));
		if(bmg != null) {
			ZzglBmgwM.builder().id(bmg.getId()).leader(0).build().updateById();
		}
		
73
		// 调 员工管理 业务
74
		zzglBmgwMService.applicationTransferPosition(id, orgCode, upEmpDeptDto);
75 76 77
	}

}