parent
1e6723bcf3
commit
98da3c4958
@ -0,0 +1,85 @@ |
|||||||
|
package com.dxhy.core.task; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.dxhy.common.constant.DbConstant; |
||||||
|
import com.dxhy.common.datasource.config.DynamicContextHolder; |
||||||
|
import com.dxhy.core.dao.ConfirmDao; |
||||||
|
import com.dxhy.core.job.entity.SNSAPObject; |
||||||
|
import com.dxhy.core.job.entity.ScheduleJobEntity; |
||||||
|
import com.dxhy.core.job.entity.TAcOrg; |
||||||
|
import com.dxhy.core.job.service.ApplyService; |
||||||
|
import com.dxhy.core.job.service.ScheduleJobService; |
||||||
|
import com.dxhy.core.job.service.SysDeptService; |
||||||
|
import com.dxhy.core.util.HttpRequestUtils; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.beans.factory.annotation.Value; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.text.DateFormat; |
||||||
|
import java.text.SimpleDateFormat; |
||||||
|
import java.util.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请统计,统计结果,申请确认,确认结果定时任务 |
||||||
|
* |
||||||
|
* @author fth |
||||||
|
* @date 2019年05月28日 |
||||||
|
**/ |
||||||
|
@Component("pullSapData") |
||||||
|
@Slf4j |
||||||
|
|
||||||
|
public class PullSapDataTask { |
||||||
|
@Resource |
||||||
|
private ApplyService applyService; |
||||||
|
@Resource |
||||||
|
ScheduleJobService scheduleJobService; |
||||||
|
@Resource |
||||||
|
SysDeptService sysDeptService; |
||||||
|
@Resource |
||||||
|
ConfirmDao confirmDao; |
||||||
|
@Value("${sdny.snYxUrl}") |
||||||
|
private String snYxUrl; |
||||||
|
@Value("${po.userName}") |
||||||
|
private String userName; |
||||||
|
|
||||||
|
@Value("${po.password}") |
||||||
|
private String password; |
||||||
|
|
||||||
|
public void applyStat() { |
||||||
|
log.info("拉取sap数据获取"); |
||||||
|
//获取当前年月
|
||||||
|
Date date = new Date(); |
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMM"); |
||||||
|
String format1 = format.format(date); |
||||||
|
String year = format1.substring(0, 4); |
||||||
|
String month = format1.substring(4, 6); |
||||||
|
|
||||||
|
//获取公司代码
|
||||||
|
List<TAcOrg> taxNos=confirmDao.getPullSapDataTaxNo(); |
||||||
|
for(TAcOrg tAcOrg:taxNos){ |
||||||
|
SNSAPObject object = new SNSAPObject(); |
||||||
|
object.setSYSID("FPXT"); |
||||||
|
object.setIFYWID("FI842"); |
||||||
|
object.setBSKEY(UUID.randomUUID().toString().replace("-", "")); |
||||||
|
object.setZFILED5("200"); |
||||||
|
Map<String,String> requestMap = new HashMap<>(); |
||||||
|
//公司代码
|
||||||
|
requestMap.put("ZGSDM",tAcOrg.getAccount()); |
||||||
|
//年
|
||||||
|
requestMap.put("GJAHR",year); |
||||||
|
//月
|
||||||
|
requestMap.put("MONAT",month); |
||||||
|
object.setZDATA(JSONObject.toJSONString(requestMap)); |
||||||
|
JSONObject request = new JSONObject(); |
||||||
|
request.put("IS_INPUT",object); |
||||||
|
String req = request.toJSONString(); |
||||||
|
log.info("税号:{},发送获取sap数据{}",tAcOrg.getTaxno(),req); |
||||||
|
String s = HttpRequestUtils.sendPo(snYxUrl, req, userName, password); |
||||||
|
log.info("税号:{},拉去sap接口返回数据{}",tAcOrg.getTaxno(),s); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue