|
|
@@ -17,21 +17,17 @@
|
|
|
package org.springblade.finance.service.impl;
|
|
|
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.alibaba.fastjson.TypeReference;
|
|
|
-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.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
-import com.github.kevinsawicki.http.HttpRequest;
|
|
|
+import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
|
|
|
|
|
|
-import com.jdy.v7sdk.models.AccountGroupRequest;
|
|
|
import lombok.Data;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.ibatis.logging.Log;
|
|
|
+import org.apache.ibatis.logging.LogFactory;
|
|
|
import org.springblade.check.dto.AuditProecessDTO;
|
|
|
import org.springblade.check.entity.AuditPathsActs;
|
|
|
import org.springblade.check.entity.AuditPathsLevels;
|
|
|
@@ -39,11 +35,8 @@ import org.springblade.check.feign.ICheckClient;
|
|
|
import org.springblade.client.entity.CorpsDesc;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
-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.InvoiceItem;
|
|
|
import org.springblade.finance.entity.JdCorps;
|
|
|
@@ -63,11 +56,9 @@ import org.springblade.client.feign.ISerialClient;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.mocha.entity.BusinessOverpaymentItem;
|
|
|
import org.springblade.mocha.entity.Overpayment;
|
|
|
-import org.springblade.mocha.enums.OverpaymentEnum;
|
|
|
import org.springblade.mocha.feign.IBusinessOverpaymentClient;
|
|
|
import org.springblade.purchase.sales.entity.Order;
|
|
|
import org.springblade.purchase.sales.entity.OrderFees;
|
|
|
-import org.springblade.purchase.sales.entity.OrderItems;
|
|
|
import org.springblade.purchase.sales.feign.IOrderDescClient;
|
|
|
import org.springblade.purchase.sales.feign.IOrderFeesClient;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
@@ -136,6 +127,7 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
private static final String METHOD_POST = "POST";
|
|
|
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<SettlementVO> selectSettlementPage(IPage<SettlementVO> page, SettlementVO settlement) {
|
|
|
return page.setRecords(baseMapper.selectSettlementPage(page, settlement));
|
|
|
@@ -1310,13 +1302,155 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<JdyTool.supplier> getSupplierList() throws Exception
|
|
|
+ public List<JdyTool.Supplier> getSupplierList(String accountName, String search) throws Exception
|
|
|
{
|
|
|
+ //检测此租户的账套是否配置信息
|
|
|
+ LambdaQueryWrapper<JdTenant> jdTenantLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ jdTenantLambdaQueryWrapper
|
|
|
+ .eq(JdTenant::getIsEnable,1)
|
|
|
+ .eq(JdTenant::getTenantId,AuthUtil.getTenantId())
|
|
|
+ .eq(JdTenant::getAccountName,accountName);
|
|
|
+ JdTenant tenant = this.getOne(jdTenantLambdaQueryWrapper, false);
|
|
|
+ if(tenant==null)
|
|
|
+ {
|
|
|
+ throw new SecurityException("未检测到此租户的账套配置信息");
|
|
|
+ }
|
|
|
//获取token
|
|
|
String token = this.getAccountGroupRequest();
|
|
|
- return null;
|
|
|
+ //请求获取账套的groupName,注意:groupName不可以写死,groupName可能会变
|
|
|
+ String getAccountUrl="https://api.kingdee.com/jdy/sys/accountGroup?access_token="+token;
|
|
|
+ Map<String, String> urlParams=new HashMap<>();
|
|
|
+ /*urlParams.put("clientId",jdTenant.getClientId());
|
|
|
+ urlParams.put("client_secret",jdTenant.getClientSecret());
|
|
|
+ urlParams.put("username",jdTenant.getUsername());
|
|
|
+ urlParams.put("password",jdTenant.getPassword());*/
|
|
|
+ String result = this.doPost(getAccountUrl, urlParams);
|
|
|
+ JdyTool.getAccountGroup getAccountGroup = JSONObject.parseObject(result, JdyTool.getAccountGroup.class);
|
|
|
+
|
|
|
+ List<JdyTool.AccountGroup> list=new ArrayList<>();
|
|
|
+ if(!CollectionUtils.isNotEmpty(getAccountGroup.getData()))
|
|
|
+ {
|
|
|
+ throw new SecurityException("操作失败,暂无账套信息");
|
|
|
+ }
|
|
|
+ //获取此账号下,全部账套
|
|
|
+ getAccountGroup.getData().forEach(e->{
|
|
|
+ list.addAll(e.getAccountGroups());
|
|
|
+ });
|
|
|
+ //匹配账套
|
|
|
+ List<JdyTool.AccountGroup> groupList = list.stream().filter(e -> e.getAccountName().equals(accountName)).collect(Collectors.toList());
|
|
|
+ if(!CollectionUtils.isNotEmpty(groupList))
|
|
|
+ {
|
|
|
+ throw new SecurityException("未找到: "+accountName+" 的套账信息");
|
|
|
+ }
|
|
|
+ JdyTool.AccountGroup group = groupList.get(0);
|
|
|
+ String accountId = group.getAccountId();
|
|
|
+ String groupName = group.getGroupName();
|
|
|
+ List<JdyTool.Supplier> suppliers = JdyTool.testGetSupplierList(token, accountId, groupName, search);
|
|
|
+ return suppliers;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<JdyTool.Customer> getCustomerList(String accountName, String search) throws Exception
|
|
|
+ {
|
|
|
+ //检测此租户的账套是否配置信息
|
|
|
+ LambdaQueryWrapper<JdTenant> jdTenantLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ jdTenantLambdaQueryWrapper
|
|
|
+ .eq(JdTenant::getIsEnable,1)
|
|
|
+ .eq(JdTenant::getTenantId,AuthUtil.getTenantId())
|
|
|
+ .eq(JdTenant::getAccountName,accountName);
|
|
|
+ JdTenant tenant = this.getOne(jdTenantLambdaQueryWrapper, false);
|
|
|
+ if(tenant==null)
|
|
|
+ {
|
|
|
+ throw new SecurityException("未检测到此租户的账套配置信息");
|
|
|
+ }
|
|
|
+ //获取token
|
|
|
+ String token = this.getAccountGroupRequest();
|
|
|
+ //请求获取账套的groupName,注意:groupName不可以写死,groupName可能会变
|
|
|
+ String getAccountUrl="https://api.kingdee.com/jdy/sys/accountGroup?access_token="+token;
|
|
|
+ Map<String, String> urlParams=new HashMap<>();
|
|
|
+ /*urlParams.put("clientId",jdTenant.getClientId());
|
|
|
+ urlParams.put("client_secret",jdTenant.getClientSecret());
|
|
|
+ urlParams.put("username",jdTenant.getUsername());
|
|
|
+ urlParams.put("password",jdTenant.getPassword());*/
|
|
|
+ String result = this.doPost(getAccountUrl, urlParams);
|
|
|
+ JdyTool.getAccountGroup getAccountGroup = JSONObject.parseObject(result, JdyTool.getAccountGroup.class);
|
|
|
+
|
|
|
+ List<JdyTool.AccountGroup> list=new ArrayList<>();
|
|
|
+ if(!CollectionUtils.isNotEmpty(getAccountGroup.getData()))
|
|
|
+ {
|
|
|
+ throw new SecurityException("操作失败,暂无账套信息");
|
|
|
+ }
|
|
|
+ //获取此账号下,全部账套
|
|
|
+ getAccountGroup.getData().forEach(e->{
|
|
|
+ list.addAll(e.getAccountGroups());
|
|
|
+ });
|
|
|
+ //匹配账套
|
|
|
+ List<JdyTool.AccountGroup> groupList = list.stream().filter(e -> e.getAccountName().equals(accountName)).collect(Collectors.toList());
|
|
|
+ if(!CollectionUtils.isNotEmpty(groupList))
|
|
|
+ {
|
|
|
+ throw new SecurityException("未找到: "+accountName+" 的套账信息");
|
|
|
+ }
|
|
|
+ JdyTool.AccountGroup group = groupList.get(0);
|
|
|
+ String accountId = group.getAccountId();
|
|
|
+ String groupName = group.getGroupName();
|
|
|
+ List<JdyTool.Customer> customers = JdyTool.testGetCustomerList(token, accountId, groupName, search);
|
|
|
+ return customers;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<JdyTool.Employee> getEmployeeList(String accountName, String search) throws Exception
|
|
|
+ {
|
|
|
+ //检测此租户的账套是否配置信息
|
|
|
+ LambdaQueryWrapper<JdTenant> jdTenantLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ jdTenantLambdaQueryWrapper
|
|
|
+ .eq(JdTenant::getIsEnable,1)
|
|
|
+ .eq(JdTenant::getTenantId,AuthUtil.getTenantId())
|
|
|
+ .eq(JdTenant::getAccountName,accountName);
|
|
|
+ JdTenant tenant = this.getOne(jdTenantLambdaQueryWrapper, false);
|
|
|
+ if(tenant==null)
|
|
|
+ {
|
|
|
+ throw new SecurityException("未检测到此租户的账套配置信息");
|
|
|
+ }
|
|
|
+ //获取token
|
|
|
+ String token = this.getAccountGroupRequest();
|
|
|
+ //请求获取账套的groupName,注意:groupName不可以写死,groupName可能会变
|
|
|
+ String getAccountUrl="https://api.kingdee.com/jdy/sys/accountGroup?access_token="+token;
|
|
|
+ Map<String, String> urlParams=new HashMap<>();
|
|
|
+ /*urlParams.put("clientId",jdTenant.getClientId());
|
|
|
+ urlParams.put("client_secret",jdTenant.getClientSecret());
|
|
|
+ urlParams.put("username",jdTenant.getUsername());
|
|
|
+ urlParams.put("password",jdTenant.getPassword());*/
|
|
|
+ String result = this.doPost(getAccountUrl, urlParams);
|
|
|
+ JdyTool.getAccountGroup getAccountGroup = JSONObject.parseObject(result, JdyTool.getAccountGroup.class);
|
|
|
+
|
|
|
+ List<JdyTool.AccountGroup> list=new ArrayList<>();
|
|
|
+ if(!CollectionUtils.isNotEmpty(getAccountGroup.getData()))
|
|
|
+ {
|
|
|
+ throw new SecurityException("操作失败,暂无账套信息");
|
|
|
+ }
|
|
|
+ //获取此账号下,全部账套
|
|
|
+ getAccountGroup.getData().forEach(e->{
|
|
|
+ list.addAll(e.getAccountGroups());
|
|
|
+ });
|
|
|
+ //匹配账套
|
|
|
+ List<JdyTool.AccountGroup> groupList = list.stream().filter(e -> e.getAccountName().equals(accountName)).collect(Collectors.toList());
|
|
|
+ if(!CollectionUtils.isNotEmpty(groupList))
|
|
|
+ {
|
|
|
+ throw new SecurityException("未找到: "+accountName+" 的套账信息");
|
|
|
+ }
|
|
|
+ JdyTool.AccountGroup group = groupList.get(0);
|
|
|
+ String accountId = group.getAccountId();
|
|
|
+ String groupName = group.getGroupName();
|
|
|
+ List<JdyTool.Employee> employees = JdyTool.testGetEmployeeList(token, accountId, groupName, search);
|
|
|
+ return employees;
|
|
|
+ }
|
|
|
+
|
|
|
+ public JdTenant getOne(LambdaQueryWrapper<JdTenant> queryWrapper, boolean throwEx)
|
|
|
+ {
|
|
|
+ return throwEx ? this.jdTenantMapper.selectOne(queryWrapper) : SqlHelper.getObject(null, this.jdTenantMapper.selectList(queryWrapper));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//金蝶保存凭证测试-采购付款生成凭证
|
|
|
public JdyTool.voucher toPurchaseJinDie(Date date,String Account,String createUser,String corpName,String accountId,String groupName,JdTenant jdTenant)
|
|
|
{
|