mashengyi 3 роки тому
батько
коміт
c35dbf52d6

+ 2 - 1
src/main/java/com/jkcredit/invoice/component/SendMailService.java

@@ -19,7 +19,8 @@ public class SendMailService {
         MimeMessage message = javaMailSender.createMimeMessage();
         MimeMessage message = javaMailSender.createMimeMessage();
         MimeMessageHelper helper = new MimeMessageHelper(message);
         MimeMessageHelper helper = new MimeMessageHelper(message);
         helper.setFrom(user);
         helper.setFrom(user);
-        helper.setTo(email);
+        String [] emailStr = email.split("#");
+        helper.setTo(emailStr);
         helper.setSubject(company+"备案提交");
         helper.setSubject(company+"备案提交");
         helper.setText(contents,true);
         helper.setText(contents,true);
         log.info("before send emil");
         log.info("before send emil");

+ 8 - 3
src/main/java/com/jkcredit/invoice/controller/localBussiness/CustomerController.java

@@ -352,8 +352,13 @@ public class CustomerController {
     @LoginRequired
     @LoginRequired
     public RespR getCustomerMoneysByPage(Page page, Customer customer) {
     public RespR getCustomerMoneysByPage(Page page, Customer customer) {
         Param param = paramService.getParamsByParamName("CUST_MONEY_WARNING");
         Param param = paramService.getParamsByParamName("CUST_MONEY_WARNING");
-        IPage ipage = customerService.findAllCustomers(page, customer);
-        List<Customer> lists = ipage.getRecords();
+        if(customer.getMoneyUpper() == null || customer.getMoneyUpper() ==0){
+            customer.setMoneyUpper(Double.valueOf(param.getParamValue()));
+        }
+        IPage ipage = customerService.findAllNomoneyCustomers(page, customer);
+
+        return new RespR(ipage);
+       /* List<Customer> lists = ipage.getRecords();
         if(lists.size()>0){
         if(lists.size()>0){
             //遍历删除
             //遍历删除
             Iterator<Customer> iterator = lists.iterator();
             Iterator<Customer> iterator = lists.iterator();
@@ -365,7 +370,7 @@ public class CustomerController {
             }
             }
         }
         }
         ipage.setTotal(lists.size());
         ipage.setTotal(lists.size());
-        return new RespR(ipage);
+        return new RespR(ipage);*/
     }
     }
     /**
     /**
      * @param customerRec
      * @param customerRec

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

@@ -32,6 +32,6 @@ public interface CustomerCarRecMapper extends BaseMapper<CustomerCarRec> {
     int updateETCByPrimaryKey(CustomerCarRec record);
     int updateETCByPrimaryKey(CustomerCarRec record);
 
 
     int updateWaitETCStatus(CustomerCarRec record);
     int updateWaitETCStatus(CustomerCarRec record);
-
+    List<CustomerCarRec> selectAllBindEtc();
     IPage<List<CustomerCarRec>> selectAllByPage(Page page, @Param("query") CustomerCarRec customerCarRec);
     IPage<List<CustomerCarRec>> selectAllByPage(Page page, @Param("query") CustomerCarRec customerCarRec);
 }
 }

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

@@ -25,6 +25,8 @@ public interface CustomerMapper extends BaseMapper<Customer> {
     int updateByPrimaryKey(Customer record);
     int updateByPrimaryKey(Customer record);
 
 
     IPage<List<Customer>> selectAllByPage(Page page, @Param("customer") Customer customer);
     IPage<List<Customer>> selectAllByPage(Page page, @Param("customer") Customer customer);
+    IPage<List<Customer>> selectAllByPageForNoMoney(Page page, @Param("customer") Customer customer);
+
 
 
     Customer selectByAppKeyAndAppSecret(String customerName, String appSecret);
     Customer selectByAppKeyAndAppSecret(String customerName, String appSecret);
 }
 }

+ 14 - 0
src/main/java/com/jkcredit/invoice/model/entity/CustomerRecharge.java

@@ -81,4 +81,18 @@ public class CustomerRecharge {
     public void setRechargeEndTime(String rechargeEndTime) {
     public void setRechargeEndTime(String rechargeEndTime) {
         this.rechargeEndTime = rechargeEndTime;
         this.rechargeEndTime = rechargeEndTime;
     }
     }
+
+    @Override
+    public String toString() {
+        return "CustomerRecharge{" +
+                "id=" + id +
+                ", customerName='" + customerName + '\'' +
+                ", companyName='" + companyName + '\'' +
+                ", beforeMony=" + beforeMony +
+                ", rechargeMony=" + rechargeMony +
+                ", rechargeTime='" + rechargeTime + '\'' +
+                ", rechargeStartTime='" + rechargeStartTime + '\'' +
+                ", rechargeEndTime='" + rechargeEndTime + '\'' +
+                '}';
+    }
 }
 }

+ 26 - 0
src/main/java/com/jkcredit/invoice/model/entity/customer/Customer.java

@@ -40,6 +40,16 @@ public class Customer {
      */
      */
     private String subCompany;
     private String subCompany;
 
 
+    /**
+     * 钱上限
+     */
+    private Double moneyUpper;
+
+    /**
+     * 钱下限
+     */
+    private Double moneyLower;
+
     public Integer getId() {
     public Integer getId() {
         return id;
         return id;
     }
     }
@@ -161,6 +171,22 @@ public class Customer {
         this.subCompany = subCompany;
         this.subCompany = subCompany;
     }
     }
 
 
+    public Double getMoneyUpper() {
+        return moneyUpper;
+    }
+
+    public void setMoneyUpper(Double moneyUpper) {
+        this.moneyUpper = moneyUpper;
+    }
+
+    public Double getMoneyLower() {
+        return moneyLower;
+    }
+
+    public void setMoneyLower(Double moneyLower) {
+        this.moneyLower = moneyLower;
+    }
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         return "Customer{" +
         return "Customer{" +

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

@@ -22,6 +22,14 @@ public interface CustomerService extends IService<Customer>{
 
 
     /**
     /**
      * 查找所有客户
      * 查找所有客户
+     * @param page
+     * @param customer
+     * @return
+     */
+    IPage findAllNomoneyCustomers(Page page, Customer customer);
+
+    /**
+     * 查找所有客户
      * @param customer
      * @param customer
      * @return
      * @return
      */
      */

+ 5 - 0
src/main/java/com/jkcredit/invoice/service/customer/impl/CustomerServiceImpl.java

@@ -44,6 +44,11 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> im
     }
     }
 
 
     @Override
     @Override
