Selaa lähdekoodia

后端代码提交

mashengyi 3 vuotta sitten
vanhempi
commit
a91fec12bb

+ 13 - 0
.idea/libraries/Maven__com_sun_mail_javax_mail_1_6_2.xml

@@ -0,0 +1,13 @@
+<component name="libraryTable">
+  <library name="Maven: com.sun.mail:javax.mail:1.6.2">
+    <CLASSES>
+      <root url="jar://$MAVEN_REPOSITORY$/com/sun/mail/javax.mail/1.6.2/javax.mail-1.6.2.jar!/" />
+    </CLASSES>
+    <JAVADOC>
+      <root url="jar://$MAVEN_REPOSITORY$/com/sun/mail/javax.mail/1.6.2/javax.mail-1.6.2-javadoc.jar!/" />
+    </JAVADOC>
+    <SOURCES>
+      <root url="jar://$MAVEN_REPOSITORY$/com/sun/mail/javax.mail/1.6.2/javax.mail-1.6.2-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>

+ 13 - 0
.idea/libraries/Maven__javax_activation_activation_1_1.xml

@@ -0,0 +1,13 @@
+<component name="libraryTable">
+  <library name="Maven: javax.activation:activation:1.1">
+    <CLASSES>
+      <root url="jar://$MAVEN_REPOSITORY$/javax/activation/activation/1.1/activation-1.1.jar!/" />
+    </CLASSES>
+    <JAVADOC>
+      <root url="jar://$MAVEN_REPOSITORY$/javax/activation/activation/1.1/activation-1.1-javadoc.jar!/" />
+    </JAVADOC>
+    <SOURCES>
+      <root url="jar://$MAVEN_REPOSITORY$/javax/activation/activation/1.1/activation-1.1-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>

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

@@ -192,6 +192,8 @@ public class NoCarServiceImpl implements NoCarService{
         if(respR.getCode() == 1){
             log.info("车辆备案查询失败NoCarServiceImpl.customerCarRecQueryUpper{},msg{}",customerCarRec,respR.getMsg());
             return new RespR(false,respR.getMsg());
+        }else{
+            updateCustomerCarRec(customerCarRec);
         }
         return new RespR(respR.getData());
     }
@@ -368,6 +370,7 @@ public class NoCarServiceImpl implements NoCarService{
             log.info("运单结束失败:NoCarServiceImpl.noCarWaybillStart{},msg{}",noCarWayBill,"运单已经超时,请拆分");
             return new RespR(false,"失败,承运时长超96小时");
         }
