weaver-hrm-salary/src/com/engine/salary/timer/CBS8GetDtaJob.java

86 lines
3.0 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.engine.salary.timer;
import cn.hutool.core.util.StrUtil;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.hrm.HrmSnapshotMapper;
import com.engine.salary.remote.cbs8.client.BillManagementClient;
import com.engine.salary.remote.cbs8.request.GetDtaRequest;
import com.engine.salary.remote.cbs8.response.GetDtaResponse;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import weaver.hrm.User;
import weaver.interfaces.schedule.BaseCronJob;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 获取CBS票据信息
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Slf4j
public class CBS8GetDtaJob extends BaseCronJob {
/**
* 出票日期起 格式为yyyy-mm-dd出票日期起止不允许一边有值一边无值日期间隔最大为一年
*/
private String issueDateStart;
/**
* 出票日期止 格式为yyyy-mm-dd出票日期起止不允许一边有值一边无值日期间隔最大为一年
*/
private String issueDateEnd;
/**
* 持票人单位编码 多选。填在cbs系统公共设置>基础信息>组织机构维护的单位编码
*/
private String displayHoldOrganizationCodeList;
/**
* 持票人账号 多选。
*/
private String holdAccountList;
private HrmSnapshotMapper getHrmSnapshotMapper() {
return MapperProxyFactory.getProxy(HrmSnapshotMapper.class);
}
@Override
public void execute() {
User user = new User();
user.setUid(1);
user.setLoginid("sysadmin");
try {
GetDtaRequest requestParam = new GetDtaRequest();
requestParam.setCurrentPage(1);
requestParam.setPageSize(1000);
if (StrUtil.isNotBlank(issueDateStart) && StrUtil.isNotBlank(issueDateEnd)) {
requestParam.setIssueDateStart(issueDateStart);
requestParam.setIssueDateEnd(issueDateEnd);
} else {
String nowDate = LocalDate.now().toString();
requestParam.setIssueDateStart(nowDate);
requestParam.setIssueDateEnd(nowDate);
}
requestParam.setDisplayHoldOrganizationCodeList(Arrays.stream(displayHoldOrganizationCodeList.split(",")).collect(Collectors.toList()));
requestParam.setHoldAccountList(Arrays.stream(holdAccountList.split(",")).collect(Collectors.toList()));
BillManagementClient bailManagementClient = new BillManagementClient();
GetDtaResponse getDtaResponse = bailManagementClient.dtaQuery(requestParam);
List<GetDtaResponse.Detail> list = getDtaResponse.getData().getList();
} catch (Exception e) {
log.error("获取CBS票据信息失败", e);
throw new SalaryRunTimeException("获取CBS票据信息失败," + e.getMessage(), e);
}
}
}