+    public IPage findAllNomoneyCustomers(Page page, Customer customer) {
+        return customerMapper.selectAllByPageForNoMoney(page,customer);
+    }
+
+    @Override
     public Boolean addCustomers(Customer customer) {
     public Boolean addCustomers(Customer customer) {
         log.info("开始添加客户信息:CustomerServiceImpl.addCustomers{}",customer);
         log.info("开始添加客户信息:CustomerServiceImpl.addCustomers{}",customer);
         customer.setFirstSign(DateUtil.getCurrentDateStr());
         customer.setFirstSign(DateUtil.getCurrentDateStr());

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

@@ -266,7 +266,7 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
             return ;
             return ;
         }
         }
         CustomerRec customerRec = customerRecMapper.selectByPrimaryKey(applQueryInvVo.getCompanyNum());
         CustomerRec customerRec = customerRecMapper.selectByPrimaryKey(applQueryInvVo.getCompanyNum());
-        if(customerRec == null){
+        if(customerRec == null || customerRec.getRecStatus()!=1){
             log.info("备案信息不存在{}",applQueryInvVo);
             log.info("备案信息不存在{}",applQueryInvVo);
             return;
             return;
         }
         }
@@ -337,8 +337,8 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
                 for(B2BInvoiceListModel b2BInvoiceListModel:b2BInvoiceListModels){
                 for(B2BInvoiceListModel b2BInvoiceListModel:b2BInvoiceListModels){
                     SelfCarInvoice selfCarInvoice = new SelfCarInvoice();
                     SelfCarInvoice selfCarInvoice = new SelfCarInvoice();
                     BeanUtils.copyProperties(b2BInvoiceListModel,selfCarInvoice);
                     BeanUtils.copyProperties(b2BInvoiceListModel,selfCarInvoice);
-                    selfCarInvoice.setInvoiceMakeTime(DateUtil.dateFormate(selfCarInvoice.getInvoiceMakeTime()));
-                    selfCarInvoice.setExTime(DateUtil.dateFormate(selfCarInvoice.getExTime()));
+                    selfCarInvoice.setInvoiceMakeTime(DateUtil.tTimeToDate(selfCarInvoice.getInvoiceMakeTime()));
+                    selfCarInvoice.setExTime(DateUtil.tTimeToDate(selfCarInvoice.getExTime()));
                     if(selfCarInvoiceMapper.selectByTradeAndInvoiceMakeTime(selfCarInvoice)==null || selfCarInvoiceMapper.selectByTradeAndInvoiceMakeTime(selfCarInvoice).size()==0){
                     if(selfCarInvoiceMapper.selectByTradeAndInvoiceMakeTime(selfCarInvoice)==null || selfCarInvoiceMapper.selectByTradeAndInvoiceMakeTime(selfCarInvoice).size()==0){
                         selfCarInvoiceMapper.insert(selfCarInvoice);
                         selfCarInvoiceMapper.insert(selfCarInvoice);
                     }
                     }

+ 38 - 0
src/main/java/com/jkcredit/invoice/service/nocar/impl/NoCarRecServiceImpl.java

@@ -1,21 +1,59 @@
 package com.jkcredit.invoice.service.nocar.impl;
 package com.jkcredit.invoice.service.nocar.impl;
 
 
+import cn.com.taiji.sdk.model.comm.protocol.tts.card.server.CardBindQueryListToBModel;
+import cn.com.taiji.sdk.model.comm.protocol.tts.card.server.CardBindQueryListToBRequest;
+import cn.com.taiji.sdk.model.comm.protocol.tts.card.server.CardBindQueryListToBResponse;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jkcredit.invoice.mapper.customer.CustomerCarRecMapper;
 import com.jkcredit.invoice.mapper.customer.CustomerCarRecMapper;
 import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.service.nocar.NoCarRecService;
 import com.jkcredit.invoice.service.nocar.NoCarRecService;
+import com.jkcredit.invoice.service.upService.SelfCarInterface;
+import com.jkcredit.invoice.util.RespR;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 
 import java.util.List;
 import java.util.List;
 @Service
 @Service
 public class NoCarRecServiceImpl extends ServiceImpl<CustomerCarRecMapper,CustomerCarRec> implements NoCarRecService {
 public class NoCarRecServiceImpl extends ServiceImpl<CustomerCarRecMapper,CustomerCarRec> implements NoCarRecService {
     @Autowired
     @Autowired
     CustomerCarRecMapper customerCarRecMapper;
     CustomerCarRecMapper customerCarRecMapper;
+    @Autowired
+    SelfCarInterface selfCarInterface;
     @Override
     @Override
     public IPage<List<CustomerCarRec>> findByPageAndCarRec(Page page, CustomerCarRec customerCarRec) {
     public IPage<List<CustomerCarRec>> findByPageAndCarRec(Page page, CustomerCarRec customerCarRec) {
+        if("0".equals(customerCarRec.getBusinessType()) && !StringUtils.isEmpty(customerCarRec.getCarNum())){
+            //
+            List<CustomerCarRec> customerCarRecs = customerCarRecMapper.selectBySelfCarNum(customerCarRec.getCarNum());
+            if(customerCarRecs!=null && customerCarRecs.size()>0){
+                CardBindQueryListToBRequest cardBindQueryListToBRequest = new CardBindQueryListToBRequest();
+                cardBindQueryListToBRequest.setPlateNum(customerCarRecs.get(0).getCarNum());
+                cardBindQueryListToBRequest.setCompanyNum(customerCarRecs.get(0).getCompanyNum());
+                RespR<CardBindQueryListToBResponse> responseRespR = selfCarInterface.cardBindQueryListToB(cardBindQueryListToBRequest);
+                if(responseRespR.getCode() !=1){
+                    List<CardBindQueryListToBModel> cardBindQueryListToBResponses = responseRespR.getData().getResult();
+                    if(cardBindQueryListToBResponses!=null && cardBindQueryListToBResponses.size()>0){
+                        customerCarRecs.forEach(customerCarRec1 -> {
+                            boolean has = false;
+                            for(CardBindQueryListToBModel cardBindQueryListToBModel:cardBindQueryListToBResponses){
+                                if(cardBindQueryListToBModel.getCardId().equals(customerCarRec1.getEtcNum())){
+                                    has = true;
+                                }
+                            }
+                            if(!has){
+                                customerCarRec1.setRecStatus(2);
+                                customerCarRecMapper.updateETCByPrimaryKeySelective(customerCarRec1);
+                            }
+                        });
+                    }
+
+                }
+            }
+
+
+        }
         return customerCarRecMapper.selectAllByPage(page,customerCarRec);
         return customerCarRecMapper.selectAllByPage(page,customerCarRec);
     }
     }
 }
 }

+ 36 - 2
src/main/java/com/jkcredit/invoice/task/ScheduledBillTask.java

@@ -1,16 +1,23 @@
 package com.jkcredit.invoice.task;
 package com.jkcredit.invoice.task;
 
 
 import com.jkcredit.invoice.mapper.Binvoce.SelfCarApplMapper;
 import com.jkcredit.invoice.mapper.Binvoce.SelfCarApplMapper;
+import com.jkcredit.invoice.mapper.customer.CustomerCarRecMapper;
 import com.jkcredit.invoice.mapper.waybill.NoCarWaybillMapper;
 import com.jkcredit.invoice.mapper.waybill.NoCarWaybillMapper;
+import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.model.entity.invoice.SelfCarAppl;
 import com.jkcredit.invoice.model.entity.invoice.SelfCarAppl;
 import com.jkcredit.invoice.model.entity.waybill.NoCarWayBill;
 import com.jkcredit.invoice.model.entity.waybill.NoCarWayBill;
 import com.jkcredit.invoice.service.lowerService.NoCarService;
 import com.jkcredit.invoice.service.lowerService.NoCarService;
 import com.jkcredit.invoice.service.lowerService.SelfCarServiceL;
 import com.jkcredit.invoice.service.lowerService.SelfCarServiceL;
+import com.jkcredit.invoice.service.lowerService.vo.SelfCarDueQueryVo;
+import com.jkcredit.invoice.util.DateUtil;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -33,6 +40,9 @@ public class ScheduledBillTask {
 
 
     @Autowired
     @Autowired
     SelfCarServiceL selfCarService;
     SelfCarServiceL selfCarService;
+
+    @Autowired
+    CustomerCarRecMapper customerCarRecMapper;
     /**
     /**
      * 实时运单开票(每天23点开始)
      * 实时运单开票(每天23点开始)
      */
      */
@@ -69,13 +79,37 @@ public class ScheduledBillTask {
 
 
    @Scheduled(cron = "0 0 23 * * ?", zone = "Asia/Shanghai")
    @Scheduled(cron = "0 0 23 * * ?", zone = "Asia/Shanghai")
     public void getSefCarInvoice() {
     public void getSefCarInvoice() {
-        try {
+       /**
+        * 1.查询所有的etc卡
+        * 2.按照etc卡号取最近两天的发票
+        */
+       List<CustomerCarRec> lst =  customerCarRecMapper.selectAllBindEtc();
+
+       lst.stream().forEach(customerCarRec -> {
+          try {
+              SelfCarDueQueryVo selfCarDueQueryVo = new SelfCarDueQueryVo();
+              selfCarDueQueryVo.setCompanyName(customerCarRec.getCompanyName());
+              selfCarDueQueryVo.setCardId(customerCarRec.getEtcNum());
+              selfCarDueQueryVo.setCustomername(customerCarRec.getCustomerName());
+              DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+              String curr = dateFormat.format(new Date());
+              String befor = DateUtil.getDateAfterDays(curr,-1);
+              String after = DateUtil.getDateAfterDays(curr,+1);
+              selfCarDueQueryVo.setStartTime(befor+" 00:00:00");
+              selfCarDueQueryVo.setEndTime(after+"00:00:00");
+              selfCarService.getSelfCarInvoicesByTime(selfCarDueQueryVo);
+          }catch (Exception e){
+              e.printStackTrace();
+              log.info(customerCarRec.getEtcNum());
+          }
+       });
+      /*  try {
             List<SelfCarAppl> selfCarAppls = selfCarApplMapper.selectAllNoRec();
             List<SelfCarAppl> selfCarAppls = selfCarApplMapper.selectAllNoRec();
             selfCarAppls.forEach(selfCarAppl -> {
             selfCarAppls.forEach(selfCarAppl -> {
                 selfCarService.getSelfCarInvoicesByApplyIds(selfCarAppl);
                 selfCarService.getSelfCarInvoicesByApplyIds(selfCarAppl);
             });
             });
         }catch (Exception e){
         }catch (Exception e){
             e.printStackTrace();
             e.printStackTrace();
-        }
+        }*/
     }
     }
 }
 }

+ 29 - 0
src/main/java/com/jkcredit/invoice/util/DateUtil.java

@@ -4,6 +4,7 @@ import org.joda.time.DateTime;
 import org.joda.time.format.DateTimeFormat;
 import org.joda.time.format.DateTimeFormat;
 import org.joda.time.format.DateTimeFormatter;
 import org.joda.time.format.DateTimeFormatter;
 
 
+import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Calendar;
@@ -274,4 +275,32 @@ public class DateUtil {
         //正数表示在当前时间之后,负数表示在当前时间之前
         //正数表示在当前时间之后,负数表示在当前时间之前
         return hours;
         return hours;
     }
     }
+    /**
+
+     * 得到几天前的时间
+
+     */
+
+    public static String getDateAfterDays (String date, int day) {
+
+        DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        Date dateR = null;
+        try {
+             dateR = format.parse(date);
+        }catch (Exception e){
+
+        }
+
+        Calendar now = Calendar.getInstance();
+        now.setTime(dateR);
+
+        now.set(Calendar.DATE, now.get(Calendar.DATE) +day);
+
+        return format.format(now.getTime());
+
+    }
+
+    public static void main(String [] args){
+        System.out.print(getDateAfterDays("2021-10-31",1));;
+    }
 }
 }