+
         RespR respR = checkCarWayBillAndSetInfo(noCarWayBill);
         if(respR.getCode() == 1){
             log.info("历史运单开始上传失败:NoCarServiceImpl.noCarHisWaybillStart{},msg{}",noCarWayBill,respR.getMsg());

+ 81 - 34
src/main/java/com/jkcredit/invoice/service/nocar/impl/NoCarBillWayServiceImpl.java

@@ -1,5 +1,6 @@
 package com.jkcredit.invoice.service.nocar.impl;
 
+import cn.com.taiji.sdk.model.comm.protocol.tts.vehicle.VehicleQueryResponse;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -22,6 +23,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 @Slf4j
 @Service
@@ -82,47 +84,71 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                     customerRec.setCustomerName(customerName);
                     customerRec.setCompanyReferencenum(noCarWayBill.getTaxplayerCode());
                     customerRec = customerRecMapper.selectByCustomerNameAndCompanyReference(customerRec);
+                    if(customerRec == null){
+                        noCarWaybillMapperImprt.updateBillway(-2,"企业税号未备案",noCarWayBill);
+                        noCarWayBill.setFailReason("企业税号未备案");
+                        noCarWayBill.setBillwayStatus(-2);
+                        insertOrUpdateBill(noCarWayBill);
+                        stringBuffer.append("#").append(noCarWayBill.getBillNum()).append(":").append("企业税号未备案#");
+                        return;
+                    }
                     noCarWayBill.setCompanyName(customerRec.getCompanyName());
                     noCarWayBill.setCustomerName(customerName);
+                    noCarWayBill.setCompanyNum(customerRec.getCompanyNum());
                     noCarWayBill.setBatchNum(batchNumber);
                     noCarWayBill.setBillwayStatus(-2);
                     noCarWayBill.setHisFlag(0);
                     noCarWayBill.setIntfaceStartTime(DateUtil.getCurrentDateStr());
                     noCarWaybillMapperImprt.insertImport(noCarWayBill);
                     insertOrUpdateBill(noCarWayBill);
-                    if(customerRec == null){
-                        noCarWaybillMapperImprt.updateBillway(-2,"企业税号未备案",noCarWayBill);
-                        noCarWayBill.setFailReason("企业税号未备案");
+                    if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),new Date())<-72){
+                        noCarWaybillMapperImprt.updateBillway(-2,"失败,运单开始时间超72小时#",noCarWayBill);
                         noCarWayBill.setBillwayStatus(-2);
+                        noCarWayBill.setFailReason("失败,运单开始时间超72小时");
+                        insertOrUpdateBill(noCarWayBill);
+                        return;
+
+                    }
+                    if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),DateUtil.StringToDate(noCarWayBill.getPredictEndTime()))<-96){
+                        log.info("运单结束失败:NoCarServiceImpl.noCarWaybillStart{},msg{}",noCarWayBill,"运单已经超时,请拆分");
+                        noCarWaybillMapperImprt.updateBillway(-2,"失败,承运时长超96小时#",noCarWayBill);
+                        noCarWayBill.setBillwayStatus(-2);
+                        noCarWayBill.setFailReason("失败,承运时长超96小时");
                         insertOrUpdateBill(noCarWayBill);
-                        stringBuffer.append("#").append(noCarWayBill.getBillNum()).append(":").append("企业税号未备案#");
                         return;
                     }
                     //1.查询是否有车辆备案
-                    CustomerCarRec customerCarRec = customerCarRecMapper.selectByCarNum(noCarWayBill.getPlateColor());
+                    CustomerCarRec customerCarRec;
 
                     //2.无车车辆备案时进行车辆备案
