EvectionBusiness.java 2.72 KB
Newer Older
1 2
package cn.timer.api.utils.router.business;

3 4
import java.text.ParseException;

1  
邓实川 committed
5 6
import javax.annotation.PostConstruct;

7
import org.springframework.beans.factory.annotation.Autowired;
ilal committed
8
import org.springframework.beans.factory.annotation.Value;
tangzhaoqian committed
9
import org.springframework.stereotype.Service;
10 11

import cn.hutool.core.convert.Convert;
12
import cn.hutool.core.util.ObjectUtil;
13
import cn.hutool.json.JSONObject;
14 15
import cn.timer.api.controller.kqgl.service.KqglService;
import cn.timer.api.dto.kqmk.AttEvectionApprovalDto;
16
import cn.timer.api.dto.spmk.FromData;
17
import cn.timer.api.utils.DateUtil;
18 19 20 21 22 23 24
import lombok.Builder;

/**
 * 出差-业务
 * @author Tang
 *
 */
tangzhaoqian committed
25
@Service
26 27
public class EvectionBusiness extends SpmkAssoBusiness {

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

}