You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.2 KiB
60 lines
2.2 KiB
3 years ago
|
package com.qs.cost.module.service;
|
||
|
|
||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||
|
import com.qs.cost.common.conf.MainServerProperties;
|
||
|
import com.qs.cost.common.dto.u8.U8RequestBo;
|
||
|
import com.qs.cost.common.utils.HttpUtil;
|
||
|
import com.qs.cost.common.utils.JsonUtil;
|
||
|
import com.qs.cost.module.domain.VmSupplierPo;
|
||
|
import com.qs.cost.module.domain.dto.U8Vendor;
|
||
|
import com.qs.cost.module.mapper.VmSupplierMapper;
|
||
|
import lombok.AllArgsConstructor;
|
||
|
import org.springframework.stereotype.Service;
|
||
|
|
||
|
import java.time.LocalDateTime;
|
||
|
import java.util.Arrays;
|
||
|
import java.util.List;
|
||
|
/**
|
||
|
* @author YenHex
|
||
|
* @since 2022/9/27
|
||
|
*/
|
||
|
@Service
|
||
|
@AllArgsConstructor
|
||
|
public class VmSupplierService {
|
||
|
|
||
|
private final VmSupplierMapper vmSupplierMapper;
|
||
|
private final MainServerProperties mainServerProperties;
|
||
|
|
||
|
public void test() {
|
||
|
String host = mainServerProperties.getHost();
|
||
|
String year = mainServerProperties.getYear();
|
||
|
String book = mainServerProperties.getBook();
|
||
|
List<VmSupplierPo> supplierPoList = vmSupplierMapper.selectList(new QueryWrapper<>());
|
||
|
for (VmSupplierPo supplierPo : supplierPoList) {
|
||
|
U8Vendor vendor = new U8Vendor();
|
||
|
//编辑属性:A表新增,M表修改 string类型
|
||
|
vendor.setEditprop("A");
|
||
|
vendor.setCVenCode(supplierPo.getCVenCode());
|
||
|
vendor.setCVenName(supplierPo.getCVenName());
|
||
|
vendor.setCVenAbbName(supplierPo.getCVenAbbName());
|
||
|
vendor.setCDCCode(supplierPo.getCDCCode());
|
||
|
vendor.setCVcCode(supplierPo.getCVCCode());
|
||
|
String jsonBody = JsonUtil.objectToJson(vendor);
|
||
|
//发起U8服务中台
|
||
|
U8RequestBo requestBo = new U8RequestBo();
|
||
|
requestBo.setPk(vendor.getCVenCode());
|
||
|
requestBo.setCmd("BasicVendor");
|
||
|
requestBo.setYear(year);
|
||
|
requestBo.setBook(book);
|
||
|
requestBo.setJsonBody(jsonBody);
|
||
|
requestBo.setKeyId("");
|
||
|
requestBo.setSettingRetryTimes(2);
|
||
|
requestBo.setCallbackState("1");
|
||
|
requestBo.setCallbackHost( host + "/lzOrder/callback");
|
||
|
HttpUtil.post(mainServerProperties.getU8url(),JsonUtil.objectToJson(requestBo));
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|