-                    if(customerCarRec== null || customerCarRec.getRecStatus()!=1){
+
                         List<CustomerCarRec> customerCarRecs = new ArrayList<>();
                         customerCarRec = new CustomerCarRec();
                         customerCarRec.setCompanyName(noCarWayBill.getCompanyName());
                         customerCarRec.setCarNum(noCarWayBill.getPlateNum());
                         customerCarRec.setCarColor(noCarWayBill.getPlateColor());
                         customerCarRec.setCustomerName(customerName);
+                        customerCarRec.setInterType(1);
+                        customerCarRec.setCompanyNum(customerRec.getCompanyNum());
                         customerCarRec.setBusinessType("2");
                         customerCarRec.setServiceOperation(1);//默认运营车辆
                         noCarWayBill.setTitleType(2);
-                        customerCarRecs.add(customerCarRec);
-                        RespR respR = noCarService.customerCarRec(customerCarRecs);
-                        if(respR.getCode() ==1){
-                            stringBuffer.append("#").append(noCarWayBill.getBillNum()).append(":").append(respR.getMsg()).append("#");
-                            noCarWaybillMapperImprt.updateBillway(-2,respR.getMsg(),noCarWayBill);
-                            noCarWayBill.setBillwayStatus(-2);
-                            noCarWayBill.setFailReason(respR.getMsg());
-                            insertOrUpdateBill(noCarWayBill);
-                            return;
+                        //先查询上游是否已经备案
+                        RespR<VehicleQueryResponse> respRquery = noCarService.customerCarRecQueryUpper(customerCarRec);
+                        if(respRquery.getCode() == 1 || respRquery.getData() == null || respRquery.getData().getResult() == null || respRquery.getData().getResult().size()<=0){
+                            customerCarRecs.add(customerCarRec);
+                            RespR respR = noCarService.customerCarRec(customerCarRecs);
+                            if(respR.getCode() ==1){
+                                stringBuffer.append("#").append(noCarWayBill.getBillNum()).append(":").append(respR.getMsg()).append("#");
+                                noCarWaybillMapperImprt.updateBillway(-2,respR.getMsg(),noCarWayBill);
+                                noCarWayBill.setBillwayStatus(-2);
+                                noCarWayBill.setFailReason(respR.getMsg());
+                                insertOrUpdateBill(noCarWayBill);
+                                return;
+                            }
                         }
-                    }
+
+
 
                     //3.进行上传
                     RespR respR = noCarService.noCarWaybillStart(noCarWayBill);
@@ -162,8 +188,17 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                         customerRec.setCustomerName(customerName);
                         customerRec.setCompanyReferencenum(noCarWayBill.getTaxplayerCode());
                         customerRec = customerRecMapper.selectByCustomerNameAndCompanyReference(customerRec);
+                        if(customerRec == null || customerRec.getRecStatus()!=1){
+                            stringBuffer.append("#").append(noCarWayBill.getBillNum()).append(":").append("企业税号未备案#");
+                            noCarWaybillMapperImprt.updateBillway(-2,"企业税号未备案#",noCarWayBill);
+                            noCarWayBill.setBillwayStatus(-2);
+                            noCarWayBill.setFailReason("企业税号未备案");
+                            insertOrUpdateBill(noCarWayBill);
+                            return;
+                        }
                         noCarWayBill.setCompanyName(customerRec.getCompanyName());
                         noCarWayBill.setCustomerName(customerName);
+                        noCarWayBill.setCompanyNum(customerRec.getCompanyNum());
                         noCarWayBill.setIntfaceStartTime(DateUtil.getCurrentDateStr());
                         noCarWayBill.setBatchNum(batchNumber);
                         noCarWayBill.setTitleType(2);
@@ -171,39 +206,51 @@ public class NoCarBillWayServiceImpl extends ServiceImpl<NoCarWaybillMapper,NoCa
                         noCarWayBill.setHisFlag(1);
                         noCarWaybillMapperImprt.insertImport(noCarWayBill);
                         insertOrUpdateBill(noCarWayBill);
-                        if(customerRec == null || customerRec.getRecStatus()!=1){
-                            stringBuffer.append("#").append(noCarWayBill.getBillNum()).append(":").append("企业税号未备案#");
-                            noCarWaybillMapperImprt.updateBillway(-2,"企业税号未备案#",noCarWayBill);
+
+                        if(DateUtil.getDistanceDays(noCarWayBill.getStartTime(),new Date())>-20){
+                            log.info("历史运单开始上传失败:NoCarServiceImpl.noCarHisWaybillStart{},msg{}",noCarWayBill,"必须是二十天前的运单");
                             noCarWayBill.setBillwayStatus(-2);
-                            noCarWayBill.setFailReason("企业税号未备案");
+                            noCarWayBill.setFailReason("失败,运单未满20天时效");
+                            noCarWaybillMapperImprt.updateBillway(-2,"失败,运单未满20天时效#",noCarWayBill);
                             insertOrUpdateBill(noCarWayBill);
                             return;
                         }
-
-                        //1.查询是否有车辆备案
-                        CustomerCarRec customerCarRec = customerCarRecMapper.selectByCarNum(noCarWayBill.getPlateNum());
+                        if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),DateUtil.StringToDate(noCarWayBill.getPredictEndTime()))<-96){
+                            noCarWayBill.setBillwayStatus(-2);
+                            noCarWayBill.setFailReason("运单已经超时,请拆分");
+                            noCarWaybillMapperImprt.updateBillway(-2,"运单已经超时,请拆分#",noCarWayBill);
+                            log.info("运单结束失败:NoCarServiceImpl.noCarWaybillStart{},msg{}",noCarWayBill,"运单已经超时,请拆分");
+                            return;
+                        }
+                        //1.查询是否有车辆备案 /
+                        CustomerCarRec customerCarRec;
 
                         //2.无车车辆备案时进行车辆备案
