Browse Source

后端代码提交

mashengyi 3 years ago
parent
commit
2f5360f9ff

+ 1 - 1
src/main/java/com/jkcredit/invoice/mapper/customer/CustomerCarRecMapper.java

@@ -20,7 +20,7 @@ public interface CustomerCarRecMapper extends BaseMapper<CustomerCarRec> {
     List<CustomerCarRec>  selectByCustName(String customerName);
 
     CustomerCarRec selectByETC(String etcNum);
-    CustomerCarRec selectByCarNum(String carNum);
+    List<CustomerCarRec> selectByCarNum(String carNum);
     List<CustomerCarRec> selectBySelfCarNum(String carNum);
     List<CustomerCarRec> selectAllEtcBySelfCarNum(String carNum);
 

+ 9 - 12
src/main/java/com/jkcredit/invoice/service/lowerService/impl/NoCarServiceImpl.java

@@ -141,8 +141,6 @@ public class NoCarServiceImpl implements NoCarService{
                 } else {
                     customerCarRec.setRecStatus(CommonConstants.REC_STATUS_SUC);
                     customerCarRec.setSuccTime(DateUtil.getCurrentDateStr());
-
-                    respRResult = respR.getMsg();
                 }
                 //根据车牌号查询是新增还是更新
                 updateCustomerCarRec(customerCarRec);
@@ -150,7 +148,7 @@ public class NoCarServiceImpl implements NoCarService{
             }
             if(StringUtils.isEmpty(res.toString())){
                 log.info("车辆备案成功");
-                return new RespR(respRResult);
+                return new RespR("车辆备案成功");
             }else {
                 log.info("车辆备案异常NoCarServiceImpl.customerCarRec{},msg{}",customerCarRecs,res.toString());
                 return new RespR(false,res.toString());
@@ -201,8 +199,8 @@ public class NoCarServiceImpl implements NoCarService{
 
     public synchronized void updateCustomerCarRec(CustomerCarRec customerCarRec){
         //根据车牌号查询是新增还是更新
-        CustomerCarRec customerCarRec1 = customerCarRecMapper.selectByCarNum(customerCarRec.getCarNum());
-        if (customerCarRec1 == null) {
+        List<CustomerCarRec> customerCarRec1 = customerCarRecMapper.selectByCarNum(customerCarRec.getCarNum());
+        if (customerCarRec1 == null || customerCarRec1.size()==0) {
             customerCarRecMapper.insert(customerCarRec);
         } else {
             customerCarRecMapper.updateByPrimaryKey(customerCarRec);
@@ -375,8 +373,6 @@ public class NoCarServiceImpl implements NoCarService{
 
         if(responseRespR.getCode() == 1){
             log.info("历史运单开始上传失败:NoCarServiceImpl.noCarHisWaybillStart{},msg{}",noCarWayBill,responseRespR.getMsg());
-            noCarWayBill1.setFailReason(responseRespR.getMsg());
-            noCarWaybillMapper.updateByBillNum(noCarWayBill1);
             return new RespR(false,responseRespR.getMsg());
         }else{
             noCarWayBill.setIntfaceStartTime(DateUtil.getCurrentDateStr());
@@ -509,7 +505,6 @@ public class NoCarServiceImpl implements NoCarService{
                     billInvoice.setCompanyName(noCarWayBillDb.getCompanyName());
                     billInvoice.setCompanyNum(noCarWayBillDb.getCompanyNum());
                     billInvoice.setCustomerName(noCarWayBillDb.getCustomerName());
-                    billInvoiceMapper.insert(billInvoice);
                     //扣费明细入账
                     NoCarCalculateInfor calculateInfor = new NoCarCalculateInfor();
                     calculateInfor.setCalculateTime(DateUtil.getCurrentDateStr());
@@ -524,17 +519,19 @@ public class NoCarServiceImpl implements NoCarService{
                     calculateInfor.setFee(fee);
                     calculateInfor.setTradeId(billInvoice.getTransactionId());
                     //先查询数据库中有没有这个交易id
-                    if(calculateInforMapper.selectByTradeId(billInvoice.getTransactionId())==null){
+                    NoCarCalculateInfor noCarCalculateInfor = calculateInforMapper.selectByTradeId(billInvoice.getTransactionId());
+                    if(noCarCalculateInfor==null){
                         Customer customer = customerMapper.selectByCustomerName(noCarWayBill.getCustomerName());
                         customer.setInvoiceTime(DateUtil.getCurrentDateStr());
                         customer.setAccountBalance(MathUtil.sub(customer.getAccountBalance(),calculateInfor.getFee()));
                         customerMapper.updateByPrimaryKeySelective(customer);
-
                         calculateInfor.setCompanyLongName(customer.getCompany());
-
                         calculateInforMapper.insert(calculateInfor);
+                        billInvoice.setCalculateTime(calculateInfor.getCalculateTime());
+                    }else{
+                        billInvoice.setCalculateTime(noCarCalculateInfor.getCalculateTime());
                     }
-
+                    billInvoiceMapper.insert(billInvoice);
                 });
                 List<BillInvoice> billInvoices1 = billInvoiceMapper.selectByBillNum(noCarWayBill.getBillNum());
                 if(billInvoices1!=null && billInvoices1.size()>0 && noCarWayBill.getInterType() != 0){

+ 38 - 3
src/main/java/com/jkcredit/invoice/task/ScheduledBillTask.java

@@ -10,12 +10,14 @@ import com.jkcredit.invoice.service.lowerService.NoCarService;
 import com.jkcredit.invoice.service.lowerService.SelfCarServiceL;
 import com.jkcredit.invoice.service.lowerService.vo.SelfCarDueQueryVo;
 import com.jkcredit.invoice.service.lowerService.vo.TradeRequestVo;
+import com.jkcredit.invoice.service.manager.ParamService;
 import com.jkcredit.invoice.util.DateUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import java.net.InetAddress;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -44,11 +46,24 @@ public class ScheduledBillTask {
 
     @Autowired
     CustomerCarRecMapper customerCarRecMapper;
+
+    @Autowired
+    ParamService paramService;
     /**
      * 实时运单开票(每天23点开始)
      */
     @Scheduled(cron = "0 0 23 * * ?", zone = "Asia/Shanghai")
-    public void updateNocarBillInfo() {
+    public void updateNocarBillInfo() throws Exception{
+        InetAddress addr = InetAddress.getLocalHost();
+        String ip  = paramService.getParamsByParamName("CURR_SELF_IP").getParamValue();
+
+        log.info("CURR_SELF_IP"+ip +",address:"+addr);
+        if(!addr.getHostAddress().equals(ip)){
+          log.info("!bengjiqikaipao");
+          return;
+        }else{
+            log.info("bengjiqikaipao");
+        }
         try {
             delGetInvoce(0);
         }catch (Exception e){
@@ -71,7 +86,17 @@ public class ScheduledBillTask {
      * 历史运单开票(每天整点点开始) todo 改成动态设置
      */
     @Scheduled(cron = "0 0 0/1 * * ?", zone = "Asia/Shanghai")
-    public void updateHistoryNocarBillInfo() {
+    public void updateHistoryNocarBillInfo() throws  Exception{
+        InetAddress addr = InetAddress.getLocalHost();
+        String ip  = paramService.getParamsByParamName("HISTORY_IP").getParamValue();
+
+        log.info("HISTORY_IP"+ip +",address:"+addr);
+        if(!addr.getHostAddress().equals(ip)){
+            log.info("!bengjiqikaipao");
+            return;
+        }else{
+            log.info("bengjiqikaipao");
+        }
         try {
             delGetInvoce(1);
         }catch (Exception e){
@@ -80,7 +105,17 @@ public class ScheduledBillTask {
     }
 
    @Scheduled(cron = "0 0 23 * * ?", zone = "Asia/Shanghai")
-    public void getSefCarInvoice() {
+    public void getSefCarInvoice() throws Exception{
+       InetAddress addr = InetAddress.getLocalHost();
+       String ip  = paramService.getParamsByParamName("CURR_SELF_IP").getParamValue();
+
+       log.info("CURR_SELF_IP"+ip +",address:"+addr);
+       if(!addr.getHostAddress().equals(ip)){
+           log.info("!bengjiqikaipao");
+           return;
+       }else{
+           log.info("bengjiqikaipao");
+       }
        /**
         * 1.查询所有的etc卡
         * 2.按照etc卡号取最近两天的发票

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

@@ -4,7 +4,7 @@ server:
   tomcat:
     accesslog:
       enabled: true
-      directory: /home/invoiceSrv/app/bin/logs/tomcat   #日志存储目录
+      directory: /home/invoiceSrv/app/bin/logs/tomcat  #日志存储目录
       pattern: '%t %a %A %m %U%q %s %D %I %B'  #日志格式
       prefix: access        #日志文件前缀
       rename-on-rotate: true     #是否启用日志轮转

+ 9 - 7
src/main/resources/mapper/invoice/BillInvoiceMapper.xml

@@ -72,7 +72,7 @@
     </sql>
     <select id="selectAllByPage" resultMap="BaseResultMap">
         select
-        <include refid="baseSql" />,(select billwayStatus from t_waybill_no f where f.billNum = waybillNum) billStatus ,(SELECT  g.calculateTime from t_CalculateInfor g where g.tradeId = transactionId) calculateTime
+        <include refid="baseSql" />,waybillStatus billStatus,calculateTime
         from t_billInvoice
         <where>
             <if test="billInvoice.companyName != null and billInvoice.companyName != ''">
@@ -154,7 +154,7 @@
             transactionId,
             tradeMatchTime,
             buyerName,
-            buyerTaxpayerCode
+            buyerTaxpayerCode,calculateTime
         )
         values ( #{companyNum,jdbcType=VARCHAR},#{customerName,jdbcType=VARCHAR},#{companyName,jdbcType=VARCHAR},#{waybillNum,jdbcType=VARCHAR}, #{invoiceNum,jdbcType=VARCHAR},
                 #{invoiceCode,jdbcType=VARCHAR}, #{invoiceMakeTime,jdbcType=VARCHAR}, #{invoiceUrl,jdbcType=VARCHAR},
@@ -163,7 +163,7 @@
                 #{plateNum,jdbcType=VARCHAR},#{vehicleType,jdbcType=VARCHAR},#{sellerName,jdbcType=VARCHAR},
                 #{sellerTaxpayerCode,jdbcType=VARCHAR},#{waybillStatus,jdbcType=INTEGER}, #{waybillStartTime,jdbcType=VARCHAR}, #{waybillEndTime,jdbcType=VARCHAR}
                 , #{totalAmount,jdbcType=INTEGER}, #{taxRate,jdbcType=DOUBLE},#{invoiceType,jdbcType=VARCHAR},#{amount,jdbcType=INTEGER},
-                #{transactionId,jdbcType=VARCHAR},#{tradeMatchTime,jdbcType=VARCHAR},#{buyerName,jdbcType=VARCHAR},#{buyerTaxpayerCode,jdbcType=VARCHAR}
+                #{transactionId,jdbcType=VARCHAR},#{tradeMatchTime,jdbcType=VARCHAR},#{buyerName,jdbcType=VARCHAR},#{buyerTaxpayerCode,jdbcType=VARCHAR},#{calculateTime,jdbcType=VARCHAR}
         )
     </insert>
     <update id="updateByPrimaryKey" parameterType="com.jkcredit.invoice.model.entity.invoice.BillInvoice" >
@@ -198,7 +198,8 @@
         transactionId   = #{transactionId,jdbcType=VARCHAR},
         tradeMatchTime	= #{tradeMatchTime,jdbcType=VARCHAR},
         buyerName		= #{buyerName,jdbcType=VARCHAR},
-        buyerTaxpayerCode = #{buyerTaxpayerCode,jdbcType=VARCHAR}
+        buyerTaxpayerCode = #{buyerTaxpayerCode,jdbcType=VARCHAR},
+        calculateTime = #{calculateTime,jdbcType=VARCHAR}
         where id = #{id,jdbcType=INTEGER}
     </update>
 
@@ -233,18 +234,19 @@
             transactionId   = #{transactionId,jdbcType=VARCHAR},
             tradeMatchTime	= #{tradeMatchTime,jdbcType=VARCHAR},
             buyerName		= #{buyerName,jdbcType=VARCHAR},
-            buyerTaxpayerCode = #{buyerTaxpayerCode,jdbcType=VARCHAR}
+            buyerTaxpayerCode = #{buyerTaxpayerCode,jdbcType=VARCHAR},
+            calculateTime = #{calculateTime,jdbcType=VARCHAR}
         where BINARY invoiceNum = #{invoiceNum,jdbcType=VARCHAR}
     </update>
     <select id="selectByBillNum" resultMap="BaseResultMap" parameterType="java.lang.String" >
         select
-        <include refid="baseSql" />
+        <include refid="baseSql" />,calculateTime
         from t_billInvoice
         where BINARY waybillNum = #{waybillNum,jdbcType=VARCHAR}
     </select>
     <select id="selectByInvoiceNum" resultMap="BaseResultMap" parameterType="java.lang.String" >
         select
-        <include refid="baseSql" />
+        <include refid="baseSql" />,calculateTime
         from t_billInvoice
         where BINARY invoiceNum = #{invoiceNum,jdbcType=VARCHAR}
     </select>

+ 3 - 3
src/main/resources/mapper/manager/ParamMapper.xml

@@ -68,13 +68,13 @@
         t_manager_param
         <set>
             <if test="paramName != null and paramName != ''">
-                BINARY param_name = #{paramName},
+                 param_name = #{paramName},
             </if>
             <if test="paramValue != null and paramValue != ''">
-                BINARY param_value = #{paramValue},
+                 param_value = #{paramValue},
             </if>
             <if test="paramNote != null and paramNote != ''">
-                BINARY param_note = #{paramNote},
+                 param_note = #{paramNote},
             </if>
         </set>
         WHERE

+ 7 - 2
src/main/resources/sdk.properties

@@ -1,5 +1,10 @@
-dtsServiceURL=https://testdts.txffp.com
+dtsServiceURL=https://dts.txffp.com
 tempPath=/home/dts/tmp
 enableGzip=true
 enableEvent=false
-authStr=000000_issuer123456
+authStr=119901_0061nnPiC2
+#dtsServiceURL=https://testdts.txffp.com
+#tempPath=/home/dts/tmp
+#enableGzip=true
+#enableEvent=false
+#authStr=000000_issuer123456