1.整理公共服务接口,去除无关的接口

2.修改发票代码等发票内容
3.修改消息队列发送,区分不同公司不同的队列
master
wanghaomei 2 years ago
parent a7e9b55c23
commit c2b26af978

@ -1,41 +0,0 @@
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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/invoice")
@Tag(name = "InvoiceRecordController",description = "发票Controller")
public class InvoiceRecordController {
private final InvoiceRecordService invoiceRecordService;
@Autowired
private ParameterRecordService parameterRecordService;
public InvoiceRecordController(InvoiceRecordService invoiceRecordService) {
this.invoiceRecordService = invoiceRecordService;
}
@Operation(description = "获取发票详细信息")
@GetMapping("getInvoiceInfo")
public HttpResult<Void> getInvoiceInfo(InvoiceReq invoiceReq){
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);
}
}

@ -1,262 +0,0 @@
package com.djy.basic.Invoice.model;
import lombok.Data;
import java.util.Date;
/**
* @description invoiceRecord
* @author
* @date 2022-05-11
*/
@Data
public class InvoiceRecord {
private static final long serialVersionUID = 1L;
/**
* gid
*/
private String gid;
/**
* fromid
*/
private String fromid;
/**
* fromsystem
*/
private String fromsystem;
/**
* compid
*/
private String compid;
/**
* buyername
*/
private String buyername;
/**
* buyertaxnum
*/
private String buyertaxnum;
/**
* buyertel
*/
private String buyertel;
/**
* buyeraddress
*/
private String buyeraddress;
/**
* buyeraccount
*/
private String buyeraccount;
/**
* invoicedate
*/
private Date invoicedate;
/**
* invoicetype
*/
private String invoicetype;
/**
* salername
*/
private String salername;
/**
* salertaxnum
*/
private String salertaxnum;
/**
* salertel
*/
private String salertel;
/**
* saleraddress
*/
private String saleraddress;
/**
* saleraccount
*/
private String saleraccount;
/**
* invoicecode
*/
private String invoicecode;
/**
* invoicenum
*/
private String invoicenum;
/**
* pushmode
*/
private String pushmode;
/**
* buyerphone
*/
private String buyerphone;
/**
* email
*/
private String email;
/**
* invoiceline
*/
private String invoiceline;
/**
* payee
*/
private String payee;
/**
* checker
*/
private String checker;
/**
* clerk
*/
private String clerk;
/**
* orderno
*/
private String orderno;
/**
* remark
*/
private String remark;
/**
* createtime
*/
private Date createtime;
/**
* createuser
*/
private String createuser;
/**
* modifytime
*/
private Date modifytime;
/**
* modifyuser
*/
private String modifyuser;
/**
* status
*/
private String status;
/**
* serialno
*/
private String serialno;
/**
* invcode
*/
private String invcode;
/**
* invnum
*/
private String invnum;
/**
* total
*/
private Double total;
/**
* totalwords
*/
private String totalwords;
/**
* pdfurl
*/
private String pdfurl;
/**
* pictureurl
*/
private String pictureurl;
/**
* resultjson
*/
private String resultjson;
/**
* requireremark
*/
private String requireremark;
/**
* amountusd
*/
private Double amountusd;
/**
* pdfnasurl
*/
private String pdfnasurl;
/**
* extenddata
*/
private String extenddata;
/**
* apisendtime
*/
private Date apisendtime;
/**
* apireadtime
*/
private Date apireadtime;
/**
* applyuser
*/
private String applyuser;
/**
* clerkid
*/
private String clerkid;
/**
* mblno
*/
private String mblno;
}

@ -1,17 +0,0 @@
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;
}

@ -1,9 +0,0 @@
package com.djy.basic.Invoice.model.mapper;
import com.djy.basic.Invoice.model.InvoiceRecord;
import com.djy.core.cmapper.CommonMapper;
import org.springframework.stereotype.Repository;
@Repository
public interface InvoiceRecordMapper extends CommonMapper<InvoiceRecord> {
}

@ -1,12 +0,0 @@
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<ParameterRecord> {
String getAmount(String companyId);
}

@ -1,12 +0,0 @@
package com.djy.basic.Invoice.service;
import com.djy.basic.Invoice.vo.req.InvoiceReq;
public interface InvoiceRecordService {
/**
*
* @param invoiceReq
*/
void getInvoiceInfo(InvoiceReq invoiceReq);
}

