소스 검색

调用计费系统开票接口(未完成)

lzm 3 년 전
부모
커밋
a3f917378f
20개의 변경된 파일1253개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 0
      sp-admin/sa-view/tb-invoice-info/tb-invoice-info-list.html
  2. 222 0
      sp-server/src/main/java/com/pj/api/invoice/CallDomo.java
  3. 28 0
      sp-server/src/main/java/com/pj/api/invoice/bo/InvoiceApply.java
  4. 100 0
      sp-server/src/main/java/com/pj/api/invoice/bo/InvoiceApplySub.java
  5. 67 0
      sp-server/src/main/java/com/pj/api/invoice/bo/InvoiceApplySubDetail.java
  6. 20 0
      sp-server/src/main/java/com/pj/api/invoice/demo.java
  7. 133 0
      sp-server/src/main/java/com/pj/api/invoice/service/InvoiceApplyService.java
  8. 181 0
      sp-server/src/main/java/com/pj/api/invoice/utils/InvoiceUtils.java
  9. 7 0
      sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java
  10. 66 0
      sp-server/src/main/java/com/pj/project/tb_invoice_details/TbInvoiceDetails.java
  11. 114 0
      sp-server/src/main/java/com/pj/project/tb_invoice_details/TbInvoiceDetailsController.java
  12. 56 0
      sp-server/src/main/java/com/pj/project/tb_invoice_details/TbInvoiceDetailsMapper.java
  13. 80 0
      sp-server/src/main/java/com/pj/project/tb_invoice_details/TbInvoiceDetailsMapper.xml
  14. 129 0
      sp-server/src/main/java/com/pj/project/tb_invoice_details/TbInvoiceDetailsService.java
  15. 26 0
      sp-server/src/main/java/com/pj/project/tb_invoice_details/tesss.java
  16. 1 0
      sp-server/src/main/java/com/pj/project/tb_invoice_info/TbInvoiceInfo.java
  17. 5 0
      sp-server/src/main/java/com/pj/project/tb_invoice_order/TbInvoiceOrder.java
  18. 12 0
      sp-server/src/main/java/com/pj/project/tb_invoice_order/TbInvoiceOrderService.java
  19. 1 1
      sp-server/src/main/java/com/pj/project/wx_send_msg/WxMsgTask.java
  20. 1 1
      sp-server/src/main/resources/application-dev.yml

+ 4 - 0
sp-admin/sa-view/tb-invoice-info/tb-invoice-info-list.html

@@ -70,6 +70,7 @@
 <!--					<sa-td name="邮箱" prop="email" ></sa-td>-->
 					<el-table-column label="操作"  width="240px">
 						<template slot-scope="s">
+							<el-button v-if="s.row.status==0 && currentCustomerId==1" class="c-btn" type="primary"  @click="onlineFn(s.row.id)">线上开票</el-button>
 							<el-button v-if="s.row.status==0 && currentCustomerId==1" class="c-btn" type="primary"  @click="completeFn(s.row.id)">完成开票</el-button>
 							<el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
 							<el-button v-if="s.row.status==0" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
