gongdecai 3 gadi atpakaļ
vecāks
revīzija
58bf4391aa

+ 6 - 0
winsea-haixin-plugin-wangluohuoyun/pom.xml

@@ -91,6 +91,12 @@
             <artifactId>thumbnailator</artifactId>
             <version>0.4.8</version>
         </dependency>
+        <dependency>
+            <groupId>net.sf.json-lib</groupId>
+            <artifactId>json-lib</artifactId>
+            <version>2.4</version>
+            <classifier>jdk15</classifier>
+        </dependency>
 <!--        <dependency>-->
 <!--            <groupId>com.aliyun</groupId>-->
 <!--            <artifactId>aliyun-java-sdk-green</artifactId>-->

+ 12 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/DriverInfoController.java

@@ -1,6 +1,7 @@
 package com.yh.saas.plugin.yiliangyiyun.controller;
 
 
+import com.baomidou.mybatisplus.plugins.Page;
 import com.yh.saas.plugin.yiliangyiyun.entity.DriverInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.view.DistinguishView;
 import com.yh.saas.plugin.yiliangyiyun.service.IDriverInfoService;
@@ -23,6 +24,17 @@ public class DriverInfoController {
     @Autowired
     private IDriverInfoService driverInfoService;
 
+
+    /**
+     * 司机管理页面列表
+     * @param driverViewInfo
+     * @return
+     */
+    @GetMapping("/selectDriverInfoPage")
+    public Page<DriverInfo> selectDriverInfoPage(DriverInfo driverViewInfo){
+        return driverInfoService.selectDriverInfoPage(driverViewInfo);
+    }
+
     /**
      * 第一次认证
      * @param driverPhone

+ 10 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/DriverInfo.java

@@ -194,7 +194,17 @@ public class DriverInfo extends BaseModel<DriverInfo> {
 
     @TableField(exist = false)
     private List<DriverPayeeInfo> driverPayeeInfoList;
+    /**
+     * 查询类型
+     */
+    @TableField(exist = false)
+    private String searchType;
 
+    /**
+     * 模糊查询
+     */
+    @TableField(exist = false)
+    private String searchKeyWord;
     @Override
     protected Serializable pkVal() {
         return this.id;

+ 20 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/DriverInfoMapper.java

@@ -3,6 +3,9 @@ package com.yh.saas.plugin.yiliangyiyun.mapper;
 import com.yh.saas.plugin.yiliangyiyun.entity.DriverInfo;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  * 记录司机信息 Mapper 接口
@@ -13,4 +16,21 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
  */
 public interface DriverInfoMapper extends BaseMapper<DriverInfo> {
 
+
+
+    /**
+     * 根据条件查询司机总数
+     *
+     * @param pageView
+     * @return
+     */
+    Integer getCountByCondition(Map<String, Object> pageView);
+
+    /**
+     * 根据条件查询司机列表
+     *
+     * @param pageView
+     * @return
+     */
+    List<DriverInfo> getListByCondition(Map<String, Object> pageView);
 }

+ 3 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IDriverInfoService.java

@@ -1,5 +1,6 @@
 package com.yh.saas.plugin.yiliangyiyun.service;
 
+import com.baomidou.mybatisplus.plugins.Page;
 import com.yh.saas.plugin.yiliangyiyun.entity.DriverInfo;
 import com.baomidou.mybatisplus.service.IService;
 
@@ -42,5 +43,7 @@ public interface IDriverInfoService extends IService<DriverInfo> {
     String editInfo(DriverInfo driverInfo);
 
 
+    Page<DriverInfo> selectDriverInfoPage(DriverInfo driverViewInfo);
+
 
 }

+ 43 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/DriverInfoServiceImpl.java

@@ -1,6 +1,8 @@
 package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.google.common.collect.Lists;
 import com.yh.saas.common.support.util.IdGenerator;
 import com.yh.saas.common.support.util.StringUtils;
 import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
@@ -19,7 +21,9 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -38,6 +42,45 @@ public class DriverInfoServiceImpl extends ServiceImpl<DriverInfoMapper, DriverI
     private IDriverPayeeInfoService driverPayeeInfoService;
 
 
+
+
+    /**
+     * 司机后台管理页面
+     *
+     * @param driverViewInfo
+     * @return
+     */
+    @Override
+    public Page<DriverInfo> selectDriverInfoPage(DriverInfo driverViewInfo) {
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("startRecord", (driverViewInfo.getCurrentPage() - 1)
+                * driverViewInfo.getPageSize());
+        //公司id
+        pageView.put("compId", driverViewInfo.getCompId());
+        pageView.put("commonId", driverViewInfo.getCommonId());
+        pageView.put("searchType", driverViewInfo.getSearchType());
+        pageView.put("searchKeyWord", driverViewInfo.getSearchKeyWord());
+        pageView.put("pageSize", driverViewInfo.getPageSize());
+        pageView.put("currentPage", driverViewInfo.getCurrentPage());
+        // 查询司机总数
+        Integer dataCount = baseMapper.getCountByCondition(pageView);
+        List<DriverInfo> dataList = baseMapper.getListByCondition(pageView);
+        dataList.forEach(driverViewInfo1 -> {
+            driverViewInfo1.setDriverCarInfoList(driverCarInfoService.selectList(new EntityWrapper<DriverCarInfo>()
+                    .eq(DriverCarInfo.QueryFiles.DRIVER_ID, driverViewInfo1.getId())
+                    .eq(DriverCarInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0)));
+            driverViewInfo1.setDriverPayeeInfoList(driverPayeeInfoService.selectList(new EntityWrapper<DriverPayeeInfo>()
+                    .eq(DriverPayeeInfo.QueryFiles.DRIVER_ID, driverViewInfo1.getId())
+                    .eq(DriverPayeeInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0)));
+        });
+        Page<DriverInfo> page = new Page<>();
+        page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        page.setTotal(dataCount == null ? 0 : dataCount);
+        page.setCurrent(driverViewInfo.getCurrentPage());
+        page.setSize(driverViewInfo.getPageSize());
+        return page;
+    }
+
     /**
      * 第一次认证
      * @param driverPhone

+ 62 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/util/EntCoordUtil.java

@@ -0,0 +1,62 @@
+package com.yh.saas.plugin.yiliangyiyun.util;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.text.DecimalFormat;
+
+import net.sf.json.JSONObject;
+
+public class EntCoordUtil {
+
+    static String AK = "VL95Z7pGgq12vPtgKmgdAVAG3mHA8ZEC"; // 百度地图密钥
+
+//    public static void main(String[] args) {
+//        String dom = "北京王府井";
+//        String coordinate = getCoordinate(dom);
+//        System.out.println("'" + dom + "'的经纬度为:" + coordinate);
+//        // System.err.println("######同步坐标已达到日配额6000限制,请明天再试!#####");
+//    }
+
+    // 调用百度地图API根据地址,获取坐标
+    public static String getCoordinate(String address) {
+        if (address != null && !"".equals(address)) {
+            address = address.replaceAll("\\s*", "").replace("#", "栋");
+            String url = "http://api.map.baidu.com/geocoder/v2/?address=" + address + "&output=json&ak=" + AK;
+            String json = loadJSON(url);
+            if (json != null && !"".equals(json)) {
+                JSONObject obj = JSONObject.fromObject(json);
+                if ("0".equals(obj.getString("status"))) {
+                    double lng = obj.getJSONObject("result").getJSONObject("location").getDouble("lng"); // 经度
+                    double lat = obj.getJSONObject("result").getJSONObject("location").getDouble("lat"); // 纬度
+                    DecimalFormat df = new DecimalFormat("#.######");
+                    return df.format(lng) + "," + df.format(lat);
+                }
+            }
+        }
+        return null;
+    }
+
+    public static String loadJSON(String url) {
+        StringBuilder json = new StringBuilder();
+        try {
+            URL oracle = new URL(url);
+            URLConnection yc = oracle.openConnection();
+            BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream(), "UTF-8"));
+            String inputLine = null;
+            while ((inputLine = in.readLine()) != null) {
+                json.append(inputLine);
+            }
+            in.close();
+        } catch (MalformedURLException e) {} catch (IOException e) {}
+        return json.toString();
+    }
+
+    // 来自stackoverflow的MD5计算方法,调用了MessageDigest库函数,并把byte数组结果转换成16进制
+    /*
+     * public String MD5(String md5) { try { java.security.MessageDigest md = java.security.MessageDigest .getInstance("MD5"); byte[] array = md.digest(md5.getBytes()); StringBuffer sb = new StringBuffer(); for (int i = 0; i < array.length; ++i) { sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100) .substring(1, 3)); } return sb.toString(); } catch (java.security.NoSuchAlgorithmException e) {
+     * } return null; }
+     */
+}

+ 104 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/DriverCarInfoMapper.xml

@@ -1,5 +1,109 @@
 <?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.yh.saas.plugin.yiliangyiyun.mapper.DriverCarInfoMapper">
+    <!-- 获得司机总数 -->
+    <select id="getCountByCondition" parameterType="Map" resultType="java.lang.Integer">
+        select
+        count(1)
+        from(
+        SELECT
+        d.id
+        FROM driver_view_info d
+        left join driver_car_info c on d.id=c.driver_id
+        left join driver_payee_info p on d.id=p.driver_id
+        WHERE
+        d.delete_flag = '0'
+        <if test="residentCityProvincial != null and residentCityProvincial != ''">
+            AND d.resident_city_provincial = #{residentCityProvincial}
+        </if>
+        <if test="residentCityMunicipal != null and residentCityMunicipal != ''">
+            AND d.resident_city_municipal = #{residentCityMunicipal}
+        </if>
+        <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND d.authentication_status_key = '1'
+            </if>
+            <if test="searchType == 2">
+                AND d.authentication_status_key = '7'
+            </if>
+        </if>
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(d.driver_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(d.driver_phone) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(d.number_card) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(c.car_number) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        <if test="pcFlag != null and pcFlag != ''">
+            <if test="pcFlag == 0">
+                AND d.common_id = #{commonId}
+            </if>
+            <if test="pcFlag == 1">
+                AND d.comp_id = #{compId}
+            </if>
+        </if>
+        group by
+        d.id
+        ) t
 
+    </select>
+    <!-- 司机列表查询 -->
+    <select id="getListByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.DriverInfo">
+        SELECT
+        d.id,
+        d.driver_name as driverName,
+        d.cover,
+        d.number_card as numberCard,
+        d.driver_phone as driverPhone,
+        d.resident_city_provincial as residentCityProvincial,
+        d.resident_city_municipal as residentCityMunicipal,
+        d.disable_status_flag as disableStatusFlag,
+        d.authentication_status_key as authenticationStatusKey,
+        d.authentication_status as authenticationStatus,
+        d.disable_reasons as disableReasons,
+        d.address_url as addressUrl,
+        d.card_address_url as cardAddressUrl,
+        p.payee_address_url as payeeAddressUrl,
+        p.card_address_url as cardAddressUrl1,
+        d.update_date as updateDate
+        FROM driver_view_info d
+        left join driver_car_info c on d.id=c.driver_id
+        left join driver_payee_info p on d.id=p.driver_id
+        WHERE
+        d.delete_flag = '0'
+        <if test="residentCityProvincial != null and residentCityProvincial != ''">
+            AND d.resident_city_provincial = #{residentCityProvincial}
+        </if>
+        <if test="residentCityMunicipal != null and residentCityMunicipal != ''">
+            AND d.resident_city_municipal = #{residentCityMunicipal}
+        </if>
+        <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND d.authentication_status_key = '1'
+            </if>
+            <if test="searchType == 2">
+                AND d.authentication_status_key = '7'
+            </if>
+        </if>
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(d.driver_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(d.driver_phone) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(d.number_card) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(c.car_number) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        <if test="pcFlag != null and pcFlag != ''">
+            <if test="pcFlag == 0">
+                AND d.common_id = #{commonId}
+            </if>
+            <if test="pcFlag == 1">
+                AND d.comp_id = #{compId}
+            </if>
+        </if>
+        group by
+        d.id
+        ORDER BY d.update_date DESC
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
 </mapper>

+ 80 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/DriverInfoMapper.xml

@@ -2,4 +2,84 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.DriverInfoMapper">
 
+
+    <!-- 获得司机总数 -->
+    <select id="getCountByCondition" parameterType="Map" resultType="java.lang.Integer">
+    select
+    count(1)
+    FROM driver_info
+    WHERE
+    delete_flag = '0'
+    <if test="searchType != null and searchType != ''">
+        <if test="searchType == 1">
+            AND authentication_status_key = '1'
+        </if>
+        <if test="searchType == 2">
+            AND authentication_status_key = '3'
+        </if>
+        <if test="searchType == 3">
+            AND authentication_status_key = '5'
+        </if>
+        <if test="searchType == 4">
+            AND authentication_status_key = '7'
+        </if>
+    </if>
+    <if test="searchKeyWord != null and searchKeyWord != ''">
+        AND (lower(driver_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+        OR lower(driver_phone) like lower(CONCAT('%',#{searchKeyWord},'%'))
+        OR lower(number_card) like lower(CONCAT('%',#{searchKeyWord},'%'))
+        OR lower(number_card) like lower(CONCAT('%',#{searchKeyWord},'%')))
+    </if>
+    </select>
+
+
+
+    <!-- 司机列表查询 -->
+    <select id="getListByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.DriverInfo">
+        SELECT
+        id,
+        driver_name as driverName,
+        cover,
+        number_card as numberCard,
+        driver_phone as driverPhone,
+        resident_city_provincial as residentCityProvincial,
+        resident_city_municipal as residentCityMunicipal,
+        disable_status_flag as disableStatusFlag,
+        authentication_status_key as authenticationStatusKey,
+        authentication_status as authenticationStatus,
+        disable_reasons as disableReasons,
+        address_url as addressUrl,
+        card_address_url as cardAddressUrl,
+    --         payee_address_url as payeeAddressUrl,
+    --         card_address_url as cardAddressUrl1,
+        update_date as updateDate
+        FROM driver_view_info
+        WHERE
+        delete_flag = '0'
+        <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND authentication_status_key = '1'
+            </if>
+            <if test="searchType == 2">
+                AND authentication_status_key = '3'
+            </if>
+            <if test="searchType == 3">
+                AND authentication_status_key = '5'
+            </if>
+            <if test="searchType == 4">
+                AND authentication_status_key = '7'
+            </if>
+        </if>
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(driver_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(driver_phone) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(number_card) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(number_card) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        ORDER BY d.update_date DESC
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
 </mapper>