@ -1,8 +0,0 @@
package com.djy.basic.Invoice.service;
import com.djy.basic.Invoice.vo.req.InvoiceReq;
public interface ParameterRecordService {
String getAmount(String companyId);
}

@ -1,19 +0,0 @@
package com.djy.basic.Invoice.service.impl;
import com.djy.basic.Invoice.model.mapper.InvoiceRecordMapper;
import com.djy.basic.Invoice.service.InvoiceRecordService;
import com.djy.basic.Invoice.vo.req.InvoiceReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class InvoiceRecordServiceImpl implements InvoiceRecordService {
@Autowired
private InvoiceRecordMapper invoiceRecordMapper;
@Override
public void getInvoiceInfo(InvoiceReq invoiceReq) {
}
}

@ -1,22 +0,0 @@
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);
}
}

@ -1,45 +0,0 @@
package com.djy.basic.Invoice.vo.req;
import lombok.Data;
import java.util.List;
@Data
public class Bill {
private String BSNO;
private String MBLNO;
private String Yard;
private String Vessel;
private String Voyno;
private String ETD;
private String PortLoadId;
private String PortLoad;
private String PortDischargeId;
private String PortDischarge;
private String CntrTotal;
private String PlaceReceiptId;
private String PlaceReceipt;
private String PlaceDeliveryId;
private String PlaceDelivery;
private String DestinationId;
private String Destination;
private List<Fee> feeList;
}

@ -1,35 +0,0 @@
package com.djy.basic.Invoice.vo.req;
import lombok.Data;
@Data
public class Fee {
private String FeeId;
private String FeeName;
private String CustomerName;
private String Unit;
private int UnitPrice;
private int Quantity;
private int Amount;
private String Currency;
private int ExchangeRate;
private String Remark;
private int Sort;
private int TaxRate;
private int NoTaxAmount;
private int Tax;
}

@ -1,45 +0,0 @@
package com.djy.basic.Invoice.vo.req;
import lombok.Data;
import java.util.List;
@Data
public class InvoiceReq {
private String LinkId;
private String CompanyId;
private String Email;
private String BuyerName;
private String BuyerTaxNum;
private String BuyerTel;
private String BuyerAddress;
private String BuyerAccount;
private String SalerName;
private String SalerTaxNum;
private String SalerTel;
private String SalerAddress;
private String SalerAccount;
private String Payee;
private String Checker;
private String Clerk;
private String RemarkTemplate;
private List<Bill> billList;
}