+ 5 - 1
src/main/resources/mapper/customer/CustomerCarRecMapper.xml

@@ -20,7 +20,11 @@
     customer_name,companyNum,company_name, car_num, car_color, cust_phone, etc_num, succ_time,
     customer_name,companyNum,company_name, car_num, car_color, cust_phone, etc_num, succ_time,
     fail_time, rec_status,bussiness_type, fail_reason,inter_type
     fail_time, rec_status,bussiness_type, fail_reason,inter_type
   </sql>
   </sql>
-
+    <select id="selectAllBindEtcNoGetInvoice" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from  t_customer_carRec where rec_status=1 and bussiness_type=0
+    </select>
   <select id="selectAllByPage" resultMap="BaseResultMap">
   <select id="selectAllByPage" resultMap="BaseResultMap">
     select
     select
     <include refid="Base_Column_List" />
     <include refid="Base_Column_List" />

+ 20 - 0
src/main/resources/mapper/customer/CustomerMapper.xml

@@ -64,6 +64,26 @@
     </where>
     </where>
     order by first_sign desc
     order by first_sign desc
   </select>
   </select>
+  <select id="selectAllByPageForNoMoney" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List_app_secret" />
+    from t_customer
+    <where>
+      <if test="customer.customerName != null and customer.customerName != ''">
+        and customer_name LIKE CONCAT('%',#{customer.customerName},'%')
+      </if>
+      <if test="customer.company != null and customer.company != ''">
+        and company LIKE CONCAT('%',#{customer.company},'%')
+      </if>
+      <if test="customer.moneyUpper != null and customer.moneyUpper != ''">
+        and  #{customer.moneyUpper}>=account_balance
+      </if>
+      <if test="customer.moneyLower != null and customer.moneyLower != ''">
+        and  account_balance>=#{customer.moneyLower}
+      </if>
+    </where>
+    order by first_sign desc
+  </select>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 
     select 
     <include refid="Base_Column_List" />
     <include refid="Base_Column_List" />