ReissueACardBusiness.java 2.53 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
package cn.timer.api.utils.router.business;

import java.text.ParseException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.controller.kqgl.service.KqglService;
import cn.timer.api.dto.kqmk.AttRepairApprovalDto;
import cn.timer.api.dto.spmk.FromData;
import cn.timer.api.utils.DateUtil;
import lombok.Builder;

/**
 * 补卡-业务
 * @author Tang
 *
 */
@Service
public class ReissueACardBusiness extends SpmkAssoBusiness {

	@Autowired
	private KqglService kqglService;
	
	@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("");
		}
		
	}
	
	@Override
	public void handleApprove(JSONObject jsonObj) throws ParseException {
		// TODO Auto-generated method stub
		// 发起人企业id
		Integer orgCode = ObjectUtil.isNull(jsonObj.get("orgCode")) ? null : Convert.toInt(jsonObj.get("orgCode"));
		// 发起人id
		Integer id = jsonObj.getInt("id");
		
		// 审批汇总id
		String approveId = ObjectUtil.isNull(jsonObj.get("approveId",FromData.class)) ? null : jsonObj.get("approveId",FromData.class).getValue();
		// 补卡时间 
		String PatchCardTime = ObjectUtil.isNull(jsonObj.get("__PatchCardTime",FromData.class)) ? null : jsonObj.get("__PatchCardTime",FromData.class).getValue();
		// 缺卡原因
		String cardShortage = ObjectUtil.isNull(jsonObj.get("cardShortage",FromData.class)) ? null : jsonObj.get("cardShortage",FromData.class).getValue();

		// 缺卡时段-上班、下班-前端未改
		String cardSupplementType = ObjectUtil.isNull(jsonObj.get("__CardSupplementType",FromData.class)) ? null : jsonObj.get("__CardSupplementType",FromData.class).getValue();
		
		// 上传文件
		String UploadAttachment = ObjectUtil.isNull(jsonObj.get("UploadAttachment",FromData.class)) ? null : jsonObj.get("UploadAttachment",FromData.class).getValue();
		
		AttRepairApprovalDto raD = AttRepairApprovalDto
				.builder()
				.userid(id)
				.orgcode(orgCode)
				.repairid(Convert.toInt(approveId))
				.cardrepltime(DateUtil.getFormat(PatchCardTime))
				.cardreplperiod(Convert.toInt(cardSupplementType))
				.build();
				
		Logoutput("补卡:"+raD);
		// 调 考勤管理 业务-补卡
		kqglService.attrepairapproval(raD);
	}

}