Ver Fonte

Merge branch 'master' of https://gitee.com/antai-wuliu/ANTAI-API

zhangym há 1 ano atrás
pai
commit
1974212d0a

+ 1 - 0
.gitignore

@@ -6,6 +6,7 @@ rebel.xml
 out/artifacts/
 dil-api.iml
 src/test
+src/main/resources/application-dev2.yml
 # Compiled class file
 *.class
 

+ 7 - 0
src/main/java/com/steerinfo/DilApplicationMain.java

@@ -1,11 +1,13 @@
 package com.steerinfo;
 
+import feign.Retryer;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.servlet.ServletComponentScan;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.annotation.Bean;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
 /**
@@ -23,4 +25,9 @@ public class DilApplicationMain {
     public static void main(String[] args) {
         SpringApplication.run(DilApplicationMain.class,args);
     }
+    @Bean
+    public Retryer feignRetryer() {
+        // 这里使用一个永不重试的Retryer
+        return Retryer.NEVER_RETRY;
+    }
 }

+ 9 - 3
src/main/java/com/steerinfo/dil/config/RequestFilter.java

@@ -36,6 +36,7 @@ public class RequestFilter implements Filter {
            String dilCompanyList = httpRequest.getHeader("dilCompanyList");
            String rootCompanyMap = httpRequest.getHeader("rootCompanyMap");
            String accessToken = httpRequest.getHeader("accessToken");
+           String urlFlag = httpRequest.getHeader("urlFlag");
            //获取cookie用户数据
            if (cookies != null && cookies.length > 0) {
                for (Cookie cookie : cookies) {
@@ -53,8 +54,10 @@ public class RequestFilter implements Filter {
                        rootCompanyMap = URLDecoder.decode(cookie.getValue(),"utf-8");
                    } else if (cookie.getName().equals("accessToken") && accessToken == null) {
                        accessToken = URLDecoder.decode(cookie.getValue(), "utf-8");
+                   }else if (cookie.getName().equals("urlFlag") && urlFlag == null) {
+                       urlFlag = URLDecoder.decode(cookie.getValue(), "utf-8");
                    }
-                   else if (userId != null && userName != null && orgCode != null && roleCodes != null && dilCompanyList != null && rootCompanyMap != null) {
+                   else if (userId != null && userName != null && orgCode != null && roleCodes != null && dilCompanyList != null && rootCompanyMap != null && urlFlag != null) {
                        //都查到了,退出
                        break;
                    }
@@ -66,6 +69,7 @@ public class RequestFilter implements Filter {
                roleCodes = URLDecoder.decode(roleCodes, "utf-8");
                dilCompanyList = URLDecoder.decode(dilCompanyList,"UTF-8");
                rootCompanyMap = URLDecoder.decode(rootCompanyMap,"utf-8");
+               urlFlag = URLDecoder.decode(urlFlag,"utf-8");
                //System.out.println(dilCompanyList.getClass().toString());
            }catch (Exception e){}
            httpRequest.setAttribute("userId", userId);
@@ -77,6 +81,7 @@ public class RequestFilter implements Filter {
            httpRequest.setAttribute("dilCompanyList",dilCompanyListObject);
            Object rootCompanyMapObject = JSONObject.parse(rootCompanyMap);
            httpRequest.setAttribute("rootCompanyMap",rootCompanyMapObject);
+           httpRequest.setAttribute("urlFlag",urlFlag);
            //获取RequestBody数据
            BufferedReader streamReader = new BufferedReader(new InputStreamReader(request.getInputStream(), "UTF-8"));
            StringBuilder strBuilder = new StringBuilder();
@@ -94,8 +99,9 @@ public class RequestFilter implements Filter {
                params.put("dilCompanyList",dilCompanyListObject);
                params.put("rootCompanyMap",rootCompanyMapObject);
                params.put("accessToken",accessToken);
-               log.info("url:"+url);
-               log.info("params:"+params.toJSONString());
+               params.put("urlFlag",urlFlag);
+               log.debug("url:"+url);
+               log.debug("params:"+params.toJSONString());
                //将新的RequestBody写入新的请求对象保存
                ServletRequest requestWrapper = new RequestWrapper(httpRequest, params.toJSONString());
                chain.doFilter(requestWrapper, response);

+ 13 - 3
src/main/java/com/steerinfo/dil/controller/BackgroundProcessingController.java

@@ -40,7 +40,7 @@ public class BackgroundProcessingController extends BaseRESTfulController {
 
     @ApiOperation("登录接口")
     @PostMapping("bpLogin")
-    public Map<String,Object> bpLogin(@RequestParam String loginName, @RequestParam String password,  @RequestParam String app_code) {
+    public Map<String,Object> bpLogin(@RequestParam String loginName, @RequestParam String password,  @RequestParam String app_code,@RequestParam String urlFlag) {
         Map<String,Object> resMap = ssoUtil.individualLogin(loginName,password,app_code);
         if("succeed".equals(resMap.get("status"))) {
             Map<String, Object> dataMap = (Map<String, Object>) resMap.get("data");
@@ -48,9 +48,19 @@ public class BackgroundProcessingController extends BaseRESTfulController {
             // 根据用户名去查询该用户绑定的公司及下属公司
             List<Map<String, Object>> companyList = backgroundProcessingMapper.getCompanyList(loginName);
             Map<String,Object> rootCompanyMap = backgroundProcessingMapper.getCompanyRootMap(loginName);
-            //List<Map<String,Object>> currentCompanyList = backgroundProcessingMapper.getCurrentCompanyList(loginName);
             userInfo.put("dilCompanyList", companyList);
-            userInfo.put("rootCompanyMap",rootCompanyMap);
+            if (rootCompanyMap != null && rootCompanyMap.get("isListed") != null) {
+                userInfo.put("rootCompanyMap",rootCompanyMap);
+            }
+            if (urlFlag != null && urlFlag != "" && rootCompanyMap != null && !urlFlag.equals(rootCompanyMap.get("isListed"))) {
+                resMap.put("status","failed");
+                resMap.put("message","账号未在该平台注册,请检查账号");
+                resMap.put("resultMessage","账号未在该平台注册,请检查账号");
+                resMap.put("code","500");
+                return resMap;
+            }
+            //List<Map<String,Object>> currentCompanyList = backgroundProcessingMapper.getCurrentCompanyList(loginName);
+
             //userInfo.put("currentCompanyList",currentCompanyList);
             // 根据查询到的公司ID
             //System.out.println(userInfo);

+ 7 - 0
src/main/java/com/steerinfo/dil/controller/UniversalController.java

@@ -117,6 +117,13 @@ public class UniversalController extends BaseRESTfulController {
         return success(list);
     }
 
+    @ApiModelProperty(value = "边输边查车牌号生产")
+    @PostMapping("/getCapacityByLikeSc")
+    public RESTfulResult getCapacityByLikeSc(@RequestBody(required = false) Map<String,Object> map) {
+        List<Map<String, Object>> list = universalMapper.getCapacityByLikeSc(map);
+        return success(list);
+    }
+
     @ApiModelProperty(value = "边输边查快捷需求code")
     @PostMapping("/getCategoryCodeByLike")
     public RESTfulResult getCategoryCodeByLike(@RequestBody(required = false) Map<String,Object> map) {

+ 1 - 0
src/main/java/com/steerinfo/dil/mapper/UniversalMapper.java

@@ -34,6 +34,7 @@ public interface UniversalMapper {
     List<Map<String, Object>> getPersonnelByLike(Map<String, Object> map);
 
     List<Map<String, Object>> getCapacityByLike(Map<String, Object> map);
+    List<Map<String, Object>> getCapacityByLikeSc(Map<String, Object> map);
 
     List<Map<String, Object>> getTransRangeByLike(Map<String, Object> map);
     List<Map<String, Object>> getLineByLike(Map<String, Object> map);

+ 0 - 73
src/main/resources/application-dev2.yml

@@ -1,73 +0,0 @@
-#测试环境配置文件
-spring:
-  datasource:
-    url: jdbc:oracle:thin:@172.16.90.214:1521/gxmes
-    password: gxmestest
-    username: gxmestest
-    driver-class-name: oracle.jdbc.OracleDriver
-  application:
-    name: antai-api
-  mvc:
-    async:
-      request-timeout: 15000
-
-server:
-  port: 8080
-  tomcat:
-    max-threads: 1000
-    accept-count: 800
-    basedir: /tomcat/baseDir
-eureka:
-  client:
-    registerWithEureka: false
-    fetchRegistry: false
-
-openfeign:
-  ColumnDataFeign:
-    url: ${COLUMNDATAFEIGN_URL:172.16.90.214:8083}
-  AmsFeign:
-    url: ${AMSFEIGN_URL:localhost:8079}
-  BmsFeign:
-    url: ${BMSFEIGN_URL:localhost:8078}
-  TmsFeign:
-    url: ${TMSFEIGN_URL:localhost:8086}
-  WMSFeign:
-    url: ${WMSFEIGN_URL:localhost:8093}
-  OMSFeign:
-    url: ${OMSFEIGN_URL:localhost:8095}
-  RmsFeign:
-    url: ${RMSFEIGN_URL:localhost:8060}
-  IntegrationFeign:
-    url: ${INTEGRATIONFEIGN_URL:localhost:8066}
-  OTMSFeign:
-    url: ${OTMSFEIGN_URL:localhost:8038}
-  EmsFeign:
-    url: ${TMSFEIGN_URL:localhost:8096}
-  SSOFeign:
-    url: ${SSOFEIGN_URL:172.16.90.214:9001}
-  WebSocketFeign:
-    url: ${WEBSOCKETFEIGN_URL:localhost:8000}
-  REPORTFeign:
-    url: ${REPORTFEIGN_URL:localhost:8055}
-
-
-#远程调用
-feign:
-  hystrix:
-    enabled: false #开启熔断,熔断时间和feign超时时间必须一致,否则时间短的生效
-  client:
-    config:
-      default:  #默认配置,连接时间要短,读取时间要长
-        connectTimeout: 1000 #单位毫秒
-        readTimeout: 30000 #单位毫秒
-#熔断器
-hystrix:
-  command:
-    default:
-      execution:
-        isolation:
-          thread:
-            timeoutInMilliseconds: 15000 #设置熔断时间,单位毫秒
-          strategy: SEMAPHORE
-          semaphore:
-            maxConcurrentRequests: 1

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

@@ -1,7 +1,7 @@
 api.version: api/v1
 spring:
   profiles:
-    include: ${SPRING_PROFILES:dev}
+    include: ${SPRING_PROFILES:dev2}
   jackson:
     date-format: yyyy-MM-dd HH:mm:ss
     time-zone: GMT+8

+ 3 - 1
src/main/resources/com/steerinfo/dil/mapper/BackgroundProcessingMapper.xml

@@ -50,7 +50,8 @@
     <select id="getCompanyRootMap" resultType="java.util.Map">
         SELECT DISTINCT
             rc.company_id "rootCompanyId",
-            rc.COMPANY_NAME "rootCompanyName"
+            rc.COMPANY_NAME "rootCompanyName",
+            rc.IS_LISTED    "isListed"
         FROM
             RMS_COMPANY RC START WITH RC.COMPANY_ID IN (
             SELECT
@@ -61,6 +62,7 @@
             WHERE
                 RPC.DELETED = 0
               AND RP.PERSONNEL_JOB_NUMBER = #{userName}
+
         ) CONNECT BY PRIOR rc.PARENT_COMPANY_ID = RC.COMPANY_ID
         ORDER BY LEVEL DESC FETCH NEXT 1 ROW ONLY
     </select>

+ 4 - 1
src/main/resources/com/steerinfo/dil/mapper/CommonMapper.xml

@@ -41,7 +41,7 @@
         </if>
     </sql>
     <sql id="rootCompanyFilter">
-        <if test="rootCompanyMap != null and (rootCompanyMap.rootCompanyName.contains('安泰') or rootCompanyMap.rootCompanyName.contains('新泰'))">
+        <if test="rootCompanyMap != null and urlFlag != null and urlFlag != 'null' and urlFlag != ''">
             AND "rootCompanyId" = #{rootCompanyMap.rootCompanyId}
         </if>
     </sql>
@@ -88,6 +88,9 @@
                     <when test="item.contains('admin')">
                         1 = 1
                     </when>
+                    <when test="item.contains('siji)">
+                        1 = 1
+                    </when>
                     <otherwise>
                         1 != 1
                     </otherwise>

+ 169 - 5
src/main/resources/com/steerinfo/dil/mapper/UniversalMapper.xml

@@ -92,7 +92,6 @@
         RC.COMPANY_ID "id",
         RC.COMPANY_ID   "key",
         RC.COMPANY_ID "value",
-        RC.COMPANY_ID "carrierId",
         <if test="companyType==null">
             RC.COMPANY_TYPE || '-' ||
         </if>
@@ -151,6 +150,9 @@
             <if test="index!=null and index!=''">
                 AND REGEXP_LIKE(RC.COMPANY_NAME, #{index})
             </if>
+            <if test="isListed !=null and isListed!=''">
+                AND RC.is_Listed IS NOT NULL
+            </if>
         </where>
         <if test="noRow == null">
             order by LENGTH(company_name)
@@ -165,7 +167,6 @@
             RC.COMPANY_ID "id",
             RC.COMPANY_ID   "key",
             RC.COMPANY_ID "value",
-            RC.COMPANY_ID "carrierId",
             <if test="companyType==null">
                 RC.COMPANY_TYPE || '-' ||
             </if>
@@ -410,6 +411,148 @@
     </select>
 
     <select id="getCapacityByLike" resultType="java.util.Map">
+        select * from (
+        select * from (
+        SELECT DISTINCT
+        RCA .CAPACITY_ID "capacityId",
+        RCA .CAPACITY_ID "id",
+        RCA .CAPACITY_ID "value",
+        CASE WHEN RCA.REMARK1 is null
+        then RCA.CAPACITY_NUMBER
+        else RCA.REMARK1
+        end "label",
+        CASE WHEN RCA.REMARK1 is null
+        then RCA.CAPACITY_NUMBER
+        else RCA.REMARK1
+        end "text",
+        CASE WHEN RCA.REMARK1 is null
+        then RCA.CAPACITY_NUMBER
+        else RCA.REMARK1
+        end "remark1",
+        CASE WHEN RCA.REMARK1 is null
+        then RCA.CAPACITY_NUMBER
+        else RCA.REMARK1
+        end "capacityNumber",
+        (case
+        when oto.capacity_id is null then '空闲'
+        when oto.deleted != '2' and oto.capacity_id is not null then '已派'
+        end) "status",
+        'capacityNumber' "prop"
+        <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
+            ,NVL(T ."countNumber",0) "countNumber"
+        </if>
+        FROM
+        RMS_CAPACITY RCA
+        LEFT JOIN RMS_CAPACITY_CARRIER RCC ON RCA .CAPACITY_ID = RCC .CAPACITY_ID
+        LEFT JOIN RMS_COMPANY RC ON RC .COMPANY_ID = RCC .COMPANY_ID
+        LEFT JOIN RMS_CAPACITY_TYPE RCT ON RCA.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
+        left join oms_trans_order oto
+        on RCA.capacity_id = oto.capacity_id
+        and oto.deleted != 2
+        <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
+            LEFT JOIN (
+                SELECT CAPACITY_ID "capacityId",
+                COUNT( CAPACITY_ID ) "countNumber"
+                FROM OMS_TRANS_ORDER
+                <where>
+                    <if test="driverId!=null and driverId!=''">
+                       AND (DRIVER_ID = #{driverId}  OR DRIVER_ID2 = #{driverId})
+                    </if>
+                    <if test="driverId2!=null and driverId2!=''">
+                       AND DRIVER_ID = #{driverId2}  OR DRIVER_ID2 = #{driverId2}
+                    </if>
+                </where>
+                GROUP BY CAPACITY_ID
+            ) T ON T."capacityId" = RCA .CAPACITY_ID
+        </if>
+        WHERE RCA .DELETED = 0
+        <if test="orgCode!=null and orgCode !='' and roleCodes.contains('chengYunShang')">
+                AND RC.SSO_CODE = #{orgCode}
+            </if>
+            <if test="capacityType != null and capacityType != '' ">
+                AND RCT.CAPACITY_TYPE_NAME = #{capacityType}
+            </if>
+            <if test="capacityType == null">
+                AND RCT.CAPACITY_TYPE_NAME != '火车'
+            </if>
+            <if test="index!=null and index!=''">
+                AND REGEXP_LIKE(
+                    CASE WHEN RCA.REMARK1 is null
+                    then RCA.CAPACITY_NUMBER
+                    else RCA.REMARK1
+                    end, #{index}
+                )
+            </if>
+            <if test="capacityId!=null and capacityId!=''">
+                AND RCA .CAPACITY_ID = #{capacityId}
+            </if>
+            <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
+                ORDER BY "countNumber" DESC
+            </if>
+            FETCH NEXT 10 ROWS ONLY
+        )
+        <if test="id!=null and id.size>0">
+            UNION
+            SELECT DISTINCT
+            RCA .CAPACITY_ID "capacityId",
+            RCA .CAPACITY_ID "id",
+            RCA .CAPACITY_ID "value",
+            CASE WHEN RCA.REMARK1 is null
+            then RCA.CAPACITY_NUMBER
+            else RCA.REMARK1
+            end "label",
+            CASE WHEN RCA.REMARK1 is null
+            then RCA.CAPACITY_NUMBER
+            else RCA.REMARK1
+            end "text",
+            CASE WHEN RCA.REMARK1 is null
+            then RCA.CAPACITY_NUMBER
+            else RCA.REMARK1
+            end "remark1",
+            RCA.CAPACITY_NUMBER "capacityNumber",
+            (case
+            when oto.capacity_id is null then '空闲'
+            when oto.deleted != '2' and oto.capacity_id is not null then '已派'
+            end) "status",
+            'capacityNumber' "prop"
+            <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
+                ,NVL(T ."countNumber",0) "countNumber"
+            </if>
+            FROM RMS_CAPACITY RCA
+            LEFT JOIN RMS_CAPACITY_CARRIER RCC ON RCA .CAPACITY_ID = RCC .CAPACITY_ID
+            LEFT JOIN RMS_COMPANY RC ON RC .COMPANY_ID = RCC .COMPANY_ID
+            LEFT JOIN RMS_CAPACITY_TYPE RCT ON RCA.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
+            left join oms_trans_order oto
+            on RCA.capacity_id = oto.capacity_id
+            and oto.deleted != 2
+            <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
+                LEFT JOIN (
+                SELECT CAPACITY_ID "capacityId",
+                COUNT( CAPACITY_ID ) "countNumber"
+                FROM OMS_TRANS_ORDER
+                <where>
+                    <if test="driverId!=null and driverId!=''">
+                        AND (DRIVER_ID = #{driverId}  OR DRIVER_ID2 = #{driverId})
+                    </if>
+                    <if test="driverId2!=null and driverId2!=''">
+                        AND DRIVER_ID = #{driverId2}  OR DRIVER_ID2 = #{driverId2}
+                    </if>
+                </where>
+                GROUP BY CAPACITY_ID
+                ) T ON T."capacityId" = RCA .CAPACITY_ID
+            </if>
+            WHERE RCA .CAPACITY_ID in
+            <foreach collection="id" item="item" open="(" close=")" separator="," >
+                #{item}
+            </foreach>
+        </if>
+    )
+    <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
+        ORDER BY "countNumber" DESC
+    </if>
+    </select>
+
+    <select id="getCapacityByLikeSc" resultType="java.util.Map">
         select * from (
         select * from (
         SELECT DISTINCT
@@ -418,7 +561,13 @@
         RCA .CAPACITY_ID "value",
         RCA .CAPACITY_NUMBER "label",
         RCA .CAPACITY_NUMBER "text",
+        RCA .REMARK1 "remark1",
         RCA.CAPACITY_NUMBER "capacityNumber",
+        (case
+        when oto.capacity_id is null then '空闲'
+        when oto.deleted != '2' and oto.capacity_id is not null then '已派'
+        when oto.deleted = '2' and oto.capacity_id is not null then '空闲'
+        end) "status",
         'capacityNumber' "prop"
         <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
             ,NVL(T ."countNumber",0) "countNumber"
@@ -428,6 +577,8 @@
         LEFT JOIN RMS_CAPACITY_CARRIER RCC ON RCA .CAPACITY_ID = RCC .CAPACITY_ID
         LEFT JOIN RMS_COMPANY RC ON RC .COMPANY_ID = RCC .COMPANY_ID
         LEFT JOIN RMS_CAPACITY_TYPE RCT ON RCA.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
+        left join oms_trans_order oto
+        on RCA.capacity_id = oto.capacity_id
         <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
             LEFT JOIN (
                 SELECT CAPACITY_ID "capacityId",
@@ -455,7 +606,12 @@
                 AND RCT.CAPACITY_TYPE_NAME != '火车'
             </if>
             <if test="index!=null and index!=''">
-                AND REGEXP_LIKE(RCA .CAPACITY_NUMBER, #{index})
+                AND REGEXP_LIKE(
+                CASE WHEN RCA.REMARK1 is null
+                then RCA .CAPACITY_NUMBER
+                else RCA.REMARK1
+                end, #{index}
+                )
             </if>
             <if test="capacityId!=null and capacityId!=''">
                 AND RCA .CAPACITY_ID = #{capacityId}
@@ -471,9 +627,15 @@
             RCA .CAPACITY_ID "capacityId",
             RCA .CAPACITY_ID "id",
             RCA .CAPACITY_ID "value",
-            RCA .CAPACITY_NUMBER "label",
-            RCA .CAPACITY_NUMBER "text",
+            RCA .REMARK1 "label",
+            RCA .REMARK1 "text",
+            RCA .REMARK1 "remark1",
             RCA.CAPACITY_NUMBER "capacityNumber",
+            (case
+            when oto.capacity_id is null then '空闲'
+            when oto.deleted != '2' and oto.capacity_id is not null then '已派'
+            when oto.deleted = '2' and oto.capacity_id is not null then '空闲'
+            end) "status",
             'capacityNumber' "prop"
             <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
                 ,NVL(T ."countNumber",0) "countNumber"
@@ -482,6 +644,8 @@
             LEFT JOIN RMS_CAPACITY_CARRIER RCC ON RCA .CAPACITY_ID = RCC .CAPACITY_ID
             LEFT JOIN RMS_COMPANY RC ON RC .COMPANY_ID = RCC .COMPANY_ID
             LEFT JOIN RMS_CAPACITY_TYPE RCT ON RCA.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
+            left join oms_trans_order oto
+            on RCA.capacity_id = oto.capacity_id
             <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
                 LEFT JOIN (
                 SELECT CAPACITY_ID "capacityId",