Browse Source

渠道通过此接口增加或修改邮箱,保证各企业关联1个邮箱,如果修改多次,以最后一次修改的邮箱为该企业最新邮箱

mashengyi 7 months ago
parent
commit
c936aa8ca9

+ 13 - 0
src/main/java/com/jkcredit/invoice/controller/business/CustomerController.java

@@ -315,6 +315,7 @@ public class CustomerController {
         }
         return customerService.promiseAdd(customerRec);
     }
+
     @PostMapping("/contractStatusFail")
     @ApiOperation(value = "协议上传失败状态确认", notes = "协议上传失败状态确认")
     @LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
@@ -325,6 +326,18 @@ public class CustomerController {
         return customerService.contractStatusFail(customerRec);
     }
 
+
+    @PostMapping("/customerRecEditMail")
+    @ApiOperation(value = "更新备案邮箱", notes = "更新备案邮箱")
+    @LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)
+    public RespR customerRecEditMail(@RequestBody CustomerRec customerRec) {
+        if (null == customerRec.getInvoiceMail() || null == customerRec.getCompanyName()) {
+            return new RespR(false, "更新备案邮箱失败,请查看数据是否维护准确");
+        }
+        return customerService.customerRecEditMail(customerRec);
+    }
+
+
     @PostMapping("/contractStatusProcess")
     @ApiOperation(value = "协议上传成功,审批中状态确认", notes = "协议上传成功,审批中状态确认")
     @LoginRequired(role = AuthenticationInterceptor.AUTH_ADMIN)

+ 1 - 0
src/main/java/com/jkcredit/invoice/credit/SimpleCoreFilter.java