-                        if(customerCarRec== null || customerCarRec.getRecStatus()!=1){
                             List<CustomerCarRec> customerCarRecs = new ArrayList<>();
                             customerCarRec = new CustomerCarRec();
                             customerCarRec.setCompanyName(noCarWayBill.getCompanyName());
                             customerCarRec.setCarNum(noCarWayBill.getPlateNum());
                             customerCarRec.setCarColor(noCarWayBill.getPlateColor());
+                            customerCarRec.setCompanyNum(customerRec.getCompanyNum());
                             customerCarRec.setCustomerName(customerName);
                             customerCarRec.setBusinessType("2");
                             customerCarRec.setServiceOperation(1);//默认运营车辆
-                            customerCarRecs.add(customerCarRec);
-                            RespR respR = noCarService.customerCarRec(customerCarRecs);
-                            if(respR.getCode() ==1){
-                                noCarWaybillMapperImprt.updateBillway(-2,respR.getMsg(),noCarWayBill);
-                                stringBuffer.append("#").append(noCarWayBill.getBillNum()).append(":").append(respR.getMsg()).append("#");
-                                noCarWayBill.setBillwayStatus(-2);
-                                noCarWayBill.setFailReason(respR.getMsg());
-                                insertOrUpdateBill(noCarWayBill);
-                                return;
+                            //先查询上游是否已经备案
+                            RespR<VehicleQueryResponse> respRquery = noCarService.customerCarRecQueryUpper(customerCarRec);
+                            if(respRquery.getCode() == 1 || respRquery.getData() == null || respRquery.getData().getResult() == null || respRquery.getData().getResult().size()<=0){
+                                customerCarRecs.add(customerCarRec);
+                                RespR respR = noCarService.customerCarRec(customerCarRecs);
+                                if(respR.getCode() ==1){
+                                    noCarWaybillMapperImprt.updateBillway(-2,respR.getMsg(),noCarWayBill);
+                                    stringBuffer.append("#").append(noCarWayBill.getBillNum()).append(":").append(respR.getMsg()).append("#");
+                                    noCarWayBill.setBillwayStatus(-2);
+                                    noCarWayBill.setFailReason(respR.getMsg());
+                                    insertOrUpdateBill(noCarWayBill);
+                                    return;
+                                }
                             }
-                        }
+
+
 
                         //3.kais指令上传
                         NoCarWayBill noCarWayBillClo = null;

+ 3 - 3
src/main/resources/mapper/invoice/BillInvoiceMapper.xml

@@ -79,7 +79,7 @@
                 and companyName LIKE CONCAT('%',#{billInvoice.companyName},'%')
             </if>
             <if test="billInvoice.waybillNum != null and billInvoice.waybillNum != ''">
-                and waybillNum = #{billInvoice.waybillNum}
+                and  instr(#{billInvoice.waybillNum},waybillNum)>0
             </if>
             <if test="billInvoice.buyerTaxpayerCode != null and billInvoice.buyerTaxpayerCode != ''">
                 and buyerTaxpayerCode = #{billInvoice.buyerTaxpayerCode}
@@ -88,10 +88,10 @@
                 and plateNum = #{billInvoice.plateNum}
             </if>
             <if test="billInvoice.invoiceCode != null and billInvoice.invoiceCode != ''">
-                and invoiceCode = #{billInvoice.invoiceCode}
+                and instr(#{billInvoice.invoiceCode},invoiceCode)>0
             </if>
             <if test="billInvoice.invoiceNum != null and billInvoice.invoiceNum != ''">
-                and invoiceNum = #{billInvoice.invoiceNum}
+                and instr(#{billInvoice.invoiceNum},invoiceNum)>0
             </if>
             <if test="billInvoice.invoiceMakeStart != null and billInvoice.invoiceMakeStart != ''">
                 and invoiceMakeTime BETWEEN #{billInvoice.invoiceMakeStart} and #{billInvoice.invoiceMakeEnd}

+ 3 - 3
src/main/resources/mapper/invoice/SelfCarInvoiceMapper.xml

@@ -57,14 +57,14 @@
     </sql>
     <select id="selectAllByPage" resultMap="BaseResultMap">
         select
-        <include refid="baseSql" />,(select t.status from t_SellCarTrade t where t.tradeId = g.tradeId ) tradeStatus,(select f.calTime from t_SelfCalculateInfor f where f.etcNum = cardId and instr(g.exTime,f.calTime)) calculateTime
+        <include refid="baseSql" />,(select t.status from t_SellCarTrade t where t.tradeId = g.tradeId ) tradeStatus,(select f.calTime from t_SelfCalculateInfor f where f.etcNum = cardId and instr(g.exTime,f.calTime)>0) calculateTime
         from t_SelfCarInvoice g
         <where>
             <if test="selfCarInvoice.companyName != null and selfCarInvoice.companyName != ''">
                 and companyName LIKE CONCAT('%',#{selfCarInvoice.companyName},'%')
             </if>
             <if test="selfCarInvoice.tradeId != null and selfCarInvoice.tradeId != ''">
-                and tradeId = #{selfCarInvoice.tradeId}
+                and  instr(#{selfCarInvoice.tradeId},tradeId)>0
             </if>
             <if test="selfCarInvoice.plateNum != null and selfCarInvoice.plateNum != ''">
                 and plateNum = #{selfCarInvoice.plateNum}
@@ -73,7 +73,7 @@
                 and buyerTaxpayerCode = #{selfCarInvoice.buyerTaxpayerCode}
             </if>
             <if test="selfCarInvoice.cardId != null and selfCarInvoice.cardId != ''">
-                and cardId = #{selfCarInvoice.cardId}
+                and instr(#{selfCarInvoice.cardId},cardId)>0
             </if>
             <if test="selfCarInvoice.invoiceCode != null and selfCarInvoice.invoiceCode != ''">
                 and invoiceCode = #{selfCarInvoice.invoiceCode}

+ 1 - 1
src/main/resources/mapper/waybill/NoCarWaybillMapper.xml

@@ -65,7 +65,7 @@
                 and companyName LIKE CONCAT('%',#{noCarWayBill.companyName},'%')
             </if>
             <if test="noCarWayBill.billNum != null and noCarWayBill.billNum != ''">
-                and billNum = #{noCarWayBill.billNum}
+                and  instr(#{noCarWayBill.billNum},billNum)>0
             </if>
             <if test="noCarWayBill.taxplayerCode != null and noCarWayBill.taxplayerCode != ''">
                 and taxplayerCode = #{noCarWayBill.taxplayerCode}

+ 2 - 2
src/main/resources/mapper/waybill/SellCarTradeMapper.xml

@@ -41,13 +41,13 @@
                 and companyName LIKE CONCAT('%',#{sellCarTrade.companyName},'%')
             </if>
             <if test="sellCarTrade.cardId != null and sellCarTrade.cardId != ''">
-                and cardId = #{sellCarTrade.cardId}
+                and instr(#{sellCarTrade.cardId},cardId)>0
             </if>
             <if test="sellCarTrade.companyReferencenum != null and sellCarTrade.companyReferencenum != ''">
                 and companyReferencenum = #{sellCarTrade.companyReferencenum}
             </if>
             <if test="sellCarTrade.tradeId != null and sellCarTrade.tradeId != ''">
-                and tradeId = #{sellCarTrade.tradeId}
+                and  instr(#{sellCarTrade.tradeId},tradeId)>0
             </if>
             <if test="sellCarTrade.status != null and sellCarTrade.status != ''">
                 and status = #{sellCarTrade.status}