|
|
@@ -17,6 +17,7 @@
|
|
|
package org.springblade.finance.service.impl;
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
@@ -24,16 +25,15 @@ import org.springblade.check.dto.AuditProecessDTO;
|
|
|
import org.springblade.check.entity.AuditPathsActs;
|
|
|
import org.springblade.check.entity.AuditPathsLevels;
|
|
|
import org.springblade.check.feign.ICheckClient;
|
|
|
+import org.springblade.client.entity.CorpsDesc;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.finance.dto.SettlementDTO;
|
|
|
-import org.springblade.finance.entity.Acc;
|
|
|
-import org.springblade.finance.entity.Files;
|
|
|
-import org.springblade.finance.entity.Items;
|
|
|
-import org.springblade.finance.entity.Settlement;
|
|
|
+import org.springblade.finance.vojo.*;
|
|
|
import org.springblade.finance.mapper.AccMapper;
|
|
|
import org.springblade.finance.mapper.ItemsMapper;
|
|
|
import org.springblade.finance.mapper.SettlementMapper;
|
|
|
import org.springblade.finance.service.ISettlementService;
|
|
|
+import org.springblade.finance.tool.JdyTool;
|
|
|
import org.springblade.finance.vo.SettlementVO;
|
|
|
import io.seata.spring.annotation.GlobalTransactional;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -52,6 +52,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -515,8 +517,7 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Settlement apply(List<Items> itemsList, String billType,String url)
|
|
|
- {
|
|
|
+ public Settlement apply(List<Items> itemsList, String billType,String url) throws Exception {
|
|
|
BigDecimal total = itemsList.stream().filter(e -> e.getAmount() != null&&e.getCurrency().equals("CNY")).map(Items::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
BigDecimal foreignTotal = itemsList.stream().filter(e -> e.getAmount() != null&&!e.getCurrency().equals("CNY")).map(Items::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
Settlement settlement=new Settlement();
|
|
|
@@ -561,6 +562,15 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
e.setTenantId(AuthUtil.getTenantId());
|
|
|
e.setCreateUser(AuthUtil.getUserId());
|
|
|
itemsMapper.insert(e);
|
|
|
+
|
|
|
+ R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(e.getCorpId());
|
|
|
+ if(corpMessage.isSuccess()&&corpMessage.getData()!=null)
|
|
|
+ {
|
|
|
+ e.setCorpName(corpMessage.getData().getCname());
|
|
|
+ }
|
|
|
+ //todo 金蝶测试-凭证保存
|
|
|
+ toJinDie(e);
|
|
|
+
|
|
|
});
|
|
|
List<CorpsBank> corpsBanks = corpsDescClient.listBankByCorpId(settlement.getCorpId());
|
|
|
settlement.setBankList(corpsBanks);
|
|
|
@@ -631,6 +641,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
AuditProecessDTO auditProecessDTO=new AuditProecessDTO();
|
|
|
//追加跳转路由url
|
|
|
auditProecessDTO.setUrl(settlement.getUrl());
|
|
|
+ auditProecessDTO.setPageStatus(settlement.getPageStatus());
|
|
|
+ auditProecessDTO.setPageLabel(settlement.getPageLabel());
|
|
|
//增加审批类型
|
|
|
auditProecessDTO.setProcessType("付费审批");
|
|
|
auditProecessDTO.setPathsLevelsList(auditPathsLevels);
|
|
|
@@ -843,8 +855,44 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
baseMapper.deleteById(settlementId);*/
|
|
|
}
|
|
|
|
|
|
- public void toJinDie()
|
|
|
+ //金蝶保存凭证测试
|
|
|
+ public void toJinDie(Items items)
|
|
|
{
|
|
|
+ //不是某一家 直接返回
|
|
|
+ if(!AuthUtil.getTenantId().equals("xxxx"))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JDYitems item=new JDYitems();
|
|
|
+ item.setDate(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
|
|
|
+ List<JDYentries> entriesList=new ArrayList<>();
|
|
|
+ List<JDYitems> jdYitems=new ArrayList<>();
|
|
|
+
|
|
|
+ //财务借方
|
|
|
+ JDYentries d=new JDYentries();
|
|
|
+ d.setDc("1");
|
|
|
+ d.setExplanation("采购订单合同号:"+items.getSrcOrderno()+",申请货款");
|
|
|
+ d.setAccount_number("400101");
|
|
|
+ d.setDebitamount(items.getAmount().toString());
|
|
|
+ entriesList.add(d);
|
|
|
+ //财务贷方
|
|
|
+ JDYentries c=new JDYentries();
|
|
|
+ c.setDc("-1");
|
|
|
+ c.setExplanation("客户资料:"+items.getCorpName());
|
|
|
+ c.setAccount_number("220202");
|
|
|
+ c.setCreditamount(items.getAmount().toString());
|
|
|
+ entriesList.add(c);
|
|
|
+ //组装数据
|
|
|
+ item.setEntries(entriesList);
|
|
|
+ jdYitems.add(item);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ JdyTool.test(jdYitems);
|
|
|
+ }
|
|
|
+ catch (Exception exception)
|
|
|
+ {
|
|
|
+ throw new SecurityException("操作失败,保存金蝶错误");
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|