Browse Source

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

Administrator 2 years ago
parent
commit
f1bcc96030

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

@@ -168,10 +168,10 @@ public class InterfaceCheckServer {
                 result = selfCarInterService.customerCarUnRec(appKey,api,data,requestid);
                 break;
 
-            case "B2B_CHANGE_CARD_VI":
+            case "B2B_CHANGE_CARD_V1":
                 result = selfCarInterService.customerCardChange(appKey,api,data,requestid);
                 break;
-            case "B2B_CHANGE_CARD_QUERY_VI":
+            case "B2B_CHANGE_CARD_QUERY_V1":
                 result = selfCarInterService.customerCardChangeQuery(appKey,api,data,requestid);
                 break;
 

+ 4 - 3
src/main/java/com/jkcredit/invoice/credit/interserver/SelfCarInterServiceImpl.java

@@ -812,7 +812,7 @@ public class SelfCarInterServiceImpl implements SelfCarInterService {
     }
 
     @Override
-    public DataResult customerCardChange(String appKey, String api, String data, String requestid) {
+    public DataResult customerCardChangeQuery(String appKey, String api, String data, String requestid) {
         long costtimestart = System.currentTimeMillis();
         DataResult result = new DataResult();
         result.setData(3);
@@ -853,7 +853,7 @@ public class SelfCarInterServiceImpl implements SelfCarInterService {
             } else {
                 result.setData(3);
                 result.setCode(200);
-                result.setMsg(rs.getMsg());
+                result.setMsg(rs==null?"结果为空":rs.getMsg());
                 return result;
             }
         } catch (Exception e) {
@@ -864,7 +864,7 @@ public class SelfCarInterServiceImpl implements SelfCarInterService {
     }
 
     @Override
-    public DataResult customerCardChangeQuery(String appKey, String api, String data, String requestid) {
+    public DataResult customerCardChange(String appKey, String api, String data, String requestid) {
         long costtimestart = System.currentTimeMillis();
         DataResult result = new DataResult();
         result.setData(3);
@@ -893,6 +893,7 @@ public class SelfCarInterServiceImpl implements SelfCarInterService {
                 result.setMsg("该企业编号未注册企业!");
                 return result;
             }
+            cardChangeDto.setCompanyName(customerRec1.getCompanyName());
             RespR rs = selfCarService.customerCardChange(cardChangeDto);
             long costtimeend = System.currentTimeMillis();
             log.info("[-SelfCarInterServiceImpl.customerCarUnRec-] result is "

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

@@ -42,4 +42,6 @@ public interface CustomerCarRecMapper extends BaseMapper<CustomerCarRec> {
 
     int upDateCompanyNo(CompanyVo companyVo);
     List<CustomerCarRec> selectAllEtcByCompany(String companyName);
+
+    void deleteByEtcCard(String etcNum);
 }

+ 12 - 0
src/main/java/com/jkcredit/invoice/mapper/customer/CustomerChangeInfoMapper.java

@@ -0,0 +1,12 @@
+package com.jkcredit.invoice.mapper.customer;
+
+import com.jkcredit.invoice.model.entity.customer.CustometEtcChangeInfo;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface CustomerChangeInfoMapper {
+    void insertCardChangeInfo(CustometEtcChangeInfo custometEtcChangeInfo);
+
+    void insertChangeCard(@Param("applyId") String applyId, @Param("cardId") String cardId);
+}

+ 110 - 0
src/main/java/com/jkcredit/invoice/model/entity/customer/CustometEtcChangeInfo.java

@@ -0,0 +1,110 @@
+package com.jkcredit.invoice.model.entity.customer;
+
+import com.jkcredit.invoice.credit.dto.CardChangeDto;
+
+import java.util.ArrayList;
+
+public class CustometEtcChangeInfo {
+    /**
+     *原公司编号
+     */
+    private String companyNum;
+
+    /**
+     * 原公司名称
+     */
+    private String companyName;
+
+    /**
+     * 目标公司编号
+     */
+    private String targetCompanyNum;
+
+    /**
+     * 目标公司名称
+     */
+    private String targetCompanyName;
+
+    private String changeTime;
+
+    private String applyId;
+
+    private String info;
+
+    /**
+     * 换绑的卡号集合
+     */
+    private ArrayList<String> cardIdList;
+
+    public String getCompanyNum() {
+        return companyNum;
+    }
+
+    public void setCompanyNum(String companyNum) {
+        this.companyNum = companyNum;
+    }
+
+    public String getTargetCompanyNum() {
+        return targetCompanyNum;
+    }
+
+    public void setTargetCompanyNum(String targetCompanyNum) {
+        this.targetCompanyNum = targetCompanyNum;
+    }
+
+    public ArrayList<String> getCardIdList() {
+        return cardIdList;
+    }
+
+    public void setCardIdList(ArrayList<String> cardIdList) {
+        this.cardIdList = cardIdList;
+    }
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public String getTargetCompanyName() {
+        return targetCompanyName;
+    }
+
+    public void setTargetCompanyName(String targetCompanyName) {
+        this.targetCompanyName = targetCompanyName;
+    }
+
+    public  void copyFromChangeDto(CardChangeDto cardChangeDto){
+        this.companyName = cardChangeDto.getCompanyName();
+        this.companyNum = cardChangeDto.getCompanyNum();
+        this.targetCompanyName = cardChangeDto.getTargetCompanyName();
+        this.targetCompanyNum = cardChangeDto.getTargetCompanyNum();
+        this.cardIdList = cardChangeDto.getCardIdList();
+    }
+
+    public String getChangeTime() {
+        return changeTime;
+    }
+
+    public void setChangeTime(String changeTime) {
+        this.changeTime = changeTime;
+    }
+
+    public String getApplyId() {
+        return applyId;
+    }
+
+    public void setApplyId(String applyId) {
+        this.applyId = applyId;
+    }
+
+    public String getInfo() {
+        return info;
+    }
+
+    public void setInfo(String info) {
+        this.info = info;
+    }
+}

+ 20 - 7
src/main/java/com/jkcredit/invoice/service/lowerservice/impl/SelfCarServiceLImpl.java

@@ -11,6 +11,7 @@ import com.jkcredit.invoice.mapper.binvoce.SelfCarApplMapper;
 import com.jkcredit.invoice.mapper.binvoce.SelfCarInvoiceMapper;
 import com.jkcredit.invoice.mapper.calculateinfor.SelfCarCalculateInforMapper;
 import com.jkcredit.invoice.mapper.customer.CustomerCarRecMapper;
+import com.jkcredit.invoice.mapper.customer.CustomerChangeInfoMapper;
 import com.jkcredit.invoice.mapper.customer.CustomerMapper;
 import com.jkcredit.invoice.mapper.customer.CustomerRecMapper;
 import com.jkcredit.invoice.mapper.waybill.SellCarTradeMapper;
@@ -18,6 +19,7 @@ import com.jkcredit.invoice.model.entity.calculate.SelfCarCalculateInfor;
 import com.jkcredit.invoice.model.entity.customer.Customer;
 import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.model.entity.customer.CustomerRec;
+import com.jkcredit.invoice.model.entity.customer.CustometEtcChangeInfo;
 import com.jkcredit.invoice.model.entity.invoice.SelfCarAppl;
 import com.jkcredit.invoice.model.entity.invoice.SelfCarInvoice;
 import com.jkcredit.invoice.model.entity.waybill.SelfCarTrade;
@@ -620,13 +622,27 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
             log.info("etc换绑失败:SelfCarServiceLImpl.customerCardChange{},msg",cardChangeDto,respR.getMsg());
             return new RespR(false,respR.getMsg());
         }else{
-            /**
-             * TODO 数据库处理换绑信息
-             */
+
+            try{
+                String applyId = respR.getData().getApplyId();
+                //1.删除etc绑卡信息
+                cards.stream().forEach(card->{
+                    customerCarRecMapper.deleteByEtcCard(card);
+                    customerChangeInfoMapper.insertChangeCard(applyId,card);
+                });
+                //2.换绑信息入库
+                CustometEtcChangeInfo custometEtcChangeInfo = new CustometEtcChangeInfo();
+                custometEtcChangeInfo.copyFromChangeDto(cardChangeDto);
+                custometEtcChangeInfo.setApplyId(applyId);
+                customerChangeInfoMapper.insertCardChangeInfo(custometEtcChangeInfo);
+            }catch (Exception e){
+
+            }
             return new RespR(respR.getData());
         }
     }
-
+    @Autowired
+    CustomerChangeInfoMapper customerChangeInfoMapper;
     @Override
     public RespR customerCardChangeQuery(CardChangeQueryDto cardChangeQueryDto) {
         CardChangeQueryRequest cardChangeQueryRequest = new CardChangeQueryRequest();
@@ -638,9 +654,6 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
             log.info("etc换绑失败:SelfCarServiceLImpl.customerCardChange{},msg",cardChangeQueryDto,respR.getMsg());
             return new RespR(false,respR.getMsg());
         }else{
-            /**
-             * TODO 数据库处理换绑信息
-             */
             return new RespR(respR.getData());
         }
     }

+ 3 - 0
src/main/resources/mapper/customer/CustomerCarRecMapper.xml

@@ -314,4 +314,7 @@
   <update id="upDateCompanyNo" parameterType="com.jkcredit.invoice.model.vo.CompanyVo">
     UPDATE t_customer_carRec set company_Name = #{newCompanyName} where company_Name = #{oldCompanyName} and  bussiness_type=2
   </update>
+  <delete id="deleteByEtcCard" parameterType="java.lang.String">
+        DELETE from t_customer_carRec  where bussiness_type = 0 and etc_num = BINARY #{etcNum,jdbcType=VARCHAR}
+  </delete>
 </mapper>

+ 27 - 0
src/main/resources/mapper/customer/CustomerChangeInfoMapper.xml

@@ -0,0 +1,27 @@
+<?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.jkcredit.invoice.mapper.customer.CustomerChangeInfoMapper">
+  <resultMap id="BaseResultMap" type="com.jkcredit.invoice.model.entity.customer.CustometEtcChangeInfo">
+    <result column="customerId" jdbcType="VARCHAR" property="customerId" />
+    <result column="companyName" jdbcType="VARCHAR" property="companyName" />
+    <result column="companyNum" jdbcType="VARCHAR" property="companyNum" />
+    <result column="targetCompanyName" jdbcType="VARCHAR" property="targetCompanyName" />
+    <result column="targetcompanyNum" jdbcType="VARCHAR" property="targetcompanyNum" />
+    <result column="applyId" jdbcType="VARCHAR" property="applyId" />
+    <result column="changeTime" jdbcType="VARCHAR" property="changeTime" />
+    <result column="info" jdbcType="VARCHAR" property="info" />
+  </resultMap>
+  <sql id="Base_Column_List">
+     customerId,companyName,companyNum,targetCompanyName,targetcompanyNum,applyId,changeTime,info
+  </sql>
+  <insert id="insertCardChangeInfo" parameterType="com.jkcredit.invoice.model.entity.customer.CustometEtcChangeInfo">
+      insert into t_change_card_info (customerId,companyName,companyNum,targetCompanyName,targetcompanyNum,applyId,changeTime,info)
+      values (#{customerId,jdbcType=VARCHAR},#{companyName,jdbcType=VARCHAR}, #{companyNum,jdbcType=VARCHAR}, #{targetCompanyName,jdbcType=VARCHAR},
+      #{targetcompanyNum,jdbcType=VARCHAR}, #{applyId,jdbcType=VARCHAR}, #{changeTime,jdbcType=VARCHAR},
+      #{info,jdbcType=VARCHAR})
+  </insert>
+
+  <insert id="insertChangeCard" parameterType="java.util.Map">
+      insert into t_change_card (applyId,cardId) VALUES (#{applyId,jdbcType=VARCHAR},#{cardId,jdbcType=VARCHAR)
+  </insert>
+</mapper>

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

@@ -85,7 +85,9 @@
             <if test="billInvoice.companyName != null and billInvoice.companyName != ''">
                 and  buyerName = BINARY #{billInvoice.companyName}
             </if>
-
+            <if test="billInvoice.invoiceStatus != null and billInvoice.invoiceStatus != ''">
+                and  invoiceStatus = BINARY #{billInvoice.invoiceStatus}
+            </if>
             <if test="billInvoice.waybillNums != null">
                 and  waybillNum IN
                 <foreach collection="billInvoice.waybillNums" item="billNum" index="index" separator="," open="(" close=")">

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

@@ -104,7 +104,7 @@
         from t_waybill_no
            where
             billwayStatus = 2
-            and (( InterfaceEndTime &lt; date_sub(now(), interval 20 day) and hisFlag =0)
+            and (( InterfaceEndTime &lt; date_sub(now(), interval 11 day) and hisFlag =0)
             or
             (InterfaceEndTime &lt; date_sub(now(), interval 7 day) and hisFlag =1)
             )