@@ -152,6 +152,7 @@ public class SimpleCoreFilter implements Filter {
             "/customer/contractStatusProcess",
             "/customer/contractStatusSuccess",
             "/customer/customeRecQueryList",
+            "/customer/customerRecEditMail",
 
             //无车企业开票人管理
             "/customerCompany/detailAdd",

+ 10 - 0
src/main/java/com/jkcredit/invoice/mapper/customer/CustomerRecMapper.java

@@ -153,13 +153,23 @@ public interface CustomerRecMapper extends BaseMapper<CustomerRec> {
 
     /**
      * 更新企业备案信息 按照条件
+     *
      * @param record
      * @return
      */
     int updateByPrimaryKeySelective(CustomerRec record);
 
     /**
+     * 更新企业备案邮箱 按照条件
+     *
+     * @param record
+     * @return
+     */
+    int updateInvoiceMail(CustomerRec record);
+
+    /**
      * 按照id更新企业备案信息
+     *
      * @param record
      * @return
      */

+ 9 - 0
src/main/java/com/jkcredit/invoice/service/customer/CustomerService.java

@@ -160,4 +160,13 @@ public interface CustomerService extends IService<Customer> {
      * @return
      */
     RespR contractStatusSuccess(CustomerRec customerRec);
+
+
+    /**
+     * 修改备案邮箱
+     *
+     * @param customerRec
+     * @return
+     */
+    RespR customerRecEditMail(CustomerRec customerRec);
 }

+ 32 - 1
src/main/java/com/jkcredit/invoice/service/customer/impl/CustomerServiceImpl.java

@@ -1,6 +1,15 @@
 package com.jkcredit.invoice.service.customer.impl;
 
-import cn.com.taiji.sdk.model.comm.protocol.eoms.company.*;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.B2bContractAddRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.B2bContractAddResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyAddRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyAddResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyEditRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyEditResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyQueryRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyQueryResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.ConfirmContractAddRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.ConfirmContractAddResponse;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -20,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import static com.jkcredit.invoice.common.CommonConst.REC_STATUS_SUC;
 import static com.jkcredit.invoice.common.CommonConst.REC_STATUS_UN;
 
 /**
@@ -196,6 +206,27 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
     }
 
     @Override
+    public RespR customerRecEditMail(CustomerRec customerRec) {
+        log.info("开始更新备案邮箱:CustomerServiceImpl.customerRecEditMail{}", customerRec);
+        CustomerRec customerRec1 = customerRecMapper.selectByCustomerNameAndCompany(customerRec);
+        if (customerRec1.getRecStatus().intValue() != REC_STATUS_SUC) {
+            return new RespR(false, "无法更新邮箱,未备案成功");
+        }
+        CompanyEditRequest companyEditRequest = new CompanyEditRequest();
+        companyEditRequest.setCompanyNum(customerRec.getCompanyNum());
+        companyEditRequest.setInvoiceEmail(customerRec.getInvoiceMail());
+        RespR<CompanyEditResponse> responseRespR = commInterFace.editEmail(companyEditRequest);
+        if (responseRespR.getCode() == 1) {
+            log.info("更新备案邮箱失败:CustomerServiceImpl.customerRecEditMail{}---msg{}", customerRec, responseRespR.getMsg());
+            return new RespR(false, responseRespR.getMsg());
+        } else {
+            log.info("更新备案邮箱成功:CustomerServiceImpl.customerRecEditMail");
+            customerRecMapper.updateInvoiceMail(customerRec);
+            return new RespR("更新备案邮箱成功");
+        }
+    }
+
+    @Override
     public RespR contractDownload(String id) {
         CustomerRec customerRec = customerRecMapper.selectByPrimaryKeyHasBase64(Integer.valueOf(id));
         return new RespR(customerRec);

+ 22 - 1
src/main/java/com/jkcredit/invoice/service/upservice/CommInterFace.java

@@ -1,6 +1,17 @@
 package com.jkcredit.invoice.service.upservice;
 
-import cn.com.taiji.sdk.model.comm.protocol.eoms.company.*;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.B2bContractAddRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.B2bContractAddResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.B2bContractQueryRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.B2bContractQueryResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyAddRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyAddResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyEditRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyEditResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyQueryRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyQueryResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.ConfirmContractAddRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.ConfirmContractAddResponse;
 import com.jkcredit.invoice.util.RespR;
 
 /**
@@ -48,4 +59,14 @@ public interface CommInterFace {
      * @return
      */
     RespR<B2bContractQueryResponse> b2bContractQuery(B2bContractQueryRequest b2bContractQueryRequest);
+
+
+    /**
+     * 关联企业邮箱
+     * 渠道通过此接口增加或修改邮箱,保证各企业关联1个邮箱,如果修改多次,以最后一次修改的邮箱为该企业最新邮箱
+     *
+     * @param companyEditRequest
+     * @return
+     */
+    RespR<CompanyEditResponse> editEmail(CompanyEditRequest companyEditRequest);
 }

+ 34 - 1
src/main/java/com/jkcredit/invoice/service/upservice/impl/CommInterFaceImpl.java

@@ -2,7 +2,18 @@ package com.jkcredit.invoice.service.upservice.impl;
 
 import cn.com.taiji.common.manager.net.http.binclient.ApiRequestException;
 import cn.com.taiji.sdk.comm.ETCCommHelper;
-import cn.com.taiji.sdk.model.comm.protocol.eoms.company.*;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.B2bContractAddRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.B2bContractAddResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.B2bContractQueryRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.B2bContractQueryResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyAddRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyAddResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyEditRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyEditResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyQueryRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyQueryResponse;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.ConfirmContractAddRequest;
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.ConfirmContractAddResponse;
 import com.jkcredit.invoice.service.upservice.CommInterFace;
 import com.jkcredit.invoice.util.RespR;
 import lombok.extern.slf4j.Slf4j;
@@ -133,4 +144,26 @@ public class CommInterFaceImpl implements CommInterFace {
         }
     }
 
