diff --git a/basic/pom.xml b/basic/pom.xml
index ed85498..73eb992 100644
--- a/basic/pom.xml
+++ b/basic/pom.xml
@@ -31,6 +31,11 @@
com.alibaba.cloud
spring-cloud-starter-alibaba-nacos-discovery
+
+ org.springframework.cloud
+ spring-cloud-starter-openfeign
+ ${spring-cloud-alibaba.version}
+
org.springframework.cloud
spring-cloud-dependencies
@@ -138,6 +143,12 @@
mybatis-spring-boot-starter
2.2.2
+
+
+
+
+
+
diff --git a/basic/src/main/java/com/djy/basic/BasicApplication.java b/basic/src/main/java/com/djy/basic/BasicApplication.java
index 3138a9d..2a9de66 100644
--- a/basic/src/main/java/com/djy/basic/BasicApplication.java
+++ b/basic/src/main/java/com/djy/basic/BasicApplication.java
@@ -3,6 +3,7 @@ package com.djy.basic;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@@ -12,12 +13,15 @@ import tk.mybatis.spring.annotation.MapperScan;
@MapperScan(basePackages = "com.djy.**.model")
@ComponentScan("com.djy.**")
@EnableScheduling
+@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class BasicApplication {
public static void main(String[] args) {
+
SpringApplication.run(BasicApplication.class, args);
+ System.out.println("启动成功");
}
}
diff --git a/basic/src/main/java/com/djy/basic/Invoice/controller/InvoiceRecordController.java b/basic/src/main/java/com/djy/basic/Invoice/controller/InvoiceRecordController.java
index 59be42e..1ae5b6f 100644
--- a/basic/src/main/java/com/djy/basic/Invoice/controller/InvoiceRecordController.java
+++ b/basic/src/main/java/com/djy/basic/Invoice/controller/InvoiceRecordController.java
@@ -1,13 +1,13 @@
package com.djy.basic.Invoice.controller;
import com.djy.basic.Invoice.service.InvoiceRecordService;
+import com.djy.basic.Invoice.service.ParameterRecordService;
import com.djy.basic.Invoice.vo.req.InvoiceReq;
import com.djy.core.http.HttpResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/invoice")
@@ -16,6 +16,9 @@ public class InvoiceRecordController {
private final InvoiceRecordService invoiceRecordService;
+ @Autowired
+ private ParameterRecordService parameterRecordService;
+
public InvoiceRecordController(InvoiceRecordService invoiceRecordService) {
this.invoiceRecordService = invoiceRecordService;
}
@@ -26,4 +29,13 @@ public class InvoiceRecordController {
this.invoiceRecordService.getInvoiceInfo(invoiceReq);
return HttpResult.ok();
}
+
+ @PostMapping("getParameter")
+ public HttpResult getParameter(@RequestBody String companyId){
+ String amount = parameterRecordService.getAmount(companyId);
+ System.out.println(amount);
+ return HttpResult.ok(amount);
+ }
+
+
}
diff --git a/basic/src/main/java/com/djy/basic/Invoice/model/ParameterRecord.java b/basic/src/main/java/com/djy/basic/Invoice/model/ParameterRecord.java
new file mode 100644
index 0000000..96da636
--- /dev/null
+++ b/basic/src/main/java/com/djy/basic/Invoice/model/ParameterRecord.java
@@ -0,0 +1,17 @@
+package com.djy.basic.Invoice.model;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @description invoiceRecord
+ * @author
+ * @date 2022-05-11
+ */
+@Data
+public class ParameterRecord {
+
+ private String amount;
+
+}
diff --git a/basic/src/main/java/com/djy/basic/Invoice/model/mapper/ParameterMapper.java b/basic/src/main/java/com/djy/basic/Invoice/model/mapper/ParameterMapper.java
new file mode 100644
index 0000000..6715f08
--- /dev/null
+++ b/basic/src/main/java/com/djy/basic/Invoice/model/mapper/ParameterMapper.java
@@ -0,0 +1,12 @@
+package com.djy.basic.Invoice.model.mapper;
+
+import com.djy.basic.Invoice.model.InvoiceRecord;
+import com.djy.basic.Invoice.model.ParameterRecord;
+import com.djy.core.cmapper.CommonMapper;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ParameterMapper extends CommonMapper {
+
+ String getAmount(String companyId);
+}
diff --git a/basic/src/main/java/com/djy/basic/Invoice/service/ParameterRecordService.java b/basic/src/main/java/com/djy/basic/Invoice/service/ParameterRecordService.java
new file mode 100644
index 0000000..96dc819
--- /dev/null
+++ b/basic/src/main/java/com/djy/basic/Invoice/service/ParameterRecordService.java
@@ -0,0 +1,8 @@
+package com.djy.basic.Invoice.service;
+
+import com.djy.basic.Invoice.vo.req.InvoiceReq;
+
+public interface ParameterRecordService {
+
+ String getAmount(String companyId);
+}
diff --git a/basic/src/main/java/com/djy/basic/Invoice/service/impl/ParameterRecordServiceImpl.java b/basic/src/main/java/com/djy/basic/Invoice/service/impl/ParameterRecordServiceImpl.java
new file mode 100644
index 0000000..7cf98f1
--- /dev/null
+++ b/basic/src/main/java/com/djy/basic/Invoice/service/impl/ParameterRecordServiceImpl.java
@@ -0,0 +1,22 @@
+package com.djy.basic.Invoice.service.impl;
+
+import com.djy.basic.Invoice.model.mapper.InvoiceRecordMapper;
+import com.djy.basic.Invoice.model.mapper.ParameterMapper;
+import com.djy.basic.Invoice.service.InvoiceRecordService;
+import com.djy.basic.Invoice.service.ParameterRecordService;
+import com.djy.basic.Invoice.vo.req.InvoiceReq;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ParameterRecordServiceImpl implements ParameterRecordService {
+
+ @Autowired
+ private ParameterMapper parameterMapper;
+
+
+ @Override
+ public String getAmount(String companyId) {
+ return parameterMapper.getAmount(companyId);
+ }
+}
diff --git a/basic/src/main/resources/bootstrap.yml b/basic/src/main/resources/bootstrap.yml
index 0b84b3a..2e5026d 100644
--- a/basic/src/main/resources/bootstrap.yml
+++ b/basic/src/main/resources/bootstrap.yml
@@ -3,15 +3,24 @@ spring:
name: basic
profiles:
active: dev
+
+ ribbon:
+ ReadTimeout: 60000 #指的是建立连接所用的时间,适用于网络状况正常的情况下,两端连接所用的时间。
+ ConnectTimeout: 60000 #指的是建立连接后从服务器读取到可用资源所用的时间。
cloud:
nacos:
config:
namespace: 26ffe9e3-cddc-415c-9e4e-407557ff6172
server-addr: 123.234.225.158:38848
- username: nacos
- password: Ds20040201
+# username: nacos
+# password: Ds20040201
+ username: djy_nacos
+ password: 8AF67A95-D9C6-40F4-8F4B-DC819D09E3B9
file-extension: yml
shared-configs:
- data-id: common-${spring.profiles.active}.yml
group: DEV_GROUP
refresh: true #代表是否允许自动刷新
+ - dataId: basic-${spring.profiles.active}.yml
+ group: DEV-GROUP
+ refresh: true
diff --git a/basic/src/main/resources/mapper/ParameterMapper.xml b/basic/src/main/resources/mapper/ParameterMapper.xml
new file mode 100644
index 0000000..bc3affd
--- /dev/null
+++ b/basic/src/main/resources/mapper/ParameterMapper.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/invoice/pom.xml b/invoice/pom.xml
index ff22529..ae4f0c4 100644
--- a/invoice/pom.xml
+++ b/invoice/pom.xml
@@ -141,6 +141,12 @@
+
+
+
+
+
+
javax.mail
mail
diff --git a/invoice/src/main/java/com/djy/invoice/InvoiceApplication.java b/invoice/src/main/java/com/djy/invoice/InvoiceApplication.java
index 2503b36..2340045 100644
--- a/invoice/src/main/java/com/djy/invoice/InvoiceApplication.java
+++ b/invoice/src/main/java/com/djy/invoice/InvoiceApplication.java
@@ -3,10 +3,13 @@ package com.djy.invoice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.web.client.RestTemplate;
import tk.mybatis.spring.annotation.MapperScan;
@EnableAsync
@@ -24,4 +27,5 @@ public class InvoiceApplication {
System.out.println("启动成功");
}
+
}
diff --git a/invoice/src/main/java/com/djy/invoice/controller/InvLinkInfoController.java b/invoice/src/main/java/com/djy/invoice/controller/InvLinkInfoController.java
index 4547ba9..360d56f 100644
--- a/invoice/src/main/java/com/djy/invoice/controller/InvLinkInfoController.java
+++ b/invoice/src/main/java/com/djy/invoice/controller/InvLinkInfoController.java
@@ -7,6 +7,7 @@ import com.djy.invoice.dto.SendEmailParams;
import com.djy.invoice.model.InvInvoiceInfo;
import com.djy.invoice.model.InvLinkInfo;
import com.djy.invoice.service.InvLinkInfoService;
+import com.djy.invoice.service.ParameterFeignClient;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
@@ -23,6 +24,8 @@ public class InvLinkInfoController {
@Autowired
private InvLinkInfoService invLinkInfoService;
+ @Autowired
+ private ParameterFeignClient parameterFeignClient;
@Operation(description = "外部调用接口")
@@ -65,6 +68,17 @@ public class InvLinkInfoController {
return HttpResult.ok(list);
}
+ @Operation(description = "获取参数")
+ @PostMapping("getParameter")
+ public HttpResult getParameter() {
+
+ String companyId ="9f3b3526-4dd4-4997-b974-1f2adb279389";
+ HttpResult result = parameterFeignClient.getParameter(companyId);
+ return result;
+ }
+
+
+
// @Operation(description = "查询发票")
// @PostMapping("getInvoice")
// public HttpResult getInvoice(InvLinkInfo info) {
diff --git a/invoice/src/main/java/com/djy/invoice/model/mapper/InvInvoiceSplitMapper.java b/invoice/src/main/java/com/djy/invoice/model/mapper/InvInvoiceSplitMapper.java
index e4342cd..60e6033 100644
--- a/invoice/src/main/java/com/djy/invoice/model/mapper/InvInvoiceSplitMapper.java
+++ b/invoice/src/main/java/com/djy/invoice/model/mapper/InvInvoiceSplitMapper.java
@@ -2,6 +2,7 @@ package com.djy.invoice.model.mapper;
import com.djy.core.cmapper.CommonMapper;
import com.djy.invoice.model.InvInvoiceSplit;
+import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@@ -25,6 +26,12 @@ public interface InvInvoiceSplitMapper extends CommonMapper {
String getLinkIdsByinvoiceId(String invoiceId);
+ List getSplitsByInvoiceId(String invoiceId);
+
+ InvInvoiceSplit getAmount(@Param("invoiceId") String invoiceId, @Param("businessId") String businessId);
+
+
+
diff --git a/invoice/src/main/java/com/djy/invoice/service/ParameterFeignClient.java b/invoice/src/main/java/com/djy/invoice/service/ParameterFeignClient.java
new file mode 100644
index 0000000..3cf2b6d
--- /dev/null
+++ b/invoice/src/main/java/com/djy/invoice/service/ParameterFeignClient.java
@@ -0,0 +1,16 @@
+package com.djy.invoice.service;
+
+import com.djy.core.http.HttpResult;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Component
+@FeignClient(name="basic")
+public interface ParameterFeignClient {
+
+ @PostMapping(value = "/basicInfo/invoice/getParameter")
+ HttpResult getParameter(@RequestBody String companyId);
+}
diff --git a/invoice/src/main/java/com/djy/invoice/service/impl/InvLinkInfoServiceImpl.java b/invoice/src/main/java/com/djy/invoice/service/impl/InvLinkInfoServiceImpl.java
index 264f4cb..b7f1560 100644
--- a/invoice/src/main/java/com/djy/invoice/service/impl/InvLinkInfoServiceImpl.java
+++ b/invoice/src/main/java/com/djy/invoice/service/impl/InvLinkInfoServiceImpl.java
@@ -9,6 +9,7 @@ import com.djy.invoice.dto.*;
import com.djy.invoice.model.*;
import com.djy.invoice.model.mapper.*;
import com.djy.invoice.service.InvLinkInfoService;
+import com.djy.invoice.service.ParameterFeignClient;
import com.djy.invoice.service.UploadData;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
@@ -24,6 +25,7 @@ import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Slf4j
@@ -42,8 +44,8 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
private InvInvoiceDetailMapper invInvoiceDetailMapper;
@Autowired
private InvInvoiceSplitMapper invInvoiceSplitMapper;
-
-
+ @Autowired
+ private ParameterFeignClient parameterFeignClient;
private static String cmdName;
private static String cmdCxName;
@@ -55,9 +57,27 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
private static String urlPath;
- public static BigDecimal invoiceAmount;
+// public static BigDecimal invoiceAmount;
private static final String dateFormat = "yyyy-MM-dd HH:mm:ss";
+ private static final String dateFormat1 = "yyyy-MM-dd";
+
private static final DateFormat df = new SimpleDateFormat(dateFormat);
+ private static final DateFormat df1 = new SimpleDateFormat(dateFormat1);
+
+
+
+ public static boolean isNumeric(String str){
+ Pattern pattern = Pattern.compile("[0-9]*");
+ if(str.indexOf(".")>0){//判断是否有小数点
+ if(str.indexOf(".")==str.lastIndexOf(".") && str.split("\\.").length==2){ //判断是否只有一个小数点
+ return pattern.matcher(str.replace(".","")).matches();
+ }else {
+ return false;
+ }
+ }else {
+ return pattern.matcher(str).matches();
+ }
+ }
@Transactional
@Override
@@ -79,13 +99,29 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
// List links = JSONObject.parseArray(jsonObj.toJSONString() , InvLinkInfo.class);// 将string类型直接封装成对象
+ BigDecimal exchangeRate = new BigDecimal(0);
+
for(InvLinkInfo linkinfo : links){
+
+ HttpResult result = parameterFeignClient.getParameter(linkinfo.getCompanyId());
+ String amount =(String)result.getData();
+
+ if(null == amount){
+ return HttpResult.error(20060,"linkId="+linkinfo.getLinkId()+",CompanyId="+linkinfo.getCompanyId()+",开票数额不存在,请检查");
+ }else{
+ boolean boolea = isNumeric(amount);
+ if(false == boolea){
+ return HttpResult.error(20050,"linkId="+linkinfo.getLinkId()+",CompanyId="+linkinfo.getCompanyId()+",开票数额格式不正确,请检查");
+ }
+ }
+
+
// linkinfo.setGID((String)jsonObj.get("LinkId"));
linkinfo.setGID(linkinfo.getLinkId());
InvLinkInfo link = invLinkInfoMapper.selectByGID(linkinfo);
if(null != link){
if(!"0".equals(link.getStatus())){
- return HttpResult.ok("该链接已经开票或在开票中,不能上传数据");
+ return HttpResult.error(20090,"链接id="+link.getGID()+"已经开票或在开票中,不能上传数据");
}else{//删除链接表,重新插入
invLinkInfoMapper.deleteByGID(link);
@@ -161,6 +197,7 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
InvFeeInfo fee = feearray.get(j);
+ exchangeRate = fee.getExchangeRate();
// JSONObject feeobject = feearray.getJSONObject(j);
// InvFeeInfo fee = JSONObject.parseObject(feeobject.toJSONString() , InvFeeInfo.class);// 将string类型直接封装成对象
fee.setGID(fee.getFeeId());
@@ -179,13 +216,84 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
}
-
deleteSplit(linkinfo);
-
-
-// HttpResult httpresult = createSplit(linkinfo);
-
createSplit(linkinfo);
+
+ List invoiceIds = invInvoiceSplitMapper.getIdsBylinkdId(linkinfo.getGID());
+
+ for(String str : invoiceIds){
+
+
+
+ InvInvoiceInfo invoice = invInvoiceInfoMapper.getByGid(str);
+ String remark="";
+ String requiredRemark="";
+ List busineesIds = invInvoiceSplitMapper.getSplitsByInvoiceId(str);
+ BigDecimal rmbAmount = new BigDecimal(0);
+ BigDecimal usdAmount = new BigDecimal(0);
+ String remarkTemplate = linkinfo.getRemarkTemplate();
+ for(String busid : busineesIds){
+
+ InvBusinessInfo busi = invBusinessInfoMapper.getById(busid);
+ InvInvoiceSplit invsplit = invInvoiceSplitMapper.getAmount(str,busid);
+ if(remarkTemplate.contains("主提单号")){
+ remarkTemplate = remarkTemplate.replaceAll("主提单号]",busi.getMBLNO()+"]");
+ }
+ if(remarkTemplate.contains("委托单位")){
+ remarkTemplate = remarkTemplate.replaceAll("委托单位]",busi.getCustNO()+"]");
+ }
+ if(remarkTemplate.contains("开船日期")){
+ remarkTemplate = remarkTemplate.replaceAll("开船日期]",df1.format(busi.getETD())+"]");
+ }
+ if(remarkTemplate.contains("船名")){
+ remarkTemplate = remarkTemplate.replaceAll("船名]",busi.getVessel()+"]");
+ }
+ if(remarkTemplate.contains("航次")){
+ remarkTemplate = remarkTemplate.replaceAll("航次]",busi.getVoyno()+"]");
+ }
+ if(remarkTemplate.contains("装货港")){
+ remarkTemplate = remarkTemplate.replaceAll("装货港]",busi.getPortLoad()+"]");
+ }
+ if(remarkTemplate.contains("卸货港")){
+ remarkTemplate = remarkTemplate.replaceAll("卸货港]",busi.getPortDischarge()+"]");
+ }
+ if(remarkTemplate.contains("目的港")){
+ remarkTemplate = remarkTemplate.replaceAll("目的港]",busi.getDestination()+"]");
+ }
+ if(remarkTemplate.contains("集装箱")){
+ remarkTemplate = remarkTemplate.replaceAll("集装箱]",busi.getCntrTotal()+"]");
+ }
+ if(remarkTemplate.contains("折算汇率")){
+ remarkTemplate = remarkTemplate.replaceAll("折算汇率]",exchangeRate+"]");
+ }
+ if(remarkTemplate.contains("外币金额")){
+ remarkTemplate = remarkTemplate.replaceAll("外币金额]",invsplit.getSplitAmount()+"]");
+ usdAmount = usdAmount.add(invsplit.getSplitAmount());
+ }
+ if(remarkTemplate.contains("人民币金额")){
+ remarkTemplate = remarkTemplate.replaceAll("人民币金额]",invsplit.getSplitAmountRMB()+"]");
+ rmbAmount = rmbAmount.add(invsplit.getSplitAmountRMB());
+ }
+ requiredRemark = requiredRemark+remarkTemplate+"\n";
+ }
+
+ String amountstr = "";
+ if(remarkTemplate.contains("外币金额(总计)")){
+ requiredRemark = requiredRemark.replaceAll("外币金额\\(总计\\):"+"\\[","").replaceAll("外币金额\\(总计\\)\\]","");
+ amountstr = amountstr+"外币金额(总计):["+usdAmount.toString()+"]";
+ }
+
+ if(remarkTemplate.contains("人民币金额(总计)")){
+ requiredRemark = requiredRemark.replaceAll("人民币金额\\(总计\\):"+"\\[","").replaceAll("人民币金额\\(总计\\)\\]","");
+ amountstr = amountstr+"人民币金额(总计):["+rmbAmount.toString()+"]";
+ }
+
+
+
+// invoice.setRequireRemark(requiredRemark+amountstr);
+ invoice.setRequireRemark(requiredRemark+amountstr);
+ invInvoiceInfoMapper.updateById(invoice);
+ }
}
@@ -278,150 +386,16 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
}
- int getInvoiceAmount(List fees,InvLinkInfo link,BigDecimal sumfees){
-
- List list = new ArrayList<>();
-
- if(null != fees && fees.size()>0){
-
-
-
- BigDecimal checkinvocie = new BigDecimal(0);
-
- if("RMB".equals(fees.get(0).getCurrency())){
- checkinvocie = invoiceAmount;
- }else{
- checkinvocie = invoiceAmount.divide(fees.get(0).getExchangeRate()).setScale(2,BigDecimal.ROUND_HALF_UP);
- }
-
-
-
- //如果费用总计小于等于最大开票金额
- if(checkinvocie.compareTo(sumfees) == 1){
- InvInvoiceInfo invoice = new InvInvoiceInfo();
- list.add(invoice);
-
- }else{
-
- BigDecimal amount = new BigDecimal(0);
-// List details = new ArrayList<>();
- List splits = new ArrayList<>();
- InvInvoiceInfo invoice = null;
- for(int i=0;i();
- if(remainAmount.compareTo(new BigDecimal(0))==1){
- InvInvoiceSplit split = getInvInvoiceSplit(new InvInvoiceInfo(),new InvInvoiceDetail(),feeinfo,link,amount);
- splits.add(split);
- }
- }else{
- //生成发票和发票明细
- invoice = new InvInvoiceInfo();
- list.add(invoice);
-
-
- if((i==fees.size()-1) && (feeinfo.getAmount().compareTo(new BigDecimal(0))== 1)){
- invoice = new InvInvoiceInfo();
- list.add(invoice);
- }
-
- amount = feeinfo.getAmount();
-
- }
-
- }else{
- //如果amount等于最大开票金额
- if(amount.compareTo(checkinvocie)==0){
- //生成发票和发票明细
- invoice = new InvInvoiceInfo();
- list.add(invoice);
- amount = new BigDecimal(0);
- splits = new ArrayList<>();
- }else{
- //生成发票分配
- InvInvoiceSplit split = getInvInvoiceSplit(new InvInvoiceInfo(),new InvInvoiceDetail(),feeinfo,link,feeinfo.getAmount());
- splits.add(split);
-
- if(i==fees.size()-1){
- BigDecimal sums = splits.stream().map(InvInvoiceSplit::getAmountTotal).reduce(BigDecimal.ZERO,BigDecimal::add);
- invoice = new InvInvoiceInfo();
- list.add(invoice);
- }
-
- }
- }
-
- }
-
- }
- }
- }
-
- return list.size();
-
- }
-
void invoicepzRmb(List fees,InvLinkInfo link,BigDecimal sumfees){
if(null != fees && fees.size()>0){
+ HttpResult result = parameterFeignClient.getParameter(link.getCompanyId());
+ String amountParam=(String)result.getData();
+ BigDecimal invoiceAmount = new BigDecimal(amountParam);
+
BigDecimal checkinvocie = new BigDecimal(0);
if("RMB".equals(fees.get(0).getCurrency())){
@@ -851,7 +825,7 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
// kpInvoice.setPayee("");
//kpInvoice.setReviewer("");
kpInvoice.setTaxpayerCode(UploadData.getTaxpayerCode()); // 收款方纳税人识别号
- kpInvoice.setRemark("发票备注信息"); // 发票备注
+ kpInvoice.setRemark(invoice.getRequireRemark()); // 发票备注
//发票明细内容,最多支持100条
List itemList=new ArrayList();// 发票项目明细列表
@@ -887,6 +861,13 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
log.info("连接id====={}",info.getGID());
InvLinkInfo link = invLinkInfoMapper.selectByGID(info);
+
+ HttpResult result = parameterFeignClient.getParameter(link.getCompanyId());
+ String amount =(String)result.getData();
+ BigDecimal invoiceAmount = new BigDecimal(amount);
+
+
+
InvFeeInfo fee = new InvFeeInfo();
fee.setLinkId(info.getGID());
List businessIds = invFeeInfoMapper.getBusinessIds(fee);
@@ -1059,7 +1040,7 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
InvLinkInfo link = invLinkInfoMapper.selectByGID(info);
if(!"0".equals(link.getStatus())){
- return HttpResult.error("该链接已经开票或在开票中,不能发送数据");
+ return HttpResult.error(20070,"该链接已经开票或在开票中,不能发送数据");
}
link.setEmail(info.getEmail());
@@ -1085,7 +1066,7 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
e.printStackTrace();
}
if( i==0 && 0 != data.getCode()){
- throw new RuntimeException("接口调用失败");
+ throw new RuntimeException("接口调用失败,"+JSONObject.toJSONString(data));
}
}
@@ -1316,13 +1297,13 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
InvLinkInfoServiceImpl.cmdCxName = cmdCxName;
}
- public static BigDecimal getInvoiceAmount() {
- return invoiceAmount;
- }
- @Value("${invoice.invoiceAmount}")
- public void setInvoiceAmount(BigDecimal invoiceAmount) {
- InvLinkInfoServiceImpl.invoiceAmount = invoiceAmount;
- }
+// public static BigDecimal getInvoiceAmount() {
+// return invoiceAmount;
+// }
+// @Value("${invoice.invoiceAmount}")
+// public void setInvoiceAmount(BigDecimal invoiceAmount) {
+// InvLinkInfoServiceImpl.invoiceAmount = invoiceAmount;
+// }
public static String getSendTo() {
diff --git a/invoice/src/main/resources/application-dev.yml b/invoice/src/main/resources/application-dev.yml
index e00b057..0fc5cd5 100644
--- a/invoice/src/main/resources/application-dev.yml
+++ b/invoice/src/main/resources/application-dev.yml
@@ -14,15 +14,15 @@ spring:
username: djy_dev
password: dev123
virtual-host: inv_customer
- mail:
- host: smtp.qq.com # 邮箱服务器地址
- username: 475446853@qq.com
- password: dxqhgqtsmdtubjbf
- default-encoding: UTF-8
- SendTo: 475446853@qq.com
- SmtpConfig: INVOICE
- subject: 发票信息
- url: http://47.104.73.97:8801/mail/send
+# mail:
+# host: smtp.qq.com # 邮箱服务器地址
+# username: 475446853@qq.com
+# password: dxqhgqtsmdtubjbf
+# default-encoding: UTF-8
+# SendTo: 475446853@qq.com
+# SmtpConfig: INVOICE
+# subject: 发票信息
+# url: http://47.104.73.97:8801/mail/send
logging:
level:
root: info
diff --git a/invoice/src/main/resources/bootstrap.yml b/invoice/src/main/resources/bootstrap.yml
index 12df952..0897c20 100644
--- a/invoice/src/main/resources/bootstrap.yml
+++ b/invoice/src/main/resources/bootstrap.yml
@@ -3,8 +3,16 @@ spring:
name: invoice
profiles:
active: dev
+ ribbon:
+ ReadTimeout: 60000 #指的是建立连接所用的时间,适用于网络状况正常的情况下,两端连接所用的时间。
+ ConnectTimeout: 60000 #指的是建立连接后从服务器读取到可用资源所用的时间。
cloud:
nacos:
+ discovery:
+ namespace: 26ffe9e3-cddc-415c-9e4e-407557ff6172
+ server-addr: 123.234.225.158:38848
+ username: djy_nacos
+ password: 8AF67A95-D9C6-40F4-8F4B-DC819D09E3B9
config:
namespace: 26ffe9e3-cddc-415c-9e4e-407557ff6172
server-addr: 123.234.225.158:38848
diff --git a/invoice/src/main/resources/mapper/InvInvoiceSplitMapper.xml b/invoice/src/main/resources/mapper/InvInvoiceSplitMapper.xml
index 844e645..04fbb66 100644
--- a/invoice/src/main/resources/mapper/InvInvoiceSplitMapper.xml
+++ b/invoice/src/main/resources/mapper/InvInvoiceSplitMapper.xml
@@ -42,6 +42,16 @@
+
+
+
+
+