Compare commits

..

8 Commits

Author SHA1 Message Date
kk a58b76218c Merge branch 'beta-all' into beta-prop-all 1 year ago
kk 6f23d300cc feature: 发票预览文件下载 1 year ago
kk bfd4898466 Merge remote-tracking branch 'origin/beta' into beta 1 year ago
kane 06a8281925 自主授权调用短信接口域名修改 2 years ago
kk eee31b62ab feature: 发票预览文件下载 2 years ago
kk 57feb5766f 作废返回代码处理 2 years ago
kk 80c0d73fc8 批量查验加入收费逻辑 2 years ago
kk 59b268b365 Revert "红字信息表上传合并开发" 2 years ago
  1. 10
      jianshui-admin/src/main/java/com/jianshui/api/controller/http/income/v1/InvoiceCheckController.java
  2. 72
      jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoice/v1/InvoiceController.java
  3. 2
      jianshui-admin/src/main/resources/application-dev.yml
  4. 2
      jianshui-admin/src/main/resources/application.yml
  5. 8
      jianshui-common/src/main/java/com/jianshui/common/utils/encrypt/AisinoInvoiceDecryptUtil.java
  6. 2
      jianshui-common/src/main/java/com/jianshui/common/utils/encrypt/AisinoInvoiceEncryptUtil.java
  7. 5
      jianshui-income/src/main/java/com/jianshui/income/service/impl/EleCheckInvoiceImpl.java
  8. 4
      jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/impl/AutonomousSqServiceImpl.java
  9. 13
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/InvoiceFile.java
  10. 15
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java
  11. 14
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java
  12. 4
      jianshui-invoice/src/main/java/com/jianshui/invoice/utils/BillDetailFormatUtil.java
  13. 7
      jianshui-invoice/src/main/resources/mapper/invoice/InvoiceFileMapper.xml
  14. 3
      jianshui-system/src/main/java/com/jianshui/system/service/IServiceManageService.java
  15. 55
      jianshui-system/src/main/java/com/jianshui/system/service/impl/ServiceManageServiceImpl.java
  16. 9
      jianshui-ui/src/api/sdInvoicefile/sdinvoicefile.js
  17. 30
      jianshui-ui/src/views/sdinvoicefile/index.vue