@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/api/sys_param_set")
@RequestMapping("/sysParam")
@Tag(name = "SysParamSetController",description = "SysParamSet")
public class SysParamSetController {

@ -28,7 +28,7 @@ public class InvLinkInfoController {
private ParameterFeignClient parameterFeignClient;
@Operation(description = "外部调用接口")
@Operation(description = "上传发票链接数据")
@PostMapping("getlink")
public HttpResult getlink(@RequestBody String json) {
return invLinkInfoService.getlink(json);
@ -43,7 +43,7 @@ public class InvLinkInfoController {
// }
@Operation(description = "页面生成接口")
@Operation(description = "获取发票链接信息")
@PostMapping("getInfo")
public HttpResult<InvLinkInfo> getInfo(InvLinkInfo info) {
@ -53,7 +53,7 @@ public class InvLinkInfoController {
}
@Operation(description = "发送发票")
@Operation(description = "票")
@PostMapping("uploadInvoice")
public HttpResult uploadInvoice(InvLinkInfo info) {
@ -68,14 +68,14 @@ 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("getParameter")
// public HttpResult getParameter() {
//
// String companyId ="9f3b3526-4dd4-4997-b974-1f2adb279389";
// HttpResult result = parameterFeignClient.getParameter(companyId);
// return result;
// }

@ -8,6 +8,7 @@ import com.djy.invoice.model.InvLinkTaskDto;
import com.djy.invoice.model.mapper.InvInvoiceInfoMapper;
import com.djy.invoice.model.mapper.InvInvoiceSplitMapper;
import com.djy.invoice.model.mapper.InvLinkInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,18 +23,19 @@ import java.util.List;
//@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@Component
@Slf4j
public class InvoiceSendTask {
//定义交换机的名字
public static String EXCHANGE_NAME;
public static String EXCHANGE_NAME;
// public static String EXCHANGE_NAME = "boot_topic_exchange";
//定义队列的名字
// public static String QUEUE_NAME = "boot_queue";
public static String QUEUE_NAME;
public static String QUEUE_NAME;
public static String ROUTING_KEY;
public static String ROUTING_KEY;
@Autowired
private RabbitTemplate rabbitTemplate;
@ -45,34 +47,36 @@ public class InvoiceSendTask {
private InvInvoiceInfoMapper invInvoiceInfoMapper;
@Scheduled(cron = "*/60 * * * * ?")//每个5秒执行一次任务(方法)
public void timeScheduled(){
public void timeScheduled() {
//获取status是2的链表
List<InvLinkInfo> links = invLinkInfoMapper.selectByStatus();
if(null != links && links.size()>0){
if (null != links && links.size() > 0) {
log.info("查询到{}条待处理消息发送的数据", links.size());
InvLinkTaskDto dto = null;
for(InvLinkInfo link : links){
for (InvLinkInfo link : links) {
dto = new InvLinkTaskDto();
//查询当前链表下的所有发票
List<String> list = invInvoiceSplitMapper.getIdsBylinkdId(link.getGID());
log.info(" 查询到链接{}下有{}条发票", link.getGID(), list.size());
if(null !=list && list.size()>0){
if (null != list && list.size() > 0) {
List<InvInvoiceInfo> invoices = new ArrayList<>();
int size = list.size();
for(int i=0;i<list.size();i++){
for (int i = 0; i < list.size(); i++) {
//如果状态Status是success 或fail
InvInvoiceInfo invoice = invInvoiceInfoMapper.getByGidAndStatus(list.get(i));
if(null != invoice && null != invoice.getGID()){
InvInvoiceInfo invoice = invInvoiceInfoMapper.getByGidAndStatus(list.get(i));
if (null != invoice && null != invoice.getGID()) {
invoices.add(invoice);
}
}
if(size == invoices.size()){
log.info("链接{}下发票数量:{},符合状态发票数量:{}", link.getGID(), list.size(), invoices.size());
if (size == invoices.size()) {
link.setSendStatus("1");
invLinkInfoMapper.updateById(link);
dto.setLinkId(link.getGID());
@ -83,8 +87,9 @@ public class InvoiceSendTask {
dto.setInvoiceList(invoices);
// JSONObject.toJSONString(dto);
rabbitTemplate.convertAndSend(EXCHANGE_NAME,ROUTING_KEY,JSONObject.toJSONString(dto));
System.out.println("发送成功");
log.info("准备发送结果到消息队列linkid {} exchange:{}", link.getGID(), EXCHANGE_NAME);
rabbitTemplate.convertAndSend(EXCHANGE_NAME, link.getCompanyId(), JSONObject.toJSONString(dto));
log.info("发送结果到消息队列完成linkid {} exchange:{}", link.getGID(), EXCHANGE_NAME);
}
}
@ -99,13 +104,12 @@ public class InvoiceSendTask {
}
public static String getExchangeName() {
return EXCHANGE_NAME;
}
@Value("${invoice.exchangename}")
public void setExchangeName(String exchangeName) {
public void setExchangeName(String exchangeName) {
EXCHANGE_NAME = exchangeName;
}
@ -114,7 +118,7 @@ public class InvoiceSendTask {
}
@Value("${invoice.queuename}")
public void setQueueName(String queueName) {
public void setQueueName(String queueName) {
QUEUE_NAME = queueName;
}
@ -123,7 +127,7 @@ public class InvoiceSendTask {
}
@Value("${invoice.routingkey}")
public void setRoutingKey(String routingKey) {
public void setRoutingKey(String routingKey) {
ROUTING_KEY = routingKey;
}
}

@ -3,14 +3,15 @@ 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;
import org.springframework.web.bind.annotation.*;
@Component
@FeignClient(name="basic")
public interface ParameterFeignClient {
@FeignClient(name = "basic")
public interface ParameterFeignClient {
@PostMapping(value = "/basicInfo/invoice/getParameter")
HttpResult getParameter(@RequestBody String companyId);
// @PostMapping(value = "/api/basic/invoice/getParameter")
// HttpResult getParameter(@RequestBody String companyId);
@GetMapping(value = "/api/basic/companyParam/getValue")
HttpResult getCompanyParam(@RequestParam String compId,@RequestParam String paramCode);
}

@ -5,6 +5,7 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import com.djy.invoice.dto.*;
import com.djy.invoice.util.CertificateUtils;
import com.djy.invoice.util.HttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@ -18,6 +19,7 @@ import java.util.*;
* ,
*/
@Component
@Slf4j
public class UploadData {
// 由电子发票平台分配的appCode
@ -113,7 +115,7 @@ public class UploadData {
public static void main(String[] args) throws Exception {
// 开具蓝字发票
doPost("chinaeinv.api.invoice.v3.kp_async", getKpData());
// doPost("chinaeinv.api.invoice.v3.kp_async", getKpData());
// 发票查询
//doPost("chinaeinv.api.invoice.v3.cx", getCx1Data());
@ -127,7 +129,7 @@ public class UploadData {
public static ResponseData doPost(String cmdName, RequestData requestData) throws Exception {
// 生成请求报文
String requestJson = JSON.toJSONStringWithDateFormat(requestData, dateFormat, SerializerFeature.NotWriteRootClassName);
log.info("请求报文:" + requestJson);
// 对请求报文签名,生成签名字符串
String sign = CertificateUtils.signToBase64(requestJson.getBytes(encode), keyStorePath, keyStoreAbner, keyStorePassWord);
@ -137,65 +139,65 @@ public class UploadData {
vars.put("cmdName", URLEncoder.encode(cmdName, encode));
vars.put("sign", URLEncoder.encode(sign, encode));
String responseJson = HttpUtil.doPost(facadeUrl, vars, requestJson, 10000, 10000);
System.out.println("响应报文:" + responseJson);
log.info("响应报文:" + responseJson);
ResponseData responseData = JSON.parseObject(responseJson, ResponseData.class);
System.out.println("响应代码:" + responseData.getCode());
System.out.println("响应消息:" + responseData.getMessage());
log.info("响应代码:" + responseData.getCode());
log.info("响应消息:" + responseData.getMessage());
return responseData;
}
// 生成新开发票参数
public static KpParams getKpData() {
KpParams kpParams = new KpParams();
//业务流水号信息
kpParams.setSerialNo("1ae23a31f00c477582b18f39175e297e"); // 操作流水号
kpParams.setPostTime(df.format(new Date())); // 请求发送时间
//关联订单信息
Order order = new Order(); // 订单信息
order.setOrderNo("1ae23a31f00c477582b18f39175e297e"); // 订单编号2.90
order.setTotalAmount("3.99"); // 消费者的用户名
kpParams.setOrder(order);
//发票信息
KpInvoice kpInvoice = new KpInvoice(); // 发票信息
kpInvoice.setTotalAmount("2.9"); // 发票总金额
kpInvoice.setCustomerName("个人"); // 付款方名称,即发票抬头。
//kpInvoice.setCustomerCode("");
//kpInvoice.setCustomerAddress(" ");
//kpInvoice.setCustomerBanmName(" ");
kpInvoice.setDrawer("系统"); // 开票人
// kpInvoice.setPayee("");
//kpInvoice.setReviewer("");
kpInvoice.setTaxpayerCode(taxpayerCode); // 收款方纳税人识别号
kpInvoice.setRemark("发票备注信息"); // 发票备注
//发票明细内容,最多支持100条
List<KpInvoiceItem> itemList=new ArrayList<KpInvoiceItem>();// 发票项目明细列表
KpInvoiceItem item1 = new KpInvoiceItem(); // 项目明细1
item1.setType("0");
item1.setImei(""); // 商品IMIE号
item1.setCode(""); // 商品编码
item1.setAmount("2.9"); // 金额
item1.setName("一档气费"); // 商品名称
item1.setItemRemark(""); // 商品备注
item1.setPrice("2.90"); // 商品单价
item1.setQuantity("1"); // 数量
item1.setTaxRate("0.10"); // 税率
item1.setUom(""); // 单位
item1.setCatalogCode("1100202020000000000"); //必选项
itemList.add(item1);
kpInvoice.setItems(itemList);
kpParams.setInvoice(kpInvoice);
//通知方式节点,最多支持三条
Notice notice=new Notice(Notice.NOTICE_TYPE_EMAIL,"zhangdq@chinaeinv.cn");//邮件通知地址
List<Notice> notices=new ArrayList<Notice>();
notices.add(notice);
kpParams.setNotices(notices);
return kpParams;
}
// public static KpParams getKpData() {
// KpParams kpParams = new KpParams();
// //业务流水号信息
// kpParams.setSerialNo("1ae23a31f00c477582b18f39175e297e"); // 操作流水号
// kpParams.setPostTime(df.format(new Date())); // 请求发送时间
//
// //关联订单信息
// Order order = new Order(); // 订单信息
// order.setOrderNo("1ae23a31f00c477582b18f39175e297e"); // 订单编号2.90
// order.setTotalAmount("3.99"); // 消费者的用户名
// kpParams.setOrder(order);
//
// //发票信息
// KpInvoice kpInvoice = new KpInvoice(); // 发票信息
// kpInvoice.setTotalAmount("2.9"); // 发票总金额
// kpInvoice.setCustomerName("个人"); // 付款方名称,即发票抬头。
// //kpInvoice.setCustomerCode("");
// //kpInvoice.setCustomerAddress(" ");
// //kpInvoice.setCustomerBanmName(" ");
// kpInvoice.setDrawer("系统"); // 开票人
// // kpInvoice.setPayee("");
// //kpInvoice.setReviewer("");
// kpInvoice.setTaxpayerCode(taxpayerCode); // 收款方纳税人识别号
// kpInvoice.setRemark("发票备注信息"); // 发票备注
//
// //发票明细内容,最多支持100条
// List<KpInvoiceItem> itemList=new ArrayList<KpInvoiceItem>();// 发票项目明细列表
// KpInvoiceItem item1 = new KpInvoiceItem(); // 项目明细1
// item1.setType("0");
// item1.setImei(""); // 商品IMIE号
// item1.setCode(""); // 商品编码
// item1.setAmount("2.9"); // 金额
// item1.setName("一档气费"); // 商品名称
// item1.setItemRemark(""); // 商品备注
// item1.setPrice("2.90"); // 商品单价
// item1.setQuantity("1"); // 数量
// item1.setTaxRate("0.10"); // 税率
// item1.setUom(""); // 单位
// item1.setCatalogCode("1100202020000000000"); //必选项
// itemList.add(item1);
// kpInvoice.setItems(itemList);
// kpParams.setInvoice(kpInvoice);
//
// //通知方式节点,最多支持三条
// Notice notice=new Notice(Notice.NOTICE_TYPE_EMAIL,"zhangdq@chinaeinv.cn");//邮件通知地址
// List<Notice> notices=new ArrayList<Notice>();
// notices.add(notice);
// kpParams.setNotices(notices);
//
// return kpParams;
// }
// 生成冲红发票参数
private static ChParams getChData() {

@ -47,8 +47,8 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
@Autowired
private ParameterFeignClient parameterFeignClient;
private static String cmdName;
private static String cmdCxName;
private static String cmdName; //开票接口名
private static String cmdCxName; //查询发票接口名
private static String SendTo;
private static String SmtpConfig;
@ -85,7 +85,7 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
public HttpResult getlink(String json) {
log.info("参数json====={}", json);
log.info("上传发票数据json====={}", json);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -103,8 +103,9 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
for (InvLinkInfo linkinfo : links) {
HttpResult result = parameterFeignClient.getParameter(linkinfo.getCompanyId());
String amount = (String) result.getData();
HttpResult result = parameterFeignClient.getCompanyParam(linkinfo.getCompanyId(), "INVOICE_CUSTOMER_AMOUNT_LIMIT");
LinkedHashMap<String, Object> mapRtn = (LinkedHashMap<String, Object>) result.getData();
String amount = (String) mapRtn.get("itemcode");
//判断开票限额格式和是否存在
if (null == amount) {
@ -337,8 +338,9 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
InvInvoiceDetail detail = new InvInvoiceDetail();
detail.setGID(UUID.randomUUID().toString().replace("-", ""));
detail.setInvId(invoice.getGID());
detail.setGoodsName("1");
detail.setGoodsCode("1001");
detail.setGoodsName("代理海运费");
detail.setGoodsCode("3040802010200000000");
detail.setNum(BigDecimal.ONE);
// detail.setPrice(feeinfo.getUnitPrice());
// detail.setNum(feeinfo.getQuantity());
detail.setWithTaxFlag("1");
@ -352,13 +354,15 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
detail.setTaxExcludedAmount(amount);
}
detail.setTaxIncludedAmount(detail.getTaxExcludedAmount());
detail.setPrice(detail.getTaxExcludedAmount());
detail.setSpecType("");
detail.setUnit(feeinfo.getUnit());
detail.setFavouredPolicyFlag("0");
detail.setFavouredPolicyName("0");
detail.setFavouredPolicyFlag("1");
detail.setFavouredPolicyName("免税");
detail.setZeroRateFlag("1");
detail.setRemark("111");
// detail.setRemark("111");
return detail;
}
@ -398,8 +402,13 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
if (null != fees && fees.size() > 0) {
HttpResult result = parameterFeignClient.getParameter(link.getCompanyId());
String amountParam = (String) result.getData();
// HttpResult result = parameterFeignClient.getParameter(link.getCompanyId());
// String amountParam = (String) result.getData();
HttpResult result = parameterFeignClient.getCompanyParam(link.getCompanyId(), "INVOICE_CUSTOMER_AMOUNT_LIMIT");
LinkedHashMap<String, Object> mapRtn = (LinkedHashMap<String, Object>) result.getData();
String amountParam = (String) mapRtn.get("itemcode");
BigDecimal invoiceAmount = new BigDecimal(amountParam);
BigDecimal checkinvocie = new BigDecimal(0);
@ -765,6 +774,7 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
// 生成新开发票参数
public KpParams getKpData(InvInvoiceInfo invoice) {
log.info("获取开票数据KpParams");
KpParams kpParams = new KpParams();
//业务流水号信息
kpParams.setSerialNo(invoice.getGID()); // 操作流水号
@ -800,11 +810,11 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
item1.setAmount(detail.getTaxExcludedAmount() + ""); // 金额
item1.setName(detail.getGoodsName()); // 商品名称
item1.setItemRemark(""); // 商品备注
item1.setPrice(null); // 商品单价
item1.setQuantity(null); // 数量
item1.setPrice(detail.getPrice().toString()); // 商品单价
item1.setQuantity(detail.getNum().toString()); // 数量
item1.setTaxRate("0"); // 税率
item1.setUom(detail.getUnit()); // 单位
item1.setCatalogCode("1100202020000000000"); //必选项
item1.setCatalogCode(detail.getGoodsCode()); //必选项
itemList.add(item1);
kpInvoice.setItems(itemList);
kpParams.setInvoice(kpInvoice);
@ -827,8 +837,11 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
InvLinkInfo link = invLinkInfoMapper.selectByGID(info);
HttpResult result = parameterFeignClient.getParameter(link.getCompanyId());
String amount = (String) result.getData();
// HttpResult result = parameterFeignClient.getParameter(link.getCompanyId());
// String amount = (String) result.getData();
HttpResult result = parameterFeignClient.getCompanyParam(link.getCompanyId(), "INVOICE_CUSTOMER_AMOUNT_LIMIT");
LinkedHashMap<String, Object> mapRtn = (LinkedHashMap<String, Object>) result.getData();
String amount = (String) mapRtn.get("itemcode");
BigDecimal invoiceAmount = new BigDecimal(amount);
@ -1021,6 +1034,7 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
data = new ResponseData();
log.info(df.format(new Date()) + "开始调用瑞宏开票接口" + ",invoiceId=" + invoice.getGID());
data = UploadData.doPost(cmdName, getKpData(invoice));
log.info(df.format(new Date()) + "调用瑞宏开票返回" + data.getCode() + data.getMessage());
invoice.setSerialNo(data.getSerialNo());
invoice.setApiSendTime(df.parse(df.format(new Date())));
invInvoiceInfoMapper.updateById(invoice);
@ -1038,6 +1052,11 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
return HttpResult.ok("发票已发送");
}
/**
*
* @param info
* @return
*/
@Override
public HttpResult getInvoice(InvLinkInfo info) {

@ -8,7 +8,7 @@
<pattern>[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
<level>INFO</level>
</filter>
</appender>
@ -22,10 +22,8 @@
<encoder>
<pattern>[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
@ -37,7 +35,7 @@
<encoder>
<pattern>[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
</appender>

Loading…
Cancel
Save