@@ -141,6 +142,9 @@
 					},
 				},
 				methods: {
+					onlineFn(id){
+						sa.showIframe('线上开票', 'online-invioce.html?id=' + id, '800px', '75%');
+					},
 					completeFn(id){
 						this.completeDate.visible = true;
 						this.completeDate.form.id = id;

+ 222 - 0
sp-server/src/main/java/com/pj/api/invoice/CallDomo.java

@@ -0,0 +1,222 @@
+package com.pj.api.invoice;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.MessageDigest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * @Description:
+ */
+public class CallDomo {
+
+    public static final String appid = "100001";
+    public static final String appsecret = "7214fefff0cf47d7950cb2fc3b5d670a";
+    public static final String requestUrl = "http://localhost:8090/api/vi/uim";
+
+    public static void main(String[] args) throws Exception {
+        Map<String, String> param = new HashMap<>();
+        param.put("action", "erpaysav");
+        param.put("appid", appid);
+        param.put("timestamp", date2StrByInt(new Date(), "yyyyMMddHHmmssFFF"));
+        param.put("transid", genTransId());
+        String sign = createSign(getSortedMap(param), appsecret);
+        param.put("sign", sign);
+        //拼装请求url
+        String url = getUrl(requestUrl, param);
+        // 请求接口对应的业务参数封装
+        JSONObject businessObj = new JSONObject();
+        String paramStr = "{" +
+                " \"appaysavx\":[" +
+                " {" +
+                " \"bnktyp\":\"CMB\"," +
+                " \"bustyp\":\"0\"," +
+                " \"ccynbr\":\"10\"," +
+                " \"cltacc\":\"000110100002\"," +
+                " \"cltnbr\":\"0003\"," +
+                " \"eptdat\":\"2021-07-04\"," +
+                " \"epttim\":\"11:01:00\"," +
+                " \"exttxOne\":\"摘要信息03\"," +
+                " \"oprmod\":\"3\"," +
+                " \"oprty\":\"202\"," +
+                " \"payson\":\"N\"," +
+                " \"paytyp\":\"2\"," +
+                " \"recnum\":1," +
+                " \"refnbp\":\"TEST20190704\"," +
+                " \"revacc\":\"8512384214654654\"," +
+                " \"revbnk\":\"招商银行科技园支行\"," +
+                " \"revcit\":\"深圳市\"," +
+                " \"revnam\":\"招商银行\"," +
+                " \"revprv\":\"广东省\"," +
+                " \"trsamt\":200," +
+                " \"trsuse\":\"摘要信息01\"" +
+                " }" +
+                " ]," +
+                " \"info\":{" +
+                " \"funName\":\"ERPAYSAV\"" +
+                " }" +
+                "}";
+        System.out.println(httppost(url, JSONObject.parseObject(paramStr)));
+    }
+
+    public static JSONObject httppost(String urlString, JSONObject obj) throws Exception {
+        PrintWriter out = null;
+        BufferedReader reader = null;
+        HttpURLConnection connection = null;
+        StringBuffer sb = new StringBuffer("");
+        if (null == obj) {
+            obj = new JSONObject();
+        }
+        try {// 创建连接
+            URL url = new URL(urlString);
+            URLConnection conn = url.openConnection();
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            conn.setRequestProperty("Accept-Charset", "utf-8");
+            conn.setRequestProperty("Content-Type", "application/json");
+            // 设置发 送数据的格式
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            out = new PrintWriter(conn.getOutputStream());
+            out.print(obj.toString());
+            out.flush();
+            reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                sb.append(line);
+            }
+            return JSONObject.parseObject(sb.toString());
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (reader != null) {
+                    reader.close();
+                }
+            } catch (IOException ex) {
+                System.out.println("调用in.close Exception, url=" + urlString + ex);
+            }
+        }
+        JSONObject jsonObj = new JSONObject();
+        jsonObj.put("code", "999");
+        jsonObj.put("msg", "请求服务(" + urlString + ")异常,请联系服务负责人");
+        return jsonObj;
+    }
+
+    /**
+     * 拼装请求URL
+     *
+     * @param basicUrl 基础url
+     * @param params   基础参数
+     * @return url
+     */
+    public static String getUrl(String basicUrl, Map<String, String> params) {
+        StringBuilder tmpUrl = new StringBuilder(basicUrl + "?");
+        for (String k : params.keySet()) {
+            tmpUrl.append(k).append("=").append(params.get(k)).append("&");
+        }
+        return tmpUrl.toString().substring(0, tmpUrl.length() - 1);
+    }
+
+    //获取随机流水号,流水号由调用方控制生成,如果使用同一流水号发//起请求视为重复调用
+    public static String genTransId() {
+        return new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + (int) ((Math.random() * 9 + 1) * 100000);
+    }
+
+    /**
+     * 生成时间戳
+     *
+     * @return
+     */
+    public static String date2StrByInt(Date time, String par) {
+        SimpleDateFormat df = new SimpleDateFormat(par);
+        String date = "";
+        try {
+            if (time != null) {
+                date = df.format(time);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return date;
+    }
+
+    /**
+     * 生成sign
+     *
+     * @return
+     */
+    public static String createSign(SortedMap<String, String> params, String key) {
+        StringBuilder sb = new StringBuilder();
+        Set<Map.Entry<String, String>> es = params.entrySet();
+        Iterator<Map.Entry<String, String>> it = es.iterator();
+        while (it.hasNext()) {
+            Map.Entry<String, String> entry = (Map.Entry<String, String>) it.next();
+            String k = (String) entry.getKey();
+            String v = (String) entry.getValue();
+            if (null != v && !"".equals(v) && !"sign".equals(k) && !"key".equals(k)) {
+                sb.append(k + "=" + v + "&");
+            }
+        }
+        sb.append("key=").append(key);
+        String sign = MD5(sb.toString()).toUpperCase();
+        return sign;
+    }
+
+    /**
+     * 获取有序map
+     *
+     * @param map
+     * @return
+     */
+    public static SortedMap<String, String> getSortedMap(Map<String, String> map) {
+        SortedMap<String, String> sortedMap = new TreeMap<>();
+        Iterator<String> it = map.keySet().iterator();
+        while (it.hasNext()) {
+            String key = (String) it.next();
+            String value = map.get(key);
+            String temp = "";
+            if (null != value) {
+                temp = value.trim();
+            }
+            sortedMap.put(key, temp);
+        }
+        return sortedMap;
+    }
+
+    /**
+     * md5常用工具类
+     *
+     * @param data
+     * @return
+     */
+    public static String MD5(String data) {
+        try {
+            MessageDigest md5 = MessageDigest.getInstance("MD5");
+            byte[] array = md5.digest(data.getBytes("UTF-8"));
+            StringBuilder sb = new StringBuilder();
+            for (byte item : array) {
+                sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
+            }
+            return sb.toString().toUpperCase();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+}

+ 28 - 0
sp-server/src/main/java/com/pj/api/invoice/bo/InvoiceApply.java

@@ -0,0 +1,28 @@
+package com.pj.api.invoice.bo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * @Auther: lzm
+ * @Date: 2022/08/09/10:37
+ * @Description:
+ */
+@Data
+@Accessors(chain = true)
+public class InvoiceApply {
+    /**时间戳*/
+    private String requestId;
+    /**对接不同系统来源 编码,用于区分不 同系统的回调接口*/
+    private String businessSystemCode;
+    /**接口业务编码*/
+    private String interfaceCode;
+
+    /**需要把data的值加 密成字符串,默认 为base64*/
+    private List<InvoiceApplySub> data;
+
+
+
+}

+ 100 - 0
sp-server/src/main/java/com/pj/api/invoice/bo/InvoiceApplySub.java

@@ -0,0 +1,100 @@
+package com.pj.api.invoice.bo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @Auther: lzm
+ */
+@Data
+@Accessors(chain = true)
+public class InvoiceApplySub {
+
+    /**单据编号*/
+    private String billNo;
+    /**支付类型*/
+    private String payType;
+    /**支付流水*/
+    private String transactionId;
+    /**组织编码*/
+    private String orgCode;
+    /**单据日期*/
+    private String billDate;
+    /**单据金额*/
+    private BigDecimal totalAmount;
+    /**自动开票*/
+    private Integer autoInvoice;
+    /**发票种类*/
+    private String invoiceType;
+    /**优先级*/
+    private String priority;
+    /**单据来源*/
+    private String billSource;
+    /**合同号*/
+    private String contractNo;
+    /**购买方名称*/
+    private String buyerName;
+    /**购买方税号*/
+    private String buyerTaxpayerId;
+    /**购买方银行和账号*/
+    private String buyerBankAndAccount;
+    /**购买方地址和电 话*/
+    private String buyerAddressAndTel;
+    /**电子发票收票手机 号*/
+    private String buyerRecipientPhone;
+    /**电子发票收票邮箱*/
+    private String buyerRecipientMail;
+    /**是 购买方性质*/
+    private Integer buyerProperty;
+    /** 销方税号*/
+    private String sellerTaxpayerId;
+    /**销方名称*/
+    private String sellerName;
+    /**销方银行和账号*/
+    private String sellerBankAndAccount;
+    /**销方地址和电话*/
+    private String sellerAddressAndTel;
+    /**含税标识*/
+    private Integer includeTaxFlag;
+    /**设备编号*/
+    private String deviceNo;
+    /**终端号码*/
+    private String terminalNo;
+    /**差额征税差额*/
+    private String deduction;
+    /**征税方式*/
+    private Integer taxationStyle;
+    /**开票人*/
+    private String drawer;
+    /**收款人*/
+    private String payee;
+    /**复核人*/
+    private String reviewer;
+    /**备注*/
+    private String remark;
+    /**自动合并*/
+    private Integer autoMerge;
+    /**匹配规则*/
+    private String pushMatchRules;
+    /**取值规则*/
+    private String fillValueRule;
+    /**主表扩展字段1*/
+    private String textField1;
+    /**主表扩展字段2*/
+    private String textField2;
+    /**主表扩展字段3*/
+    private String textField3;
+    /**主表扩展字段4*/
+    private String textField4;
+    /**主表扩展字段5*/
+    private String textField5;
+
+    /***/
+    private List<InvoiceApplySubDetail> billDetail;
+
+
+
+}

+ 67 - 0
sp-server/src/main/java/com/pj/api/invoice/bo/InvoiceApplySubDetail.java

@@ -0,0 +1,67 @@
+package com.pj.api.invoice.bo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/**
+ * Created with IntelliJ IDEA.
+ *
+ * @Auther: lzm
+ * @Date: 2022/08/09/14:25
+ * @Description:
+ */
+@Data
+@Accessors(chain = true)
+public class InvoiceApplySubDetail {
+
+    /**明细金额*/
+    private BigDecimal amount;
+    /**明细金额*/
+    private String detailId;
+    /**商品编码*/
+    private String goodsCode;
+    /**商品名称*/
+    private String goodsName;
+    /**物料分类名称*/
+    private String materialType;
+    /**行性质,0整单折 扣,2正常商品行*/
+    private Integer lineProperty;
+    /**单价【长度: (14,8)】*/
+    private BigDecimal price;
+    /**享受优惠内容*/
+    private String privilegeContent;
+    /**是否享受优惠*/
+    private String privilegeFlag;
+    /**数量*/
+    private String quantity;
+    /**税收分类编码*/
+    private String revenueCode;
+    /**规格型号*/
+    private String specification;
+    /**税率*/
+    private String taxRate;
+    /**税额*/
+    private String taxAmount;
+    /**折扣金额*/
+    private String discountAmount;
+    /**折扣率*/
+    private String discountRate;
+    /**计量单位*/
+    private String units;
+    /**明细扩展字段1*/
+    private String extraField;
+    /**明细扩展字段1*/
+    private String extraField1;
+    /**明细扩展字段2*/
+    private String extraField2;
+    /**明细扩展字段3*/
+    private String extraField3;
+    /**明细扩展字段4*/
+    private String extraField4;
+    /**明细扩展字段5*/
+    private String extraField5;
+
+
+}

+ 20 - 0
sp-server/src/main/java/com/pj/api/invoice/demo.java

@@ -0,0 +1,20 @@
+package com.pj.api.invoice;
+
+import cn.hutool.core.date.DateUtil;
+
+import java.util.Date;
+
+/**
+ * Created with IntelliJ IDEA.
+ *
+ * @Auther: lzm
+ * @Date: 2022/08/08/18:17
+ * @Description:
+ */
+public class demo {
+
+    public static void main(String[] args) {
+        System.out.println(new Date().getTime());
+    }
+
+}

+ 133 - 0
sp-server/src/main/java/com/pj/api/invoice/service/InvoiceApplyService.java

@@ -0,0 +1,133 @@
+package com.pj.api.invoice.service;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.pj.api.invoice.bo.InvoiceApply;
+import com.pj.api.invoice.bo.InvoiceApplySub;
+import com.pj.api.invoice.bo.InvoiceApplySubDetail;
+import com.pj.api.invoice.utils.InvoiceUtils;
+import com.pj.api.wx.bo.Attach;
+import com.pj.api.wx.bo.PriceBO;
+import com.pj.project.tb_fee_details.TbFeeDetails;
+import com.pj.project.tb_fee_details.TbFeeDetailsService;
+import com.pj.project.tb_invoice_details.TbInvoiceDetails;
+import com.pj.project.tb_invoice_details.TbInvoiceDetailsService;
+import com.pj.project.tb_invoice_info.TbInvoiceInfo;
+import com.pj.project.tb_invoice_info.TbInvoiceInfoService;
+import com.pj.project.tb_invoice_order.TbInvoiceOrder;
+import com.pj.project.tb_invoice_order.TbInvoiceOrderService;
+import com.pj.project.tb_order.TbOrder;
+import com.pj.project.tb_order.TbOrderService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.*;
+
+
+/**
+ * Created with IntelliJ IDEA.
+ *
+ * @Auther: lzm
+ * @Date: 2022/08/09/14:51
+ * @Description:
+ */
+@Service
+@Transactional
+@Slf4j
+public class InvoiceApplyService {
+
+    @Resource
+    TbInvoiceInfoService tbInvoiceInfoService;
+    @Resource
+    TbInvoiceOrderService tbInvoiceOrderService;
+    @Resource
+    TbFeeDetailsService tbFeeDetailsService;
+    @Resource
+    TbOrderService tbOrderService;
+
+    public static final String appid = "5644763 ";
+    public static final String appsecret = "F382196D16B98BC6F4A461Ced7505953";
+    public static final String applyUrl = "http://117.141.148.233:8765/monolithic/uni/invoice/invoiceBillPush";
+    public static final String applyAction = "billPus";
+    public static final String businessTaxRateCode = "3040408000000000000";
+    public static final String carTaxRateCode = "3040502020200000000";
+
+    public void preApply(TbInvoiceDetails invoiceDetail) throws Exception{
+        Date now = new Date();
+        Map<String, String> param = new HashMap<>();
+        param.put("action",applyAction);
+        param.put("appid", appid);
+        param.put("timestamp", InvoiceUtils.date2StrByInt(now, "yyyyMMddHHmmssFFF"));
+        param.put("transid", InvoiceUtils.genTransId());
+        String sign = InvoiceUtils.createSign(InvoiceUtils.getSortedMap(param), appsecret);
+        param.put("sign", sign);
+        //拼装请求url
+        String url = InvoiceUtils.getUrl(applyUrl, param);
+
+        TbInvoiceInfo info = tbInvoiceInfoService.getById(invoiceDetail.getInfoId());
+        List<TbInvoiceOrder> orders = tbInvoiceOrderService.findByDetailId(invoiceDetail.getId());
+
+        //开始组装接口参数
+        InvoiceApply invoiceApply = new InvoiceApply();
+        invoiceApply.setRequestId(now.getTime()+"")
+                .setBusinessSystemCode("ali_test")
+                .setInterfaceCode("BILL.PUSH");
+        List<InvoiceApplySub> applys = new ArrayList<>();
+        for (TbInvoiceOrder order : orders) {
+            InvoiceApplySub apply = new InvoiceApplySub();
+            apply.setBillNo(order.getId()).setPayType("微信支付").setTransactionId(order.getTransactionId())
+                    .setBillDate(DateUtil.format(now, "yyyy-MM-dd"))
+                    .setTotalAmount(order.getBillMoney())
+                    .setAutoInvoice(1).setAutoMerge(1)
+                    .setInvoiceType("007")
+                    .setBuyerName(info.getEntityName()).setBuyerTaxpayerId(info.getTaxIdNo())
+                    .setBuyerRecipientMail(info.getEmail())
+                    .setBuyerProperty(0)
+                    .setSellerTaxpayerId("91450103MA5NA8UF74")
+                    .setIncludeTaxFlag(1)
+                    .setTaxationStyle(0)
+                    .setDrawer("开票人");
+            List<InvoiceApplySubDetail> applyDetails = new ArrayList<>();
+            List<TbFeeDetails> feeDetails = tbFeeDetailsService.findBusinessFeeByTransactionId(order.getTransactionId());
+            for (TbFeeDetails feeDetail : feeDetails) {
+                InvoiceApplySubDetail applyDetail = new InvoiceApplySubDetail();
+                applyDetail.setAmount(feeDetail.getItemPrice())
+                .setDetailId(feeDetail.getId())
+                .setGoodsName(feeDetail.getItemTypeName())
+                .setLineProperty(2)
+                .setPrice(feeDetail.getUnitPrice())
+                .setTaxRate(feeDetail.getTaxRate().toString())
+                .setRevenueCode(businessTaxRateCode);
+                applyDetails.add(applyDetail);
+            }
+            TbOrder tbOrder = tbOrderService.findByTransactionId(order.getTransactionId());
+            String attachStr = tbOrder.getAttach();
+            Attach attach = JSONUtil.toBean(attachStr, Attach.class);
+            List<PriceBO> cars = JSONUtil.toList(attach.getC(), PriceBO.class);
+            BigDecimal carAmount = new BigDecimal(0);
+            if(cars.size()>0){
+                for (PriceBO car : cars) {
+                    carAmount = carAmount.add(car.getP());
+                }
+            }
+            InvoiceApplySubDetail carApplyDetail = new InvoiceApplySubDetail();
+            carApplyDetail.setAmount(carAmount).setGoodsName("停车费")
+                    .setTaxRate("0.09").setLineProperty(2).setRevenueCode(carTaxRateCode);
+            applyDetails.add(carApplyDetail);
+            apply.setBillDetail(applyDetails);
+            applys.add(apply);
+        }
+        invoiceApply.setData(applys);
+        String paramStr = JSONUtil.toJsonStr(invoiceApply);
+        log.info("invoice apply paramStr:" + paramStr);
+//        JSONObject result = InvoiceUtils.httppost(url, JSONObject.parseObject(paramStr));
+        String result = HttpUtil.createPost(url).header("Content-Type", "application/json").body(paramStr).execute().body();
+        log.info("invoice apply result:" + result);
+    }
+
+}

+ 181 - 0
sp-server/src/main/java/com/pj/api/invoice/utils/InvoiceUtils.java

@@ -0,0 +1,181 @@
+package com.pj.api.invoice.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.MessageDigest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * Created with IntelliJ IDEA.
+ *
+ * @Auther: lzm
+ * @Date: 2022/08/09/16:04
+ * @Description:
+ */
+@Component
+@Slf4j
+public class InvoiceUtils {
+
+    /**
+     * 生成时间戳
+     *
+     * @return
+     */
+    public static String date2StrByInt(Date time, String par) {
+        SimpleDateFormat df = new SimpleDateFormat(par);
+        String date = "";
+        try {
+            if (time != null) {
+                date = df.format(time);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return date;
+    }
+
+    //获取随机流水号,流水号由调用方控制生成,如果使用同一流水号发//起请求视为重复调用
+    public static String genTransId() {
+        return new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + (int) ((Math.random() * 9 + 1) * 100000);
+    }
+
+    /**
+     * 生成sign
+     *
+     * @return
+     */
+    public static String createSign(SortedMap<String, String> params, String key) {
+        StringBuilder sb = new StringBuilder();
+        Set<Map.Entry<String, String>> es = params.entrySet();
+        Iterator<Map.Entry<String, String>> it = es.iterator();
+        while (it.hasNext()) {
+            Map.Entry<String, String> entry = (Map.Entry<String, String>) it.next();
+            String k = (String) entry.getKey();
+            String v = (String) entry.getValue();
+            if (null != v && !"".equals(v) && !"sign".equals(k) && !"key".equals(k)) {
+                sb.append(k + "=" + v + "&");
+            }
+        }
+        sb.append("key=").append(key);
+        String sign = MD5(sb.toString()).toUpperCase();
+        return sign;
+    }
+
+    /**
+     * md5常用工具类
+     *
+     * @param data
+     * @return
+     */
+    public static String MD5(String data) {
+        try {
+            MessageDigest md5 = MessageDigest.getInstance("MD5");
+            byte[] array = md5.digest(data.getBytes("UTF-8"));
+            StringBuilder sb = new StringBuilder();
+            for (byte item : array) {
+                sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
+            }
+            return sb.toString().toUpperCase();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 获取有序map
+     *
+     * @param map
+     * @return
+     */
+    public static SortedMap<String, String> getSortedMap(Map<String, String> map) {
+        SortedMap<String, String> sortedMap = new TreeMap<>();
+        Iterator<String> it = map.keySet().iterator();
+        while (it.hasNext()) {
+            String key = (String) it.next();
+            String value = map.get(key);
+            String temp = "";
+            if (null != value) {
+                temp = value.trim();
+            }
+            sortedMap.put(key, temp);
+        }
+        return sortedMap;
+    }
+
+    /**
+     * 拼装请求URL
+     *
+     * @param basicUrl 基础url
+     * @param params   基础参数
+     * @return url
+     */
+    public static String getUrl(String basicUrl, Map<String, String> params) {
+        StringBuilder tmpUrl = new StringBuilder(basicUrl + "?");
+        for (String k : params.keySet()) {
+            tmpUrl.append(k).append("=").append(params.get(k)).append("&");
+        }
+        return tmpUrl.toString().substring(0, tmpUrl.length() - 1);
+    }
+
+    public static JSONObject httppost(String urlString, JSONObject obj) throws Exception {
+        PrintWriter out = null;
+        BufferedReader reader = null;
+        HttpURLConnection connection = null;
+        StringBuffer sb = new StringBuffer("");
+        if (null == obj) {
+            obj = new JSONObject();
+        }
+        try {// 创建连接
+            URL url = new URL(urlString);
+            URLConnection conn = url.openConnection();
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            conn.setRequestProperty("Accept-Charset", "utf-8");
+            conn.setRequestProperty("Content-Type", "application/json");
+            // 设置发 送数据的格式
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            out = new PrintWriter(conn.getOutputStream());
+            out.print(obj.toString());
+            out.flush();
+            reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                sb.append(line);
+            }
+            return JSONObject.parseObject(sb.toString());
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (reader != null) {
+                    reader.close();
+                }
+            } catch (IOException ex) {
+                System.out.println("调用in.close Exception, url=" + urlString + ex);
+    }
+}
+        JSONObject jsonObj = new JSONObject();
+        jsonObj.put("code", "999");
+        jsonObj.put("msg", "请求服务(" + urlString + ")异常,请联系服务负责人");
+        return jsonObj;
+    }
+
+}

+ 7 - 0
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java

@@ -182,6 +182,13 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         return list(qw);
     }
 
+    public List<TbFeeDetails> findBusinessFeeByTransactionId(String transactionId){
+        QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
+        qw.ne("fee_type", TbFeeDetails.fee.PARK_FEE)
+                .like("transaction_id", transactionId);
+        return list(qw);
+    }
+
 
     public void chargeParkFee(List<PriceBO> cars, String transactionId, String outTradeNo, Date now) {
         log.info("进入计算停车费:{}", JSONUtil.toJsonStr(cars));

+ 66 - 0
sp-server/src/main/java/com/pj/project/tb_invoice_details/TbInvoiceDetails.java

@@ -0,0 +1,66 @@
+package com.pj.project.tb_invoice_details;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_invoice_details -- 开票详情表
+ * @author lzm 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbInvoiceDetails.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbInvoiceDetails implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_invoice_details";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-invoice-details-list";
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 主键 
+	 */
+	private String id;
+
+    private String no;
+
+	/**
+	 * 开票信息id 
+	 */
+    private String infoId;
+
+	/**
+	 * 账单金额 
+	 */
+    private BigDecimal money;
+
+	/**
+	 * 主体名称 
+	 */
+    private String entityName;
+
+
+
+
+
+	
+
+
+}

+ 114 - 0
sp-server/src/main/java/com/pj/project/tb_invoice_details/TbInvoiceDetailsController.java

@@ -0,0 +1,114 @@
+package com.pj.project.tb_invoice_details;
+
+import java.util.List;
+
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import com.pj.utils.sg.*;
+import com.pj.project4sp.SP;
+
+import com.pj.current.satoken.StpUserUtil;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+
+
+/**
+ * Controller: tb_invoice_details -- 开票详情表
+ * @author lzm 
+ */
+@RestController
+@RequestMapping("/TbInvoiceDetails/")
+public class TbInvoiceDetailsController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbInvoiceDetailsService tbInvoiceDetailsService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@Transactional(rollbackFor = Exception.class)
+	public AjaxJson add(TbInvoiceDetails t){
+		tbInvoiceDetailsService.add(t);
+		t = tbInvoiceDetailsService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	public AjaxJson delete(Long id){
+		int line = tbInvoiceDetailsService.delete(id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
+		int line = SP.publicMapper.deleteByIds(TbInvoiceDetails.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	public AjaxJson update(TbInvoiceDetails t){
+		int line = tbInvoiceDetailsService.update(t);
+		return AjaxJson.getByLine(line);
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+	public AjaxJson getById(Long id){
+		TbInvoiceDetails t = tbInvoiceDetailsService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
+		List<TbInvoiceDetails> list = tbInvoiceDetailsService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+
+    @RequestMapping("onlineInvoice")
+    public AjaxJson onlineInvoice(String infoId) {
+        List<TbInvoiceDetails> list = tbInvoiceDetailsService.findByInfoId(infoId);
+        if(list.size() == 0){
+            tbInvoiceDetailsService.addInvioceDetails(infoId);
+            list = tbInvoiceDetailsService.findByInfoId(infoId);
+        }
+        return AjaxJson.getSuccessData(list);
+    }
+
+    @RequestMapping("applyInvoice")
+    public AjaxJson applyInvoice(String infoId) throws Exception{
+        tbInvoiceDetailsService.applyInvoice(infoId);
+	    return AjaxJson.getSuccess();
+    }
+	
+	// ------------------------- 前端接口 -------------------------
+	
+	
+	/** 改 - 不传不改 [G] */
+	@RequestMapping("updateByNotNull")
+	public AjaxJson updateByNotNull(Long id){
+		AjaxError.throwBy(true, "如需正常调用此接口,请删除此行代码");
+		// 鉴别身份,是否为数据创建者 
+		long userId = SP.publicMapper.getColumnByIdToLong(TbInvoiceDetails.TABLE_NAME, "user_id", id);
+		AjaxError.throwBy(userId != StpUserUtil.getLoginIdAsLong(), "此数据您无权限修改");
+		// 开始修改 (请只保留需要修改的字段)
+		SoMap so = SoMap.getRequestSoMap();
+		so.clearNotIn("id", "infoId", "money", "entityName").clearNull().humpToLineCase();	
+		int line = SP.publicMapper.updateBySoMapById(TbInvoiceDetails.TABLE_NAME, so, id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	
+	
+	
+	
+	
+
+}

+ 56 - 0
sp-server/src/main/java/com/pj/project/tb_invoice_details/TbInvoiceDetailsMapper.java

@@ -0,0 +1,56 @@
+package com.pj.project.tb_invoice_details;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import com.pj.utils.so.*;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Mapper: tb_invoice_details -- 开票详情表
+ * @author lzm 
+ */
+
+@Mapper
+@Repository
+public interface TbInvoiceDetailsMapper extends BaseMapper<TbInvoiceDetails> {
+
+	/**
+	 * 增  
+	 * @param t 实体对象 
+	 * @return 受影响行数 
+	 */
+	int add(TbInvoiceDetails t);
+
+	/**
+	 * 删  
+	 * @param id 要删除的数据id  
+	 * @return 受影响行数 
+	 */
+	int delete(Long id);	 
+
+	/** 
+	 * 改  
+	 * @param t 实体对象 
+	 * @return 受影响行数 
+	 */
+	int update(TbInvoiceDetails t);
+
+	/** 
+	 * 查 - 根据id  
+	 * @param id 要查询的数据id 
+	 * @return 实体对象 
+	 */
+	TbInvoiceDetails getById(Long id);	 
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbInvoiceDetails> getList(SoMap so);
+
+
+}

+ 80 - 0
sp-server/src/main/java/com/pj/project/tb_invoice_details/TbInvoiceDetailsMapper.xml

@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.pj.project.tb_invoice_details.TbInvoiceDetailsMapper">
+
+	<!-- 增 [G] -->
+	<insert id="add">
+		insert into 
+		tb_invoice_details (id, info_id, money, entity_name) 
+		values (#{id}, #{infoId}, #{money}, #{entityName}) 
+	</insert>
+
+	<!-- 删 -->
+	<delete id="delete">
+		delete from tb_invoice_details 
+		where id = #{id}
+	</delete>
+
+	<!-- 改 [G] -->
+	<update id="update">
+		update tb_invoice_details set
+		id = #{id}, 
+		info_id = #{infoId}, 
+		money = #{money}, 
+		entity_name = #{entityName}
+		where id = #{id}
+	</update>
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, info_id, money, entity_name from tb_invoice_details  -->
+	
+	<!-- 通用映射:手动模式 -->
+	<resultMap id="model" type="com.pj.project.tb_invoice_details.TbInvoiceDetails">
+		<result property="id" column="id" />
+		<result property="infoId" column="info_id" />
+		<result property="money" column="money" />
+		<result property="entityName" column="entity_name" />
+	</resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from tb_invoice_details 
+	</sql>
+	
+	<!-- 查 - 根据id -->
+	<select id="getById" resultMap="model">
+		<include refid="select_sql"></include>
+		where id = #{id}
+	</select>
+	
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+	<select id="getList" resultMap="model">
+		<include refid="select_sql"></include>
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("infoId") '> and info_id = #{infoId} </if>
+			<if test=' this.has("money") '> and money = #{money} </if>
+			<if test=' this.has("entityName") '> and entity_name = #{entityName} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> info_id desc </when>
+			<when test='sortType == 3'> money desc </when>
+			<when test='sortType == 4'> entity_name desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 129 - 0
sp-server/src/main/java/com/pj/project/tb_invoice_details/TbInvoiceDetailsService.java

@@ -0,0 +1,129 @@
+package com.pj.project.tb_invoice_details;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.lang.Snowflake;
+import cn.hutool.core.util.IdUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.pj.api.invoice.service.InvoiceApplyService;
+import com.pj.project.tb_invoice_info.TbInvoiceInfo;
+import com.pj.project.tb_invoice_info.TbInvoiceInfoService;
+import com.pj.project.tb_invoice_order.TbInvoiceOrder;
+import com.pj.project.tb_invoice_order.TbInvoiceOrderService;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.pj.utils.sg.*;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+/**
+ * Service: tb_invoice_details -- 开票详情表
+ * @author lzm 
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class TbInvoiceDetailsService extends ServiceImpl<TbInvoiceDetailsMapper, TbInvoiceDetails> implements IService<TbInvoiceDetails> {
+
+	/** 底层 Mapper 对象 */
+	@Resource
+	TbInvoiceDetailsMapper tbInvoiceDetailsMapper;
+    @Resource
+    TbInvoiceInfoService tbInvoiceInfoService;
+    @Resource
+    TbInvoiceOrderService tbInvoiceOrderService;
+    @Resource
+    InvoiceApplyService invoiceApplyService;
+
+    private static final BigDecimal max_invoice_money = new BigDecimal(9999);
+
+	/** 增 */
+	int add(TbInvoiceDetails t){
+		return tbInvoiceDetailsMapper.add(t);
+	}
+
+	/** 删 */
+	int delete(Long id){
+		return tbInvoiceDetailsMapper.delete(id);
+	}
+
+	/** 改 */
+	int update(TbInvoiceDetails t){
+		return tbInvoiceDetailsMapper.update(t);
+	}
+
+	/** 查 */
+	TbInvoiceDetails getById(Long id){
+		return tbInvoiceDetailsMapper.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	List<TbInvoiceDetails> getList(SoMap so) {
+		return tbInvoiceDetailsMapper.getList(so);	
+	}
+
+    public List<TbInvoiceDetails> findByInfoId(String infoId) {
+        QueryWrapper<TbInvoiceDetails> ew = new QueryWrapper<>();
+        ew.eq("info_id", infoId);
+        return list(ew);
+    }
+
+    /** 根据开票信息创建开票信息明细,按开票最大金额9999元限制 拆分为多个开票信息明细 */
+    public void  addInvioceDetails(String infoId){
+        TbInvoiceInfo info = tbInvoiceInfoService.getById(infoId);
+
+        List<TbInvoiceOrder> orders = tbInvoiceOrderService.findByInfoId2(infoId);
+        Map<String, List<TbInvoiceOrder>> noMap = new LinkedHashMap<>();
+        List<TbInvoiceOrder> orderTempList = new ArrayList<>();
+        BigDecimal tempTotalMoney = new BigDecimal(0);
+        for (TbInvoiceOrder order : orders) {
+            tempTotalMoney = tempTotalMoney.add(order.getBillMoney());
+            if(tempTotalMoney.compareTo(max_invoice_money) <= 0){
+                //只要不达到9999,就把当前order加入orderTempList,作为同一张发票
+                orderTempList.add(order);
+            }else{
+                //只要达到9999,储存就把当前order加入orderTempList到map中,清空orderTempList,相当于另起一张发票
+                String no = DateUtil.format(new Date(), "yyyyMMddHHmmss") +  (int) ((Math.random() * 9 + 1) * 100000);
+                List<TbInvoiceOrder> invoiceDetails = new ArrayList<>();
+                invoiceDetails.addAll(orderTempList);
+                noMap.put(no, invoiceDetails);
+                orderTempList.clear();
+                tempTotalMoney = order.getBillMoney();
+                orderTempList.add(order);
+            }
+        }
+        String no = DateUtil.format(new Date(), "yyyyMMddHHmmss") +  (int) ((Math.random() * 9 + 1) * 100000);
+        noMap.put(no, orderTempList);
+        for (String key : noMap.keySet()) {
+            List<TbInvoiceOrder> thisOrders = noMap.get(key);
+            BigDecimal money = new BigDecimal(0);
+            for (TbInvoiceOrder order : thisOrders) {
+                money = money.add(order.getBillMoney());
+            }
+            TbInvoiceDetails invoiceDetail = new TbInvoiceDetails();
+            invoiceDetail.setNo(key).setEntityName(info.getEntityName()).setInfoId(infoId).setMoney(money);
+            this.save(invoiceDetail);
+            for (TbInvoiceOrder order : thisOrders) {
+                order.setDetailId(invoiceDetail.getId());
+            }
+            tbInvoiceOrderService.updateBatchById(thisOrders);
+        }
+        tbInvoiceInfoService.updateById(info);
+
+    }
+
+
+    public void applyInvoice(String infoId) throws Exception{
+        List<TbInvoiceDetails> list = this.findByInfoId(infoId);
+        for (TbInvoiceDetails invoiceDetail : list) {
+            invoiceApplyService.preApply(invoiceDetail);
+        }
+
+    }
+}

+ 26 - 0
sp-server/src/main/java/com/pj/project/tb_invoice_details/tesss.java

@@ -0,0 +1,26 @@
+package com.pj.project.tb_invoice_details;
+
+import cn.hutool.core.date.DateUtil;
+
+import java.util.Date;
+
+/**
+ * Created with IntelliJ IDEA.
+ *
+ * @Auther: lzm
+ * @Date: 2022/08/08/15:33
+ * @Description:
+ */
+public class tesss {
+
+    public static void main(String[] args) {
+        String date = DateUtil.format(new Date(), "yyyyMMddHHmmss");
+        System.out.println(date);
+        int ran = (int) ((Math.random() * 9 + 1) * 100000);
+        System.out.println( ran);
+        String no = date +  ran;
+        System.out.println(no);
+
+    }
+
+}

+ 1 - 0
sp-server/src/main/java/com/pj/project/tb_invoice_info/TbInvoiceInfo.java

@@ -130,6 +130,7 @@ public class TbInvoiceInfo implements Serializable {
      */
     private String email;
 
+
     @TableField(exist = false)
     private List<TbFeeDetails> feeDetails = new ArrayList<>();
 

+ 5 - 0
sp-server/src/main/java/com/pj/project/tb_invoice_order/TbInvoiceOrder.java

@@ -104,6 +104,11 @@ public class TbInvoiceOrder implements Serializable {
      */
     public String infoNo;
 
+    /**
+     * 开票信息明细Id
+     */
+    public String detailId;
+
 
 
 

+ 12 - 0
sp-server/src/main/java/com/pj/project/tb_invoice_order/TbInvoiceOrderService.java

@@ -195,6 +195,11 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
         ew.eq("info_id", infoId);
         return list(ew);
     }
+    public List<TbInvoiceOrder> findByInfoId2(String infoId) {
+        QueryWrapper<TbInvoiceOrder> ew = new QueryWrapper<>();
+        ew.eq("info_id", infoId).orderByDesc("create_time");
+        return list(ew);
+    }
 
     private String orcImage(String billImageUrl){
         String separator = File.separator;
@@ -245,4 +250,11 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
         return detailsList;
     }
 
+    /**根据InvoiceDetail的id*/
+    public List<TbInvoiceOrder> findByDetailId(String detailId) {
+        QueryWrapper<TbInvoiceOrder> ew = new QueryWrapper<>();
+        ew.eq("detail_id", detailId);
+        return list(ew);
+    }
+
 }

+ 1 - 1
sp-server/src/main/java/com/pj/project/wx_send_msg/WxMsgTask.java

@@ -21,7 +21,7 @@ public class WxMsgTask {
     /**
      * 3分钟执行一次
      */
-    @Scheduled(fixedRate = 180000)
+    //@Scheduled(fixedRate = 180000)
     public void check() {
         List<WxSendMsg> list = wxSendMsgService.list();
         list.forEach(wxSendMsg -> {

+ 1 - 1
sp-server/src/main/resources/application-dev.yml

@@ -6,7 +6,7 @@ spring:
     # 数据源配置
     datasource:
         type: com.alibaba.druid.pool.DruidDataSource
-        url: jdbc:mysql://127.0.0.1:3306/pco0726?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://127.0.0.1:3307/pco0726?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
         username: root
         password: 1234
         # 是否打开sql监控台  (生产环境请务必关闭此选项)