GoOutBusiness.java 2.28 KB
Newer Older
1 2
package cn.timer.api.utils.router.business;

3
import org.springframework.beans.factory.annotation.Autowired;
ilal committed
4
import org.springframework.beans.factory.annotation.Value;
tangzhaoqian committed
5
import org.springframework.stereotype.Service;
6 7 8

import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
9
import cn.hutool.json.JSONObject;
10 11
import cn.timer.api.controller.kqgl.service.KqglService;
import cn.timer.api.dto.kqmk.AttEvectionApprovalDto;
12
import cn.timer.api.dto.spmk.FromData;
13 14
import cn.timer.api.utils.DateUtil;
import lombok.Builder;
15 16

/**
17
 * 外出-业务
18 19 20
 * @author Tang
 *
 */
tangzhaoqian committed
21
@Service
22 23
public class GoOutBusiness extends SpmkAssoBusiness {

24 25
	@Autowired
	private KqglService kqglService;
ilal committed
26 27 28 29 30 31 32 33 34 35 36 37 38
	@Value("${config-8timer.environmental-science}")
	public String environmental_science;
	
	public void Logoutput(String science) {
		
		if(!("pro").equals(environmental_science)) {
			
			System.out.println(science);
		}else {
			System.out.println("");
		}
		
	}
39
	
40 41 42 43
	@Override
	public void handleApprove(JSONObject jsonObj) throws Exception {
		// TODO Auto-generated method stub
		// 发起人企业id
tangzhaoqian committed
44
		Integer orgCode = ObjectUtil.isNull(jsonObj.get("orgCode")) ? null : Convert.toInt(jsonObj.get("orgCode"));
45
		// 发起人id
tangzhaoqian committed
46
		Integer id = jsonObj.getInt("id");
47 48 49
		
		// 审批汇总id
		String approveId = ObjectUtil.isNull(jsonObj.get("approveId",FromData.class)) ? null : jsonObj.get("approveId",FromData.class).getValue();
50 51 52 53 54 55 56
		// 开始时间
		String startTime = jsonObj.get("__startTime",FromData.class).getValue();
		// 结束时间
		String endTime = jsonObj.get("__endTime",FromData.class).getValue();
		// 时长
		String longTime = jsonObj.get("__longTime",FromData.class).getValue();
		// 出差事由
lal committed
57
//		String businessTrip = jsonObj.get("__businessTrip",FromData.class).getValue();
58
		// 上传文件
lal committed
59
//		String UploadAttachment = jsonObj.get("UploadAttachment",FromData.class).getValue();
60
		
61 62
		AttEvectionApprovalDto eaD = AttEvectionApprovalDto
				.builder()
tangzhaoqian committed
63 64
				.userid(id)
				.orgcode(orgCode)
65 66
				.evectionid(Convert.toInt(approveId))
				.evectiontype(2)
67 68
				.starttime(DateUtil.getFormat(startTime))
				.endtime(DateUtil.getFormat(endTime))
69
				.duration(Convert.toDouble(longTime))
70 71
				.build();
				
ilal committed
72
		Logoutput("外出:" + eaD);
73 74
		// 调 考勤管理 业务-外出
		kqglService.attevectionapproval(eaD);
75 76 77
	}

}