+    @Override
+    public RespR<CompanyEditResponse> editEmail(CompanyEditRequest companyEditRequest) {
+        String fileName = companyEditRequest.getFilename();
+        long startTime = System.currentTimeMillis();
+        try {
+            log.info("CommInterFaceImpl.editEmail上游请求参数:{}", companyEditRequest.toString());
+            //(4)指定协议的响应模型(IssuerUploadResponse),调用upload 发送数据
+            CompanyEditResponse response = ETCCommHelper.upload(fileName, companyEditRequest, CompanyEditResponse.class);
+            log.info("CommInterFaceImpl.editEmail上游接口返回:{},请求参数:{},cost={}ms", response.toString(), companyEditRequest.toString(), System.currentTimeMillis() - startTime);
+
+            return new RespR<>(response);
+        } catch (IOException e) {
+            e.printStackTrace();
+            log.error("CommInterFaceImpl.editEmail:{}", e.getMessage() + " ,请求参数:" + companyEditRequest.toString() + " ,cost=" + (System.currentTimeMillis() - startTime) + "ms");
+            return new RespR(false, "网络异常,请联系管理人员");
+        } catch (ApiRequestException apie) {
+            apie.printStackTrace();
+            log.error("CommInterFaceImpl.editEmail:{}", apie.getMessage().replaceAll("[\r\n]", "") + " ,请求参数:" + companyEditRequest.toString() + " ,cost=" + (System.currentTimeMillis() - startTime) + "ms");
+            return new RespR(false, apie.getMessage());
+        }
+    }
+
 }

+ 21 - 7
src/main/resources/mapper/customer/CustomerRecMapper.xml

@@ -490,23 +490,37 @@
       <if test="lowerBase64Str != null" >
         lowerBase64Str = #{lowerBase64Str,jdbcType=VARCHAR},
       </if>
-      <if test="fileMessage != null" >
+      <if test="fileMessage != null">
         fileMessage = #{fileMessage,jdbcType=VARCHAR},
       </if>
       <if test="invoiceMail !=null">
         invoiceMail = #{invoiceMail,jdbcType=VARCHAR},
       </if>
     </set>
-    where  company_name = BINARY #{companyName,jdbcType=VARCHAR} and  bussiness_type = #{bussinessType,jdbcType=INTEGER} and company_referenceNum = #{companyReferencenum,jdbcType=VARCHAR}
+    where company_name = BINARY #{companyName,jdbcType=VARCHAR} and bussiness_type = #{bussinessType,jdbcType=INTEGER}
+    and company_referenceNum = #{companyReferencenum,jdbcType=VARCHAR}
+  </update>
+
+
+  <update id="updateInvoiceMail" parameterType="com.jkcredit.invoice.model.entity.customer.CustomerRec">
+    update t_customer_rec
+    <set>
+      <if test="invoiceMail !=null">
+        invoiceMail = #{invoiceMail,jdbcType=VARCHAR}
+      </if>
+    </set>
+    where company_name = BINARY #{companyName,jdbcType=VARCHAR} and customerName = BINARY
+    #{customerName,jdbcType=VARCHAR}
   </update>
 
+
   <update id="updatePromiseInfo" parameterType="com.jkcredit.invoice.model.entity.customer.CustomerRec">
     update t_customer_rec
-    <set >
-    <if test="promiseFileName != null and promiseFileName != ''" >
-      promiseFileName = #{promiseFileName,jdbcType=VARCHAR},
-    </if>
-      <if test="promiseBase64Str != null and promiseBase64Str != ''" >
+    <set>
+      <if test="promiseFileName != null and promiseFileName != ''">
+        promiseFileName = #{promiseFileName,jdbcType=VARCHAR},
+      </if>
+      <if test="promiseBase64Str != null and promiseBase64Str != ''">
         promiseBase64Str = #{promiseBase64Str,jdbcType=VARCHAR},
       </if>
       <if test="promiseFileStatus != null and promiseFileStatus != ''" >