@ -114,6 +114,16 @@ public class InvoiceCheckController {
ICheckInvoice incomeService = incomeServiceFactory.getService(serviceKey);
AjaxResult result = incomeService.checkInvoiceMultil(companyservice, invoiceCheck);
// 2023/11/30 新增扣费逻辑,成功就扣
if (result.isSuccess()) {
JSONObject resp = result.getJsonData();
Integer robUser = resp.getInteger("robUserMoney");
if (robUser != null && robUser >= 1) {
serviceManageService.companyConsume("income", companyservice.getCompanyid(),robUser);
}
}
String responseAdapterKey = serviceManageService.getResponseAdapterKey("income", companyservice.getCompanyid());
IIncomeResponseService incomeResponseService = incomeResponseFactory.getService(responseAdapterKey);
return incomeResponseService.response(result, companyservice, "check_multil");

@ -5,12 +5,15 @@ import cn.hutool.core.codec.Base64Decoder;
import cn.hutool.core.codec.Base64Encoder;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.jianshui.common.core.domain.AjaxResult;
import com.jianshui.common.core.domain.entity.Companyservice;
import com.jianshui.common.enums.ErrorCode;
@ -28,6 +31,7 @@ import com.jianshui.invoice.domain.ele.FindRedInfoDTO;
import com.jianshui.invoice.domain.ele.HZSQDMessage;
import com.jianshui.invoice.mapper.InvoiceBackMapper;
import com.jianshui.invoice.mapper.InvoiceFileMapper;
import com.jianshui.invoice.service.impl.api.ElephantInvoiceApiV6ServiceImpl;
import com.jianshui.invoice.task.AddInvoiceBatchTask;
import com.jianshui.invoice.task.InvoiceBackTask;
import com.jianshui.invoice.utils.elephant.ElephantUtils;
@ -2083,33 +2087,63 @@ public class InvoiceController {
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/QuerySdInvoiceFileDownload/{identity}", "/api/invoice/v1/QuerySdInvoiceFileDownload", "/invoice/QuerySdInvoiceFileDownload"})
public Object QuerySdInvoiceFileDownload(HttpServletRequest request, String identity) throws Exception {
public void QuerySdInvoiceFileDownload(HttpServletResponse response, @RequestBody JSONObject jsonParam) throws Exception {
if (StringUtils.isEmpty(identity)) {
return AjaxResult.error(ErrorCode.EMPTY_IDENTITY);
if (ObjectUtil.isEmpty(jsonParam)) {
return;
}
Companyservice companyservice = iCompanyserviceService.selectCompanyserviceByIdentity(identity);
if (companyservice == null) {
return AjaxResult.error(ErrorCode.COMPANY_NOT_FOUND);
String ty = jsonParam.get("ty") != null ? jsonParam.get("ty").toString() : "";
String id = jsonParam.get("id") != null ? jsonParam.get("id").toString() : "";
InvoiceFile invoiceFile = invoiceFileMapper.selectInvoiceFileById(id);
if (BeanUtil.isEmpty(invoiceFile) || StrUtil.isEmpty(invoiceFile.getFileContent())) {
return;
}
String fileName = invoiceFile.getFileName();
String fphm = invoiceFile.getFphm();
String tax = invoiceFile.getTax();
String identity = invoiceFile.getIdentity();
// 获得入口报文适配器
String requestAdapterKey = serviceManageService.getRequestAdapterKey("invoice", companyservice.getCompanyid());
IInvoiceRequestService invoiceRequestService = invoiceRequestFactory.getService(requestAdapterKey);
JSONObject decryptResult = invoiceRequestService.decrypt(request, companyservice, "");
try {
JSONObject decryptResult = new JSONObject();
decryptResult.put("XHFSBH", tax);
decryptResult.put("ENTID", "");
decryptResult.put("SDFPHM", fphm);
decryptResult.put("WJLX", ty);
// 获得请求实例,并且进行扣费
String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid());
serviceManageService.companyConsume("invoice", companyservice.getCompanyid());
IInvoiceApiService invoiceService = new ElephantInvoiceApiV6ServiceImpl();
Companyservice companyservice = new Companyservice();
companyservice.setCompanyid(Long.valueOf(identity));
HXResponse result = invoiceService.QuerySdInvoiceFile(decryptResult, companyservice);
IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey);
HXResponse result = invoiceService.QuerySdInvoiceFile(decryptResult, companyservice);
String data = result.get("data") != null ? result.get("data").toString() : "";
String responseAdapterKey = serviceManageService.getResponseAdapterKey("invoice", companyservice.getCompanyid());
IInvoiceResponseService invoiceResponseService = invoiceResponseFactory.getService(responseAdapterKey);
Gson gson = new Gson();
JsonObject jsonObject = gson.fromJson(data, JsonObject.class);
return invoiceResponseService.response(result, companyservice, "");
JsonArray fileItemList = jsonObject.getAsJsonArray("FILEITEMLIST");
String fileContent = "";
if(!fileItemList.isEmpty()){
JsonObject fileItem = fileItemList.get(0).getAsJsonObject();
fileContent = fileItem.get("FILECONTENT").getAsString();
}
byte[] buffer = Base64Decoder.decode(fileContent); // 将文件流字符串转换为字节数组
response.reset();
response.setCharacterEncoding("UTF-8");
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".pdf");
response.addHeader("Content-Length", "" + buffer.length);
response.setContentType("application/pdf");
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
outputStream.write(buffer);
outputStream.flush();
outputStream.close(); // 关闭输出流
} catch (IOException ex) {
ex.printStackTrace();
}
}
@ -2135,7 +2169,7 @@ public class InvoiceController {
String content = invoiceFile.getFileContent();
String co = convertPdfBase64ToImageBase64(content);
return "data:image/jpeg;base64,"+co;
return "data:image/jpeg;base64," + co;
}

@ -91,6 +91,8 @@ ele_check_url: https://openapi.zncspt.com/api/
elephant_entcode_check: 91370102MA3UD2FG21
# 文件下载地址
elephant_invoice_file: http://127.0.0.1:8081/invoice/fileUrl/
# 德才定制 放到数据库
#elephant_invoice_file_dc: http://127.0.0.1:8088/sdFile/
# 大象V6数电对应平台地址
ele_url_v6: https://js.ele12.com/order-api
#ele_url_v6: http://192.168.3.60:18108/order-api

@ -46,7 +46,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: dev
active: prod
# 文件上传
servlet:
multipart:

@ -161,11 +161,11 @@ public class AisinoInvoiceDecryptUtil {
// 返回解密后的数组,其中前16位MD5Hash码要除去。
return new String(temp, 16, temp.length - 16, StandardCharsets.UTF_8);
} catch (Exception e) {
temp = AES_CBC_Decrypt(hexToBytes(xmlStr), mKey.getBytes(), ivParam);
String sanitizedString = new String(temp, StandardCharsets.UTF_8).replaceAll("[^\\x20-\\x7E]", "").replace("n=","");
String resTemp = new String(temp);
return sanitizedString;
// TODO kk:2024/1/30 解密有问题,每次前面带一段编码,后面在研究
return resTemp.substring(resTemp.indexOf("{\""), resTemp.length());
}
@ -527,7 +527,7 @@ public class AisinoInvoiceDecryptUtil {
public static void main(String[] args) throws Exception {
// String str = "{\"identity\":\"B8FB14CA1C6D7C93D9154E2262FF0F9DD796B180A2A7690A\",\"order\":{\"orderno\":\"No.20160308151221\",\"saletaxnum\":\"110101MXB6CK9Q6\",\"saleaddress\":\"万塘路30号\",\"salephone\":\"0571-1234567\",\"saleaccount\":\"工商银行6222222222222\",\"clerk\":\"sa\",\"payee\":\"sa\",\"checker\":\"sa\",\"invoicedate\":\"2016-03-08 15:12:21\",\"ordertotal\":\"8.00\",\"kptype\":\"1\",\"taxtotal\":\"1.16\",\"bhtaxtotal\":\"6.84\",\"address\":\"浙江杭州 0571-123456789\",\"phone\":\"0571-123456789\",\"taxnum\":\"339900000000004\",\"buyername\":\"浙江爱信诺航天信息有限公司\",\"account\":\"工商-123456789浙江爱信诺航天信息有限公司\",\"message\":\"浙江爱信诺航天信息有限公司\",\"fpdm\":\"\",\"fphm\":\"\",\"detail\":[{\"goodsname\":\"1\",\"spec\":\"1\",\"unit\":\"1\",\"hsbz\":\"1\",\"num\":\"1\",\"price\":\"4\",\"taxrate\":\"0.17\"},{\"goodsname\":\"2\",\"spec\":\"2\",\"unit\":\"2\",\"hsbz\":\"1\",\"num\":\"1\",\"price\":\"4\",\"taxrate\":\"0.17\"}]}}";
String str = "53316a496c4a524c58424e74982b3ca50ed0717faf5b95980ce4b099c1f9de11287b4c8a41b5640888243d0f9de16e335281925cf48eb07d28b241228bb27af3bb9bb21328b9967f5219cb9c7ff3f818f0dbfbb8c6246eeda7909b8057a305b9fa4c95b8c98bf67300300b6e2e3c7acbb353289bb0496125698cf5719dcbbd2f81b6627e25b040c883866f290ee75d7931bf00c0f8fd6b89ffaab386f22114275687fe618458da978b8bc3bc302fdaa3bb8c06199a877bd5fdb1c628d0c18ad1b7e9038ad88ff3f37f9c212c31a994696d910e9ee403db58c9f557ac051c4bd7b441f5ba6e53eec828191545a3cd1f82a0a9bab46cc42c271ee7d6043f35d32ee9ec9014a015333f9f0cbc2cf0db816d44424606ea4370364cccd303c369efef51870a2bfe7c80d680f3ff9a40619e2bf94e3407a5315cd3ca7086489481c4004cf8ab90ed29e1c942b275ad956ef045efa5d6950036091f02d2165a7a1953e00bbe2d0e276ba5b7b9e47f106d8addfcef2d1e7bed39ab6b1a25de650f068596dbefd6cf9be4c7e3b50cadc0d49e370b3d6d9268ee73b3d5b1fcbf253f2785743484e9fd213582b7866d58672afb8603ec0f1a730b98469355d98c05205a7b497fb91e67b85af1fb2e5c388655819af08f5bea958704eb637f00073439aa968ea345f6befce238e65cb4d753483c94f58898991d0e096508350c56589ac2abe4b6e9f901cf414992d2a1f38887d885e0cecea164794ebdbd6dde7102a70a4ff1174b8791e824699b740cdf9d8c217f667ca209bcc7a927495036ed21ce280dfc2c1eb1a740d4021a5378cf11d1ac105a4b5107ee5831b831b2f30adf79527603578cd9d875fb0d5a974ec57354ef2a8e82ec23b0172a4d56f8d50898096c6bc6e6f5ebf49f1109f756be881457b206db1905b88d8922fc78507705dec5706e6d18d31b413e55541f4b394ea6f2a906e902dfea104efe30c0f909e25cba571be6703da5f589fe488bdb810cd9ed426f3a73476128a8393e9b40c96ec430a66412be6f613c63a9e94091f87a7daa6043b1be37fa6e7cc0520352cae8aaa7cbd26dce78f2a9419d39bf1f109249d64d5f34454dab0f3c9b1466192104790a9371794c6ea73838ec6197a87c87f328bc0921cc8e0d060b1d757fee0d59df84b1116519935c16d7b89655c78eb782c08fdcc04d60c8b7df32852a90cf72a10aace001fd0d56b2036a2f614fa695c506e96859c4227e09f4ec3f05cdaabd41127063b150b825a1905b1c26bf17cac02cefaefeb4265a531de3ccc1507609717418d34628542a6a95d49e1126d590b921c360ae18896d715bb5f9770e962966e6059693d8e7cdfed5dc1452b709ee5dfc96f9e679a40ec6e937792aa9f8c9268e31ebf21788352eb98cb658707b844f859c21aa2b62d2ff247f1b2e81b49e2028bc759bf2df4e54c151650ad0147c7e9e23d0d7364db0fa0810a404412c07f13389310200b114917c42a4ab7542170d5176b927972910b359b2fdb9809ae087f3edccab738f01ea5df1a7a2e05964363194ebdcd5dcb5d36b20621f4bb0837f8c9938aa6c8250e5430b0485c7aac982b83dc91c691d0d98fe110a7a0b31b324469887659b87ea4116f5039b4419816ff6a3dfc28431fd0c00360ac9bc1536ed11f1d9fde938fd057a5b9e4a4a87af81d72399b4475d431b7c65f1ce1626e696a45a7186b01e26b1c3710df3efd098af0e396c5c117294e81a6ea1874a396736207d9c92a7db2a92c2adc5061498d11a167915a34536d38f29c2a7e5574fbf1e2d8e3cc1c621305fdf97e1b34cfbbc94b76aa66b20a82b189894b5b3e369bdb639a55ab40f7afed7840eb836bc9a54ffdd228476b1085855e883975526826df155e06a8dd37234b1a4c89463da762a";
String str = "53316a496c4a524c58424e74567fa67fbca2984d30f04309cf9887a8c1f9de11287b4c8a41b5640888243d0f9de16e335281925cf48eb07d28b241228bb27af3bb9bb21328b9967f5219cb9c7ff3f818f0dbfbb8c6246eeda7909b8057a305b9fa4c95b8c98bf67300300b6e2e3c7acbb353289bb0496125698cf5719dcbbd2f81b6627e25b040c883866f290ee75d7931bf00c0f8fd6b89ffaab386f22114275687fe618458da978b8bc3bc302fdaa3bb8c06199a877bd5fdb1c628d0c18ad1b7e9038ad88ff3f37f9c212c31a994696d910e9ee403db58c9f557ac051c4bd7b441f5ba6e53eec828191545a3cd1f82a0a9bab46cc42c271ee7d6043f35d32ee9ec9014a015333f9f0cbc2cf0db816d44424606ea4370364cccd303c369efef51870a2bfe7c80d680f3ff9a40619e2bf94e3407a5315cd3ca7086489481c4004cf8ab90ed29e1c942b275ad956ef045efa5d6950036091f02d2165a7a1953e00bbe2d0e276ba5b7b9e47f106d8addfcef2d1e7bed39ab6b1a25de650f068596dbefd6cf9be4c7e3b50cadc0d49e370b3d6d9268ee73b3d5b1fcbf253f2785743484e9fd213582b7866d58672afb8603ec0f1a730b98469355d98c05205a7b497fb91e67b85af1fb2e5c388655819af08f5bea958704eb637f00073439aa968ea345f6befce238e65cb4d753483c94f58898991d0e096508350c56589ac2abe4b6e9f901cf414992d2a1f38887d885e0cecea164794ebdbd6dde7102a70a4ff1174b8791e824699b740cdf9d8c217f667ca209bcc7a927495036ed21ce280dfc2c1eb1a740d4021a5378cf11d1ac105a4b5107ee5831b831b2f30adf79527603578cd9d875fb0d5a974ec57354ef2a8e82ec23b0172a4d56f8d50898096c6bc6e6f5ebf49f1109f756be881457b206db1905b88d8922fc78507705dec5706e6d18d31b413e55541f4b394ea6f2a906e902dfea104efe30c0f909e25cba571be6703da5f589fe488bdb810cd9ed426f3a73476128a8393e9b40c96ec430a66412be6f613c63a9e94091f87a7daa6043b1be37fa6e7cc0520352cae8aaa7cbd26dce78f2a9419d39bf1f109249d64d5f34454dab0f3c9b1466192104790a9371794c6ea73838ec6197a87c87f328bc0921cc8e0d060b1d757fee0d59df84b1116519935c16d7b89655c78eb782c08fdcc04d60c8b7df32852a90cf72a10aace001fd0d56b2036a2f614fa695c506e96859c4227e09f4ec3f05cdaabd41127063b150b825a1905b1c26bf17cac02cefaefeb4265a531de3ccc1507609717418d34628542a6a95d49e1126d590b921c360ae18896d715bb5f9770e962966e6059693d8e7cdfed5dc1452b709ee5dfc96f9e679a40ec6e937792aa9f8c9268e31ebf21788352eb98cb658707b844f859c21aa2b62d2ff247f1b2e81b49e2028bc759bf2df4e54c151650ad0147c7e9e23d0d7364db0fa0810a404412c07f13389310200b114917c42a4ab7542170d5176b927972910b359b2fdb9809ae087f3edccab738f01ea5df1a7a2e05964363194ebdcd5dcb5d36b20621f4bb0837f8c9938aa6c8250e5430b0485c7aac982b83dc91c691d0d98fe110a7a0b31b324469887659b87ea4116f5039b4419816ff6a3dfc28431fd0c00360ac9bc1536ed11f1d9fde938fd057a5b9e4a4a87af81d72399b4475d431b7c65f1ce1626e696a45a7186b01e26b1c3710df3efd098af0e396c5c117294e81a6ea1874a396736207d9c92a7db2a92c2adc5061498d11a167915a34536d38f29c2a7e5574fbf1e2d8e3cc1c621305fdf97e0b64cfbbc94b76aa66b20a82b189894b5b3e369bdb639a55ab40f7afed7840eb836bc9a54ffdd228476b1085855e883975526826d2efbbb1aadf7c10f1441e28d7d515846";
str=decrypt(str,"S1jIlJRLXBNtIFihvQ0VPw==");
System.out.println(str);
// str=decrypt(str);

@ -203,7 +203,7 @@ public class AisinoInvoiceEncryptUtil {
System.out.println("AES密钥:");
System.out.println(keyHex);
String str = "{\"terminalNumber\":\"\",\"orderno\":\"fcd3a67d-6a6e-f714-0790-c705db41403d\",\"sellerBank\":null,\"checker\":\"\",\"saleaddress\":null,\"payee\":\"\",\"hsbz\":\"2\",\"kjlx\":\"\",\"saleaccount\":null,\"qdbz\":\"0\",\"ext\":{\"sfhqsyed\":false},\"xsfnsrsbh\":\"92370214MACAAEK16E\",\"xsflxdh\":null,\"cpybz\":\"0\",\"fjh\":\"\",\"tax\":\"0.3\",\"dkbz\":\"0\",\"phone\":\"\",\"dqbm\":\"\",\"xsfyhzh\":null,\"jshj\":\"10.3\",\"tsfs\":\"2\",\"detail\":[{\"fphxz\":\"0\",\"lslbs\":\"\",\"unit\":\"\",\"hsbz\":\"0\",\"taxrate\":\"0.03\",\"yhzcbs\":\"0\",\"zzstsgl\":\"\",\"price\":\"\",\"num\":\"\",\"goodsname\":\"维修费\",\"spbm\":\"202\",\"spec\":\"\",\"taxfreeamt\":\"10.00\",\"tax\":\"0.30\",\"taxamt\":\"10.30\"}],\"taxamt\":\"10\",\"saletaxnum\":\"92370214MACAAEK16E\",\"sellerName\":\"城阳区兴顺通制冷设备维修服务部\",\"billInfono\":\"\",\"xsfkhh\":null,\"fpqqlsh\":\"fcd3a67d-6a6e-f714-0790-c705db41403d\",\"qdxmmc\":\"\",\"gfxxconfirm\":\"\",\"invoiceLine\":\"82\",\"serviceId\":\"lzfpkj\",\"email\":\"\",\"salephone\":null,\"address\":\"北京市-西城区-市岱岳区山口镇油坊村 80965631\",\"fpdm\":\"\",\"bsrysfzjhm\":\"370882198408212815\",\"kptype\":\"1\",\"message\":\"\",\"clerk\":\"鹿旭\",\"async\":\"true\",\"xsfmc\":\"城阳区兴顺通制冷设备维修服务部\",\"xsfdz\":null,\"taxnum\":\"91370112MA3C5P3322\",\"jqbh\":\"370882198408212815\",\"account\":\"中国建设银行济南市泉城支行 376010100101019236\",\"invoicedate\":\"2024-01-25\",\"buyername\":\"高速公路有限公司\",\"fphm\":\"\"}";
String str = "{\"terminalNumber\":\"\",\"orderno\":\"fcd3a67d-6a6e-f714-0790-c705db41403d\",\"sellerBank\":null,\"checker\":\"\",\"saleaddress\":null,\"payee\":\"\",\"hsbz\":\"2\",\"kjlx\":\"\",\"saleaccount\":null,\"qdbz\":\"0\",\"ext\":{\"sfhqsyed\":false},\"xsfnsrsbh\":\"92370214MACAAEK16E\",\"xsflxdh\":null,\"cpybz\":\"0\",\"fjh\":\"\",\"tax\":\"0.3\",\"dkbz\":\"0\",\"phone\":\"\",\"dqbm\":\"\",\"xsfyhzh\":null,\"jshj\":\"10.3\",\"tsfs\":\"2\",\"detail\":[{\"fphxz\":\"0\",\"lslbs\":\"\",\"unit\":\"\",\"hsbz\":\"0\",\"taxrate\":\"0.03\",\"yhzcbs\":\"0\",\"zzstsgl\":\"\",\"price\":\"\",\"num\":\"\",\"goodsname\":\"维修费\",\"spbm\":\"202\",\"spec\":\"\",\"taxfreeamt\":\"10.00\",\"tax\":\"0.30\",\"taxamt\":\"10.30\"}],\"taxamt\":\"10\",\"saletaxnum\":\"92370214MACAAEK16E\",\"sellerName\":\"城阳区兴顺通制冷设备维修服务部\",\"billInfono\":\"\",\"xsfkhh\":null,\"fpqqlsh\":\"fcd3a67d-6a6e-f714-0790-c705db41403d\",\"qdxmmc\":\"\",\"gfxxconfirm\":\"\",\"invoiceLine\":\"82\",\"serviceId\":\"lzfpkj\",\"email\":\"\",\"salephone\":null,\"address\":\"北京市-西城区-市岱岳区山口镇油坊村 80965631\",\"fpdm\":\"\",\"bsrysfzjhm\":\"370882198408212815\",\"kptype\":\"1\",\"message\":\"\",\"clerk\":\"鹿旭\",\"async\":\"true\",\"xsfmc\":\"城阳区兴顺通制冷设备维修服务部\",\"xsfdz\":null,\"taxnum\":\"91370112MA3C5P3322\",\"jqbh\":\"370882198408212815\",\"account\":\"中国建设银行济南市泉城支行 376010100101019236\",\"invoicedate\":\"2024-01-30\",\"buyername\":\"高速公路有限公司\",\"fphm\":\"\"}";
String key = "S1jIlJRLXBNtIFihvQ0VPw==";
System.out.println(encryptAES(str,key));

@ -311,8 +311,11 @@ public class EleCheckInvoiceImpl implements ICheckInvoice {
return AjaxResult.error(errorCode, errorString);
}
JSONObject result = new JSONObject();
result.put("robUserMoney", invoiceCheckList.size());
return new AjaxResult(200, "批次接收成功!", result);
return AjaxResult.success("批次接收成功!");
// return AjaxResult.success("批次接收成功!");
}
/**

@ -282,9 +282,9 @@ public class AutonomousSqServiceImpl implements AutonomousSqService {
if ("SMS".equals(invoiceAllLoginResult.getCode()) || "F000".equals(invoiceAllLoginResult.getCode())) {
try {
// 请求封装
log.info("自主授权短信提交接口,请求上游地址:{},入参:{}", "http://221.222.184.98:8880/login/submitSms", JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO));
log.info("自主授权短信提交接口,请求上游地址:{},入参:{}", "http://zzsq.jcsk100.com/login/submitSms", JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO));
Thread requestThread = new Thread(() -> {
HttpUtils.sendJsonPost("http://221.222.184.98:8880/login/submitSms", invoiceAllSubmitNoteDTO);
HttpUtils.sendJsonPost("http://zzsq.jcsk100.com/login/submitSms", invoiceAllSubmitNoteDTO);
});
requestThread.start();
} catch (Exception e) {

@ -38,7 +38,18 @@ public class InvoiceFile extends BaseEntity
@Excel(name = "税号")
private String tax;
public void setId(String id)
@Excel(name = "发票号码")
private String fphm;
public String getFphm() {
return fphm;
}
public void setFphm(String fphm) {
this.fphm = fphm;
}
public void setId(String id)
{
this.id = id;
}

@ -1395,12 +1395,14 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
} else if (StringUtils.isNotEmpty(fpdm) && StringUtils.isNotEmpty(fphm)) {
invoice = invoiceMapper.selectByFpdmFphm(companyservice.getCompanyid(), fpdm, fphm);
} else {
throw new JianshuiParamErrorException(ErrorCode.EMPTY_FPQQLSH, companyservice, "invoice");
// throw new JianshuiParamErrorException(ErrorCode.EMPTY_FPQQLSH, companyservice, "invoice");
return new HXResponse(ErrorCode.EMPTY_FPQQLSH.getCode(),ErrorCode.EMPTY_FPQQLSH.getMsg(), null, false);
}
//发票不存在
if (invoice == null) {
throw new JianshuiParamErrorException(ErrorCode.INVOICE_NOT_EXISTS, companyservice, "invoice");
// throw new JianshuiParamErrorException(ErrorCode.INVOICE_NOT_EXISTS, companyservice, "invoice");
return new HXResponse(ErrorCode.INVOICE_NOT_EXISTS.getCode(),ErrorCode.INVOICE_NOT_EXISTS.getMsg(), null, false);
}
// TODO 发票状态查询
@ -1422,20 +1424,23 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
} catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) {
log.error("【销项发票】【大象接口】【发票作废】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(queryBody).toString(), JSONObject.toJSONString(companyservice));
e.printStackTrace();
throw new JianshuiServiceException("系统异常!");
// throw new JianshuiServiceException("系统异常!");
return new HXResponse("9999","系统异常!", null, false);
}
log.info("【销项发票】【大象发票】发票作废请求结果{}", queryResult.toString());
// 判断外层报文是否成功
if (queryResult.isError()) {
throw new JianshuiServiceException(queryResult.getMsg());
// throw new JianshuiServiceException(queryResult.getMsg());
return new HXResponse("9999",queryResult.getMsg(), null, false);
}
// 处理返回报文
JSONObject content = queryResult.getJsonData();
String ztdm = content.getString("ZTDM");
if (!StringUtils.equalsAny(ztdm, "040000")) {
return new HXResponse(content.getString("ZTXX"));
// return new HXResponse(content.getString("ZTXX"));
return new HXResponse("9999",content.getString("ZTXX"), null, false);
}
// TODO 发票作废通过接口查询
// // 获取作废状态

@ -65,6 +65,7 @@ import com.jianshui.system.domain.InvoiceAllApiLog;
import com.jianshui.system.mapper.CompanyserviceMapper;
import com.jianshui.system.mapper.CompanyservicePropMapper;
import com.jianshui.system.mapper.InvoiceAllApiLogMapper;
import com.jianshui.system.service.ICompanyservicePropService;
import com.jianshui.system.service.ISysConfigService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
@ -128,10 +129,12 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
private InvoiceFileMapper invoiceFileMapper;
private static String ELE_File_URL;
private static String ELE_File_URL_DC;
static {
Environment environment = SpringUtils.getBean(Environment.class);
ELE_File_URL = environment.getProperty("elephant_invoice_file");
ELE_File_URL_DC = environment.getProperty("elephant_invoice_file_dc");
}
/**
@ -619,6 +622,13 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
// 2023/11/16 kk:上传OSS转下载地址关闭,改为直接返回大象的文件流
invoice.setInvoicePdfUrl(ELE_File_URL + fileId);
ICompanyservicePropService companyserviceProp = SpringUtils.getBean(ICompanyservicePropService.class);
CompanyserviceProp secretIdProp = companyserviceProp.selectPropByKey(companyservice.getCompanyid(), "elephant_invoice_file_dc");
if (secretIdProp != null) {
invoice.setInvoicePdfUrl(secretIdProp.getValue() + fileId);
}
}
// end
@ -1294,10 +1304,6 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
*/
@Override
public HXResponse uploadRedInfo(Redinfo redinfo, Companyservice companyservice) {
// TODO: 2023/10/23 一步的红字上传接口
// 处理redinfo
redinfo.setCompanyId(companyservice.getCompanyid());
redinfo.setSystemOrderno(IdUtils.randomSystemOrderno());

@ -145,9 +145,9 @@ public class BillDetailFormatUtil {
Integer fphxz = billDetail.getFphxz();
// TODO: 2023/11/16 这里被折扣行开票有问题,开票不传taxamt的话
// 如果是被折扣行,直接返回
if (fphxz != null && fphxz == 1) {
/*if (fphxz != null && fphxz == 1) {
return AjaxResult.error(300, "明细行为被折扣行");
}
}*/
//如果税率为空,直接返回
if (billDetail.getTaxrate() == null) {
return AjaxResult.error("税率为空", billDetail);

@ -12,10 +12,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="identity" column="identity" />
<result property="tax" column="tax" />
<result property="fphm" column="fphm" />
</resultMap>
<sql id="selectInvoiceFileVo">
select id, file_id, file_name, file_content, create_time, identity, tax from invoice_file
select id, file_id, file_name, file_content, create_time, identity, tax,fphm from invoice_file
</sql>
<select id="selectInvoiceFileList" parameterType="InvoiceFile" resultMap="InvoiceFileResult">
@ -26,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fileContent != null and fileContent != ''"> and file_content = #{fileContent}</if>
<if test="identity != null and identity != ''"> and identity = #{identity}</if>
<if test="tax != null and tax != ''"> and tax = #{tax}</if>
<if test="fphm != null and fphm != ''"> and fphm = #{fphm}</if>
</where>
</select>
@ -44,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="identity != null">identity,</if>
<if test="tax != null">tax,</if>
<if test="fphm != fphm">fphm,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -53,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="identity != null">#{identity},</if>
<if test="tax != null">#{tax},</if>
<if test="fphm != null">#{fphm},</if>
</trim>
</insert>
@ -65,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="identity != null">identity = #{identity},</if>
<if test="tax != null">tax = #{tax},</if>
<if test="fphm != null">fphm = #{fphm},</if>
</trim>
where id = #{id}
</update>

@ -88,6 +88,9 @@ public interface IServiceManageService {
*/
public AjaxResult companyConsume(String serviceKey, Long companyid);
/** 对指定服务进行消费减n */
public AjaxResult companyConsume(String serviceKey, Long companyid,int num);
/**
* 获得入口请求适配器
*

@ -151,6 +151,14 @@ public class ServiceManageServiceImpl implements IServiceManageService {
setCache(config);
}
/** 剩余次数减n */
private void subNumSurplus(ServiceManage config,int num ) {
config.setSurplus(config.getSurplus() - num);
// 更新记录
serviceManageMapper.updateSurplus(config);
setCache(config);
}
/**
* 清空缓存
*/
@ -249,6 +257,53 @@ public class ServiceManageServiceImpl implements IServiceManageService {
}
/** 扣费,根据传入的次数决定扣几次 */
@Override
public AjaxResult companyConsume(String serviceKey, Long companyid,int num) {
ServiceManage serviceManage = selectServiceManageByCompanyIdAndServiceKey(serviceKey, companyid);
if (serviceManage == null) {
throw new JianshuiNoServiceException("此销方未配置应用服务", serviceKey, companyid);
}
// 处理扣费逻辑
// 如果过期时间不为Null
Date expireTime = serviceManage.getExpireTime();
Date now = DateUtils.getNowDate();
// 如果过期了
if (expireTime != null) {
if (expireTime.getTime() < now.getTime()) {
throw new JianshuiServiceExpireException("服务已过期", serviceKey, companyid);
}
}
// 免费
if (StringUtils.equals("0", serviceManage.getServiceMode())) {
// 调用次数 -n
subNumSurplus(serviceManage,num);
return AjaxResult.success("消费成功");
}
// 预付费
if (StringUtils.equals("1", serviceManage.getServiceMode())) {
// 调用次数 -n
if (serviceManage.getSurplus() <= 0) {
throw new JianshuiServiceNoSurplusException("服务次数不足", serviceKey, companyid);
}
subNumSurplus(serviceManage,num);
return AjaxResult.success("消费成功");
}
// 定期结算
if (StringUtils.equals("2", serviceManage.getServiceMode())) {
subNumSurplus(serviceManage,num);
return AjaxResult.success("消费成功");
}
return AjaxResult.error("未知的消费模式");
}
/**
* 获得入口请求适配器
*

@ -8,3 +8,12 @@ export function getFilePreview(data) {
data: data
})
}
// 下载文件
export function downloadFile(data) {
return request({
url: '/invoice/QuerySdInvoiceFileDownload',
method: 'post',
data: data
})
}

@ -5,9 +5,9 @@
<div class="center-container">
<!-- 下载PDF按钮 -->
<div style="float:left;">
<el-button type="primary" @click="downloadPDF" class="download-button">下载PDF</el-button>
<el-button type="primary" @click="downloadPDF" class="download-button">下载OFD</el-button>
<el-button type="primary" @click="downloadPDF" class="download-button">下载XML</el-button>
<el-button type="primary" @click="download('pdf')" class="download-button">下载PDF</el-button>
<el-button type="primary" @click="download('ofd')" class="download-button">下载OFD</el-button>
<el-button type="primary" @click="download('xml')" class="download-button">下载XML</el-button>
</div>
<img :src="invoiceImageUrl" alt="发票图片损坏" class="invoice-image">
@ -17,13 +17,14 @@
</template>
<script>
import {getFilePreview} from "@/api/sdInvoicefile/sdinvoicefile";
import {getFilePreview,downloadFile} from "@/api/sdInvoicefile/sdinvoicefile";
export default {
data() {
return {
// base64
invoiceImageUrl: ''
invoiceImageUrl: '',
id: ''
};
},
mounted() {
@ -33,19 +34,28 @@ export default {
},
methods: {
filePreview(id){
this.id = id;
this.loading = true;
getFilePreview(id).then(response => {
console.info("aa="+response);
// console.info("id="+response);
this.invoiceImageUrl = response;
// this.$forceUpdate();
});
},
// PDF
downloadPDF() {
// PDF
// 使PDF
// window.open('your_pdf_download_link.pdf', '_blank');
download(ty) {
const param = {
"ty": ty,
"id": this.id
}
console.info("param=" + param)
downloadFile(param).then(
response =>{
console.info("请求结束");
}
);
},
},
};