|
|
@@ -18,9 +18,12 @@ package org.springblade.finance.service.impl;
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.aliyun.tea.TeaConverter;
|
|
|
+import com.aliyun.tea.TeaPair;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.jdy.v7sdk.models.AccountGroupRequest;
|
|
|
import org.springblade.check.dto.AuditProecessDTO;
|
|
|
import org.springblade.check.entity.AuditPathsActs;
|
|
|
import org.springblade.check.entity.AuditPathsLevels;
|
|
|
@@ -32,8 +35,11 @@ import org.springblade.deliver.goods.entity.Delivery;
|
|
|
import org.springblade.deliver.goods.entity.DeliveryFees;
|
|
|
import org.springblade.deliver.goods.entity.DeliveryItems;
|
|
|
import org.springblade.deliver.goods.feign.IDeliveryClient;
|
|
|
+import org.springblade.finance.TokenRequestQuery;
|
|
|
import org.springblade.finance.dto.SettlementDTO;
|
|
|
+import org.springblade.finance.entity.JdTenant;
|
|
|
import org.springblade.finance.enums.SettlementEnum;
|
|
|
+import org.springblade.finance.mapper.JdTenantMapper;
|
|
|
import org.springblade.finance.vojo.*;
|
|
|
import org.springblade.finance.mapper.AccMapper;
|
|
|
import org.springblade.finance.mapper.ItemsMapper;
|
|
|
@@ -65,9 +71,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.BigInteger;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -99,6 +103,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
|
|
|
private IDeliveryClient deliveryClient;
|
|
|
|
|
|
+ private JdTenantMapper jdTenantMapper;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public IPage<SettlementVO> selectSettlementPage(IPage<SettlementVO> page, SettlementVO settlement) {
|
|
|
@@ -1006,4 +1012,61 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
return businessOverpaymentClient.updateOverpayment(overpayment);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public void testSaveVoucher() throws Exception {
|
|
|
+
|
|
|
+ //非达沃特用户直接返回
|
|
|
+ if(!AuthUtil.getTenantId().equals("681169"))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //1.获取AccountGroupRequest
|
|
|
+ AccountGroupRequest accountGroupRequest = this.getAccountGroupRequest();
|
|
|
+ if(accountGroupRequest==null)
|
|
|
+ {
|
|
|
+ throw new SecurityException("获取账套配置信息失败");
|
|
|
+ }
|
|
|
+ //2.获取账套
|
|
|
+ Map<String, String> group = this.getGroup(accountGroupRequest, "金蝶开发者测试账套");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //测试获取AccountGroupRequest
|
|
|
+ public AccountGroupRequest getAccountGroupRequest() throws Exception
|
|
|
+ {
|
|
|
+ //校验当前租户配置,如果存在配置,返回token
|
|
|
+ LambdaQueryWrapper<JdTenant> jdTenantLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ jdTenantLambdaQueryWrapper
|
|
|
+ .eq(JdTenant::getTenantId,AuthUtil.getTenantId())
|
|
|
+ .eq(JdTenant::getIsEnable,1);
|
|
|
+ JdTenant jdTenant = jdTenantMapper.selectOne(jdTenantLambdaQueryWrapper);
|
|
|
+ if(jdTenant==null)
|
|
|
+ {
|
|
|
+ throw new SecurityException("当前租户未配置凭证信息");
|
|
|
+ }
|
|
|
+ TokenRequestQuery tokenRequestQuery = TokenRequestQuery.build(TeaConverter.buildMap(
|
|
|
+ new TeaPair("clientId", jdTenant.getClientId()),
|
|
|
+ new TeaPair("clientSecret", jdTenant.getClientSecret()),
|
|
|
+ new TeaPair("username", jdTenant.getUsername()),
|
|
|
+ new TeaPair("password", jdTenant.getPassword())
|
|
|
+ ));
|
|
|
+ //获取token
|
|
|
+ com.jdy.v7sdk.auth auth = new com.jdy.v7sdk.auth();
|
|
|
+ AccountGroupRequest accessTokenObject = auth.getToken(tokenRequestQuery);
|
|
|
+ return accessTokenObject;
|
|
|
+ }
|
|
|
+
|
|
|
+ //测试获取套账
|
|
|
+ public Map<String, String> getGroup (AccountGroupRequest accountGroupRequest,String accountName) throws Exception {
|
|
|
+ com.jdy.v7sdk.auth auth = new com.jdy.v7sdk.auth();
|
|
|
+ java.util.List<?> accountGroups = auth.getAccount(accountGroupRequest);
|
|
|
+ java.util.Map<String, Object> accountService = com.aliyun.teautil.Common.assertAsMap(accountGroups.get(0));
|
|
|
+ java.util.List<Object> groups = com.aliyun.teautil.Common.assertAsArray(accountService.get("accountGroups"));
|
|
|
+ java.util.Map<String, String> group = com.aliyun.teautil.Common.stringifyMapValue(com.aliyun.teautil.Common.assertAsMap(groups.get(1)));
|
|
|
+ return new HashMap();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|