|
|
@@ -70,6 +70,8 @@ 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;
|
|
|
+import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -113,6 +115,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
|
|
|
private ICheckClient iCheckClient;
|
|
|
|
|
|
+ private IUserClient userClient;
|
|
|
+
|
|
|
private final IOrderFeesClient orderFeesClient;
|
|
|
|
|
|
private final IBusinessOverpaymentClient businessOverpaymentClient; //溢付款对外访问接口
|
|
|
@@ -216,11 +220,19 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
Long id = settlementDTO.getId();
|
|
|
Settlement settlement = baseMapper.selectById(id);
|
|
|
String corpsName=null;
|
|
|
+ String createUser=null;
|
|
|
+ //供应商
|
|
|
R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(settlement.getCorpId());
|
|
|
if(corpMessage.isSuccess()&&corpMessage.getData()!=null)
|
|
|
{
|
|
|
corpsName=corpMessage.getData().getCname();
|
|
|
}
|
|
|
+ //业务员
|
|
|
+ R<User> userR = userClient.userInfoById(settlement.getCreateUser());
|
|
|
+ if(userR.isSuccess()&&userR.getData()!=null)
|
|
|
+ {
|
|
|
+ createUser=userR.getData().getName();
|
|
|
+ }
|
|
|
|
|
|
|
|
|
//测试账套-保存凭证
|
|
|
@@ -246,7 +258,7 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- String accountName="金蝶开发者测试账套";
|
|
|
+ String accountName=settlement.getBelongCompany();
|
|
|
//测试账套-销售保存凭证
|
|
|
this.testSaleCollectionSaveVoucher(accountName,corpsName,settlement.getAmount().toString());
|
|
|
}
|
|
|
@@ -264,9 +276,9 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- String accountName="金蝶开发者测试账套";
|
|
|
+ String accountName=settlement.getBelongCompany();
|
|
|
//测试账套-销售保存凭证
|
|
|
- this.testPurchaseSaveVoucher(accountName,corpsName,settlement.getAmount().toString());
|
|
|
+ this.testPurchaseSaveVoucher(accountName,createUser,corpsName,settlement.getAmount().toString());
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
@@ -882,7 +894,7 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void paymentApply(List<Items> itemsList, String billType) {
|
|
|
+ public void paymentApply(List<Items> itemsList, String billType,String belongCompany) {
|
|
|
itemsList.forEach(e -> {
|
|
|
//产生凭证: 销售订单-生成账单
|
|
|
if(e.getSrcType()==1 && e.getItemType().equals("销售"))
|
|
|
@@ -891,7 +903,7 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
{
|
|
|
String accountName="金蝶开发者测试账套";
|
|
|
//测试账套-销售保存凭证
|
|
|
- this.testSaleSaveVoucher(accountName,e);
|
|
|
+ this.testSaleSaveVoucher(belongCompany,e);
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
@@ -1268,8 +1280,33 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<JdyTool.AccountGroup> getAccountList() throws Exception
|
|
|
+ {
|
|
|
+ //获取token
|
|
|
+ String token = this.getAccountGroupRequest();
|
|
|
+ //获取套账url
|
|
|
+ String getAccountUrl="https://api.kingdee.com/jdy/sys/accountGroup?access_token="+token;
|
|
|
+ Map<String, String> urlParams=new HashMap<>();
|
|
|
+ String result = this.doPost(getAccountUrl, urlParams);
|
|
|
+ JdyTool.getAccountGroup getAccountGroup = JSONObject.parseObject(result, JdyTool.getAccountGroup.class);
|
|
|
+ List<JdyTool.AccountGroup> list=new ArrayList<>();
|
|
|
+ List<JdyTool.AccountGroups> groupsList = getAccountGroup.getData();
|
|
|
+ if(!CollectionUtils.isNotEmpty(groupsList))
|
|
|
+ {
|
|
|
+ throw new SecurityException("操作失败,暂无账套信息");
|
|
|
+ }
|
|
|
+ getAccountGroup.getData().forEach(e->{
|
|
|
+ list.addAll(e.getAccountGroups());
|
|
|
+ });
|
|
|
+ //匹配账套
|
|
|
+
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
//金蝶保存凭证测试-采购付款生成凭证
|
|
|
- public void toPurchaseJinDie(String Account,String corpName,String accountId,String groupName,JdTenant jdTenant)
|
|
|
+ public void toPurchaseJinDie(String Account,String createUser,String corpName,String accountId,String groupName,JdTenant jdTenant)
|
|
|
{
|
|
|
JDYitems item = new JDYitems();
|
|
|
item.setDate(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
|
|
|
@@ -1321,14 +1358,14 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
List<JDYassist> cList=new ArrayList<>();
|
|
|
|
|
|
//查询业务员
|
|
|
- String jdCorpName="测试业务员";//具体到时候用哪个客户,需要关联查询传参,今天先用测试的
|
|
|
+ //String jdCorpName="测试业务员";//具体到时候用哪个客户,需要关联查询传参,今天先用测试的
|
|
|
LambdaQueryWrapper<JdCorps> corpsQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
corpsQueryWrapper
|
|
|
.eq(JdCorps::getCorpsType,3)
|
|
|
.eq(JdCorps::getAccountId,accountId)
|
|
|
.eq(JdCorps::getTenantId,AuthUtil.getTenantId())
|
|
|
.last("limit 1")
|
|
|
- .eq(JdCorps::getCorpsName,jdCorpName);
|
|
|
+ .eq(JdCorps::getCorpsName,createUser);
|
|
|
JdCorps jdCorps = corpsMapper.selectOne(corpsQueryWrapper);
|
|
|
|
|
|
JDYassist jdYassist=new JDYassist();
|
|
|
@@ -1341,14 +1378,14 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
|
|
|
|
|
|
//查询供应商
|
|
|
- String jdCorpName2="测试供应商";//具体到时候用哪个客户,需要关联查询传参,今天先用测试的
|
|
|
+ //String jdCorpName2="测试供应商";//具体到时候用哪个客户,需要关联查询传参,今天先用测试的
|
|
|
LambdaQueryWrapper<JdCorps> corpsQueryWrapper2=new LambdaQueryWrapper<>();
|
|
|
corpsQueryWrapper2
|
|
|
.eq(JdCorps::getCorpsType,2)
|
|
|
.eq(JdCorps::getAccountId,accountId)
|
|
|
.eq(JdCorps::getTenantId,AuthUtil.getTenantId())
|
|
|
.last("limit 1")
|
|
|
- .eq(JdCorps::getCorpsName,jdCorpName2);
|
|
|
+ .eq(JdCorps::getCorpsName,corpName);
|
|
|
JdCorps jdCorps2 = corpsMapper.selectOne(corpsQueryWrapper2);
|
|
|
|
|
|
JDYassist jdYassist2=new JDYassist();
|
|
|
@@ -1431,14 +1468,14 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
List<JDYassist> cList=new ArrayList<>();
|
|
|
|
|
|
//查询客户
|
|
|
- String jdCorpName="测试客户";//具体到时候用哪个客户,需要关联查询传参,今天先用测试的
|
|
|
+ //String jdCorpName="测试客户";//具体到时候用哪个客户,需要关联查询传参,今天先用测试的
|
|
|
LambdaQueryWrapper<JdCorps> corpsQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
corpsQueryWrapper
|
|
|
.eq(JdCorps::getCorpsType,1)
|
|
|
.eq(JdCorps::getAccountId,accountId)
|
|
|
.eq(JdCorps::getTenantId,AuthUtil.getTenantId())
|
|
|
.last("limit 1")
|
|
|
- .eq(JdCorps::getCorpsName,jdCorpName);
|
|
|
+ .eq(JdCorps::getCorpsName,corpName);
|
|
|
JdCorps jdCorps = corpsMapper.selectOne(corpsQueryWrapper);
|
|
|
|
|
|
JDYassist jdYassist=new JDYassist();
|
|
|
@@ -1570,7 +1607,7 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
}
|
|
|
|
|
|
//采购付款生成凭证
|
|
|
- public void testPurchaseSaveVoucher(String accountName,String corpName,String account)throws Exception
|
|
|
+ public void testPurchaseSaveVoucher(String accountName,String createUser,String corpName,String account)throws Exception
|
|
|
{
|
|
|
|
|
|
//非达沃特用户直接返回
|
|
|
@@ -1625,7 +1662,7 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
return;
|
|
|
}
|
|
|
//2.销售收款-保存凭证
|
|
|
- toPurchaseJinDie(account,corpName,jdTenant.getAccountId(),group.getGroupName(),jdTenant);
|
|
|
+ toPurchaseJinDie(account,createUser,corpName,jdTenant.getAccountId(),group.getGroupName(),jdTenant);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1687,6 +1724,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
toSaleCollectionJinDie(account,corpName,jdTenant.getAccountId(),group.getGroupName(),jdTenant);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
//销售生成账单
|
|
|
public void testSaleSaveVoucher(String accountName,Items items) throws Exception
|
|
|
{
|
|
|
@@ -1739,11 +1778,12 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
}
|
|
|
|
|
|
//测试获取AccountGroupRequest
|
|
|
- public String getAccountGroupRequest() throws Exception
|
|
|
+ public String getAccountGroupRequest( ) throws Exception
|
|
|
{
|
|
|
//校验当前租户配置,如果存在配置,返回token
|
|
|
LambdaQueryWrapper<JdTenant> jdTenantLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
jdTenantLambdaQueryWrapper
|
|
|
+ .last("limit 1")
|
|
|
.eq(JdTenant::getTenantId,AuthUtil.getTenantId())
|
|
|
.eq(JdTenant::getIsEnable,1);
|
|
|
JdTenant jdTenant = jdTenantMapper.selectOne(jdTenantLambdaQueryWrapper);
|