Prechádzať zdrojové kódy

无车优化,自有车接口返回

Administrator 3 rokov pred
rodič
commit
68615d711b

+ 1 - 8
src/main/java/com/jkcredit/invoice/credit/InterfaceCheckServer.java

@@ -223,14 +223,7 @@ public class InterfaceCheckServer {
                 }
                 break;
             case "WAY_BILL_NUM_FIND_INVOICE"://无车  运单号查询发票数据
-                if(StatisRequestIdTimeComp.isLimit){
-                    log.info("InterfaceCheckServer.doJumpHandler,appKey=" + appKey + " ,api="+api + " ,data=" + data + " ,requestid=" + requestid +"=被拒绝");
-                    result = resultTimeOut;
-                }else{
-                    statisRequestIdTimeComp.putReQuestIdAndTime(requestid);
-                    result = noCarInterService.noCarVoiceQuery(appKey,api,data,requestid);
-                    statisRequestIdTimeComp.removeReQuestIdAndTime(requestid);
-                }
+                result = noCarInterService.noCarVoiceQuery(appKey,api,data,requestid);
                 break;
             case "FIND_NO_SEARCH_NUM"://无车  获取未查询过发票的运单编号
                 if(StatisRequestIdTimeComp.isLimit){

+ 5 - 3
src/main/java/com/jkcredit/invoice/credit/custInterface/NoCarInterServiceImpl.java

@@ -24,6 +24,8 @@ import net.sf.json.JSONArray;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
@@ -230,7 +232,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
      * @return
      */
     @Override
-    @Transactional
+    @Transactional(isolation= Isolation.READ_COMMITTED)
     public DataResult noCarBillStart(String appKey, String api, String data,String requestid) {
 
         long costtimestart = System.currentTimeMillis();
@@ -456,7 +458,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
      * @return
      */
     @Override
-    @Transactional
+    @Transactional(isolation= Isolation.READ_COMMITTED)
     public DataResult noCarHisWaybillStart(String appKey, String api, String data,String requestid) {
 
         long costtimestart = System.currentTimeMillis();
@@ -722,7 +724,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                 return result;
             }
             if (null == noCarWayBill1){
-                result.setMsg("运单号异常,无法开票");
+                result.setMsg("运单号不存在,无法开票");
                 return result;
             }
             noCarWayBill1.setCustomerName(appKey);

+ 3 - 2
src/main/java/com/jkcredit/invoice/service/lowerService/impl/NoCarServiceImpl.java

@@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 
@@ -201,7 +202,7 @@ public class NoCarServiceImpl implements NoCarService{
         return respR;
     }
 
-    public synchronized void updateCustomerCarRec(CustomerCarRec customerCarRec){
+    public  void updateCustomerCarRec(CustomerCarRec customerCarRec){
         //根据车牌号查询是新增还是更新
         List<CustomerCarRec> customerCarRec1 = customerCarRecMapper.selectByCarNum(customerCarRec.getCarNum());
         if (customerCarRec1 == null || customerCarRec1.size()==0) {
@@ -476,7 +477,7 @@ public class NoCarServiceImpl implements NoCarService{
         return waybillNumFindInvoiceResponse;
     }
     @Override
-    @Transactional
+    @Transactional(isolation= Isolation.READ_COMMITTED)
     public RespR getInvoiceByWayBillNumReal(NoCarWayBill noCarWayBill, boolean isInterface) {
         log.info("取票啦:NoCarServiceImpl.getInvoiceByWayBillNumReal{},isCurr{}",noCarWayBill,isInterface);
         if(isInterface){

+ 3 - 2
src/main/java/com/jkcredit/invoice/service/lowerService/impl/SelfCarServiceLImpl.java

@@ -29,6 +29,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
@@ -59,7 +60,7 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
     @Autowired
     CustomerService customerService;
     @Override
-    @Transactional
+    @Transactional(isolation= Isolation.READ_COMMITTED)
     public RespR<List<CardTradeModel>> getTradeList(TradeRequestVo tradeRequestVo) {
         log.info("获取交易开始SelfCarServiceLImpl.getTradeList{}",tradeRequestVo);
         Customer customer = customerMapper.selectByCustomerName(tradeRequestVo.getCustomerName());
@@ -132,7 +133,7 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
     }
 
     @Override
-    @Transactional
+    @Transactional(isolation= Isolation.READ_COMMITTED)
     public RespR<String> applInvoice(InvoiceApplVo invoiceApplVo) {
         log.info("申请开票开始SelfCarServiceLImpl.applInvoice{}",invoiceApplVo);
         if(!customerService.checkMoneyEnough(invoiceApplVo.getCustomerName())){

+ 19 - 1
src/main/resources/application.yml

@@ -1,6 +1,6 @@
 
 server:
-  port: 18080
+  port: 18081
   tomcat:
     accesslog:
       enabled: true
@@ -63,6 +63,24 @@ spring:
     driver-class-name: com.mysql.jdbc.Driver
     # \u4F7F\u7528druid\u6570\u636E\u6E90
     type: com.alibaba.druid.pool.DruidDataSource
+    platform: mysql
+    druid:
+      initial-size: 10  # 初始化大小
+      min-idle: 10  # 最小
+      max-active: 100  # 最大
+      max-wait: 60000  # 配置获取连接等待超时的时间
+      time-between-eviction-runs-millis: 60000  # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      min-evictable-idle-time-millis: 300000  # 指定一个空闲连接最少空闲多久后可被清除,单位是毫秒
+      validationQuery: select 'x'
+      test-while-idle: true  # 当连接空闲时,是否执行连接测试
+      test-on-borrow: false  # 当从连接池借用连接时,是否测试该连接
+      test-on-return: false  # 在连接归还到连接池时是否测试该连接
+      filters: config,wall,stat  # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      poolPreparedStatements: true # 打开PSCache,并且指定每个连接上PSCache的大小
+      maxPoolPreparedStatementPerConnectionSize: 20
+      maxOpenPreparedStatements: 20
+          # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+      connectionProperties: druid.stat.slowSqlMillis=200;druid.stat.logSlowSql=true;config.decrypt=false
   mail:
     host: smtp.qq.com #邮件发送服务器
     port: 587