Quellcode durchsuchen

'销售计费详单'

HUJIANGUO vor 3 Jahren
Ursprung
Commit
ae8fbe80b2

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

@@ -57,7 +57,7 @@ public interface BmstruckDetailsOrderMapper extends IBaseMapper<BmstruckDetailsO
      * 得到价格id
      * @return
      */
-    List<Map<String, Object>> getPriceId();
+    Map<String, Object> getPriceId(BigDecimal orderId);
 
     /**
      * 得到价格

+ 1 - 1
src/main/java/com/steerinfo/dil/service/IBmstruckDetailsOrderService.java

@@ -51,7 +51,7 @@ public interface IBmstruckDetailsOrderService {
      * 得到价格id
      * @return
      */
-    List<Map<String, Object>> getPriceId();
+    Map<String, Object> getPriceId(BigDecimal orderId);
 
     /**
      * 得到价格

+ 26 - 28
src/main/java/com/steerinfo/dil/service/impl/BmstruckDetailsOrderServiceImpl.java

@@ -62,9 +62,8 @@ public class BmstruckDetailsOrderServiceImpl implements IBmstruckDetailsOrderSer
         // 得到最大id
         BigDecimal detailsId = selectMaxId();
         String detailsNo = noUtil.setResultNo("QYXD", detailsId);
-        List<Map<String, Object>> list = getPriceId();
-        Map<String, Object> map = list.get(0);
-        BigDecimal priceId = (BigDecimal) map.get("priceId");
+        Map<String,Object> priceMap = getPriceId(orderId);
+        BigDecimal priceId = (BigDecimal) priceMap.get("priceId");
         BigDecimal detailsAmountOld = generateTruckFees(orderId);
         Double amount = detailsAmountOld.doubleValue();
         DecimalFormat df = new DecimalFormat("0.00");
@@ -76,7 +75,7 @@ public class BmstruckDetailsOrderServiceImpl implements IBmstruckDetailsOrderSer
             BigDecimal purchaseOrderId = getFormulaMembers(orderId);
             bmstruckDetailsOrder.setPurchaseOrderId(purchaseOrderId);
         }
-        if (orderType.intValue() == 1) {
+        if (orderType.intValue() == 2) {
             bmstruckDetailsOrder.setWetherToStatement(new BigDecimal(0));
         }
         bmstruckDetailsOrder.setDetailsId(detailsId);
@@ -92,13 +91,13 @@ public class BmstruckDetailsOrderServiceImpl implements IBmstruckDetailsOrderSer
         bmstruckDetailsOrder.setUpdateUsername("admin");
         bmstruckDetailsOrder.setInsertUpdateRemark("无");
         int code = bmstruckDetailsOrderMapper.insertSelective(bmstruckDetailsOrder);
-        // 调用金蝶接口
-        if (orderType.intValue() == 3) {
-            Map<String, Object> input = joinApiFeign.getPurchaseDetailsOrder(detailsId.intValue());
-            Map<String, Object> totalMap = easUtil.getTotalMap();
-            totalMap.put("input",input);
-            joinApiFeign.WSFaceWay(totalMap);
-        }
+//        // 调用金蝶接口
+//        if (orderType.intValue() == 3) {
+//            Map<String, Object> input = joinApiFeign.getPurchaseDetailsOrder(detailsId.intValue());
+//            Map<String, Object> totalMap = easUtil.getTotalMap();
+//            totalMap.put("input",input);
+//            joinApiFeign.WSFaceWay(totalMap);
+//        }
         return code;
     }
 
@@ -145,8 +144,8 @@ public class BmstruckDetailsOrderServiceImpl implements IBmstruckDetailsOrderSer
      * @return
      */
     @Override
-    public List<Map<String, Object>> getPriceId() {
-        return bmstruckDetailsOrderMapper.getPriceId();
+    public Map<String, Object> getPriceId(BigDecimal orderId) {
+        return bmstruckDetailsOrderMapper.getPriceId(orderId);
     }
 
     /**
@@ -212,9 +211,8 @@ public class BmstruckDetailsOrderServiceImpl implements IBmstruckDetailsOrderSer
      */
     public BigDecimal generateTruckFees(BigDecimal orderId) throws Exception {
         BigDecimal orderType = bmstruckDetailsOrderMapper.getOrderType(orderId);
-        List<Map<String, Object>> priceList = getPriceId();
-        Map<String, Object> map = priceList.get(0);
-        BigDecimal priceId = (BigDecimal) map.get("priceId");
+        Map<String, Object> priceMap = getPriceId(orderId);
+        BigDecimal priceId = (BigDecimal) priceMap.get("priceId");
         BigDecimal priceValue = getPriceValue(priceId);
         BigDecimal netWeight = getNetWeight(orderId);
         // 得到计费公式
@@ -226,24 +224,24 @@ public class BmstruckDetailsOrderServiceImpl implements IBmstruckDetailsOrderSer
             formula_string = formula_string.replace("到厂计量湿吨",netWeight.toString())
                     .replace("单价",priceValue.toString());
         }
-        if (orderType.intValue() == 1) {
-            BigDecimal distance = new BigDecimal(101);
+        if (orderType.intValue() == 2) {
+//            BigDecimal distance = new BigDecimal(101);
             // 得到销售汽运计费公式
-            if (distance.intValue() >= 91 || distance.intValue() <= 109) {
+//            if (distance.intValue() >= 91 || distance.intValue() <= 109) {
                 // 得到销售10km差距内的汽运计费公式
                 formula_string = bmstruckFormulaService.getTruckFormula(new BigDecimal(10));
                 // 替换采购汽运运计算公式
                 formula_string = formula_string.replace("运输单价",priceValue.toString())
                         .replace("物资净重",netWeight.toString());
-            }
-            else {
-                // 得到销售10km差距外的汽运计费公式
-                formula_string = bmstruckFormulaService.getTruckFormula(new BigDecimal(11));
-                // 替换采购汽运运计算公式
-                formula_string = formula_string.replace("运输单价",priceValue.toString())
-                        .replace("运输距离",distance.toString())
-                        .replace("物资净重",netWeight.toString());
-            }
+//            }
+//            else {
+//                // 得到销售10km差距外的汽运计费公式
+//                formula_string = bmstruckFormulaService.getTruckFormula(new BigDecimal(11));
+//                // 替换采购汽运运计算公式
+//                formula_string = formula_string.replace("运输单价",priceValue.toString())
+//                        .replace("运输距离",distance.toString())
+//                        .replace("物资净重",netWeight.toString());
+//            }
         }
         String s = toSufExpr(formula_string);
         return calSufExpr(s);

+ 10 - 3
src/main/resources/application-dev.yml

@@ -1,8 +1,15 @@
 spring:
   datasource:
     url: jdbc:oracle:thin:@172.16.33.163:1521:ilsdbpri
-    password: Dil123789
-    username: dil
+    password: root123
+    username: dagang
     driver-class-name: oracle.jdbc.OracleDriver
   application:
-    name: dil-bmstruck-api-dev
+    name: dil-bmstruck-api-dev
+#feign设置
+openfeign:
+  ColumnDataFeign:
+    url: ${COLUMNDATAFEIGN_URL:172.16.33.166:8083}
+
+server:
+  port: 8009

+ 9 - 1
src/main/resources/application-prod.yml

@@ -5,4 +5,12 @@ spring:
     username: dil
     driver-class-name: oracle.jdbc.OracleDriver
   application:
-    name: dil-bmstruck-api-dev
+    name: dil-bmstruck-api-dev
+
+#feign设置
+openfeign:
+  ColumnDataFeign:
+    url: ${COLUMNDATAFEIGN_URL:172.16.33.166:8083}
+
+server:
+  port: 8076

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

@@ -12,15 +12,11 @@ spring:
   mvc:
     static-path-pattern:
 
-openfeign:
-  ColumnDataFeign:
-    url: ${COLUMNDATAFEIGN_URL:172.16.33.161:8083}
-
 #eureka设置
 eureka:
   client:
     service-url:
-      defaultZone: http://root:root@${EUREKA_HOST:172.16.33.161}:${EUREKA_PORT:8061}/eureka/
+      defaultZone: http://root:root@${EUREKA_HOST:172.16.33.162}:${EUREKA_PORT:8061}/eureka/
   instance:
     prefer-ip-address: true
     status-page-url: http://${spring.cloud.client.ip-address}:${server.port}/swagger-ui.html#/
@@ -53,6 +49,3 @@ mybatis:
     #    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     mapUnderscoreToCamelCase: true
     call-setters-on-nulls: true
-
-server:
-  port: 8076

+ 92 - 88
src/main/resources/com/steerinfo/dil/mapper/BmstruckDetailsOrderMapper.xml

@@ -1004,14 +1004,10 @@
     </select>
 
     <!-- 得到单价id -->
-    <select id="getPriceId" resultType="java.util.Map">
-        SELECT actp.PRICE_ID as "priceId"
-        FROM AMS_CONTRACT_TRANSPORT_PRICE actp
-                 LEFT JOIN RMS_CAPACITY rc
-                           ON rc.CAPACITY_ID = actp.CAPACITY_ID
-        WHERE rc.CAPACITY_TYPE_ID = 1
-          AND actp.DELETED = 0
-        ORDER BY actp.PRICE_DATE DESC
+    <select id="getPriceId" resultType="java.util.Map" parameterType="DECIMAL">
+        SELECT OO.PRICE_ID AS "priceId"
+        FROM OMSTRUCK_ORDER OO
+        WHERE OO.ORDER_ID = #{orderId}
     </select>
 
     <select id="getPriceValue" parameterType="DECIMAL" resultType="DECIMAL">
@@ -1021,7 +1017,7 @@
     </select>
 
     <select id="getNetWeight" parameterType="DECIMAL" resultType="DECIMAL">
-        SELECT twr.RESULT_NET_WEIGHT as "netWeight"
+        SELECT SUM(twr.RESULT_NET_WEIGHT) as "netWeight"
         FROM OMSTRUCK_ORDER oo
                  LEFT JOIN TMSTRUCK_TOTAL_RESULT ttr
                            ON oo.ORDER_ID = ttr.ORDER_ID
@@ -1032,95 +1028,103 @@
 
     <!--  查询未生成账单的计时详单  -->
     <!--计时-->
-    <select id="getUnFinishedTimeTruckDetailsOrderList"  parameterType="java.util.Map" resultType="java.util.Map">
-    select bdo.details_no as "detailsNo",
-       bdo.order_id as "orderId",
-       bdo.details_time as "detailsTime",
-       rc.capacity_number as "capacityNumber",
-       rct.capacity_type_name as "capacityType",
-       air.requirement_type as "requirementType",
-       bdo.price_id as "priceId",
-       bdo.details_amount as "detailsAmount"
-from bmstruck_details_order bdo
-join omstruck_order oo on bdo.order_id=oo.order_id
-join rms_capacity rc on oo.capacity_id=rc.capacity_id
-join rms_capacity_type rct on rc.capacity_type_id=rct.capacity_type_id
-join amstruck_inward_plan aip on oo.order_plan_id=aip.plan_id
-join amstruck_requirement_plan arp on aip.plan_id=arp.plan_id
-join amstruck_inward_requirement air on arp.requirement_plan_id=air.requirement_id
-join rms_line rl on air.line_id=rl.line_id
-where air.requirement_type=1 and bdo.wether_to_statement=0 and oo.order_type=4
+    <select id="getUnFinishedTimeTruckDetailsOrderList" parameterType="java.util.Map" resultType="java.util.Map">
+        select bdo.details_no         as "detailsNo",
+               bdo.order_id           as "orderId",
+               bdo.details_time       as "detailsTime",
+               rc.capacity_number     as "capacityNumber",
+               rct.capacity_type_name as "capacityType",
+               air.requirement_type   as "requirementType",
+               bdo.price_id           as "priceId",
+               bdo.details_amount     as "detailsAmount"
+        from bmstruck_details_order bdo
+                 join omstruck_order oo on bdo.order_id = oo.order_id
+                 join rms_capacity rc on oo.capacity_id = rc.capacity_id
+                 join rms_capacity_type rct on rc.capacity_type_id = rct.capacity_type_id
+                 join amstruck_inward_plan aip on oo.order_plan_id = aip.plan_id
+                 join amstruck_requirement_plan arp on aip.plan_id = arp.plan_id
+                 join amstruck_inward_requirement air on arp.requirement_plan_id = air.requirement_id
+                 join rms_line rl on air.line_id = rl.line_id
+        where air.requirement_type = 1
+          and bdo.wether_to_statement = 0
+          and oo.order_type = 4
     </select>
     <!--计数-->
-    <select id="getUnFinishedNumTruckDetailsOrderList"  parameterType="java.util.Map" resultType="java.util.Map">
-    select bdo.details_no as "detailsNo",
-       bdo.order_id as "orderId",
-       bdo.details_time as "detailsTime",
-       rc.capacity_number as "capacityNumber",
-       rct.capacity_type_name as "capacityType",
-       air.requirement_type as "requirementType",
-       bdo.price_id as "priceId",
-       bdo.details_amount as "detailsAmount"
-from bmstruck_details_order bdo
-join omstruck_order oo on bdo.order_id=oo.order_id
-join rms_capacity rc on oo.capacity_id=rc.capacity_id
-join rms_capacity_type rct on rc.capacity_type_id=rct.capacity_type_id
-join amstruck_inward_plan aip on oo.order_plan_id=aip.plan_id
-join amstruck_requirement_plan arp on aip.plan_id=arp.plan_id
-join amstruck_inward_requirement air on arp.requirement_plan_id=air.requirement_id
-join rms_line rl on air.line_id=rl.line_id
-where air.requirement_type=2 and bdo.wether_to_statement=0 and oo.order_type=4
+    <select id="getUnFinishedNumTruckDetailsOrderList" parameterType="java.util.Map" resultType="java.util.Map">
+        select bdo.details_no         as "detailsNo",
+               bdo.order_id           as "orderId",
+               bdo.details_time       as "detailsTime",
+               rc.capacity_number     as "capacityNumber",
+               rct.capacity_type_name as "capacityType",
+               air.requirement_type   as "requirementType",
+               bdo.price_id           as "priceId",
+               bdo.details_amount     as "detailsAmount"
+        from bmstruck_details_order bdo
+                 join omstruck_order oo on bdo.order_id = oo.order_id
+                 join rms_capacity rc on oo.capacity_id = rc.capacity_id
+                 join rms_capacity_type rct on rc.capacity_type_id = rct.capacity_type_id
+                 join amstruck_inward_plan aip on oo.order_plan_id = aip.plan_id
+                 join amstruck_requirement_plan arp on aip.plan_id = arp.plan_id
+                 join amstruck_inward_requirement air on arp.requirement_plan_id = air.requirement_id
+                 join rms_line rl on air.line_id = rl.line_id
+        where air.requirement_type = 2
+          and bdo.wether_to_statement = 0
+          and oo.order_type = 4
     </select>
     <!--计重-->
-    <select id="getUnFinishedWeightTruckDetailsOrderList"  parameterType="java.util.Map" resultType="java.util.Map">
-    select bdo.details_no as "detailsNo",
-       bdo.order_id as "orderId",
-       bdo.details_time as "detailsTime",
-       rc.capacity_number as "capacityNumber",
-       rct.capacity_type_name as "capacityType",
-       air.requirement_type as "requirementType",
-       bdo.price_id as "priceId",
-       bdo.details_amount as "detailsAmount"
-from bmstruck_details_order bdo
-join omstruck_order oo on bdo.order_id=oo.order_id
-join rms_capacity rc on oo.capacity_id=rc.capacity_id
-join rms_capacity_type rct on rc.capacity_type_id=rct.capacity_type_id
-join amstruck_inward_plan aip on oo.order_plan_id=aip.plan_id
-join amstruck_requirement_plan arp on aip.plan_id=arp.plan_id
-join amstruck_inward_requirement air on arp.requirement_plan_id=air.requirement_id
-join rms_line rl on air.line_id=rl.line_id
-where air.requirement_type=0 and bdo.wether_to_statement=0 and oo.order_type=4
+    <select id="getUnFinishedWeightTruckDetailsOrderList" parameterType="java.util.Map" resultType="java.util.Map">
+        select bdo.details_no         as "detailsNo",
+               bdo.order_id           as "orderId",
+               bdo.details_time       as "detailsTime",
+               rc.capacity_number     as "capacityNumber",
+               rct.capacity_type_name as "capacityType",
+               air.requirement_type   as "requirementType",
+               bdo.price_id           as "priceId",
+               bdo.details_amount     as "detailsAmount"
+        from bmstruck_details_order bdo
+                 join omstruck_order oo on bdo.order_id = oo.order_id
+                 join rms_capacity rc on oo.capacity_id = rc.capacity_id
+                 join rms_capacity_type rct on rc.capacity_type_id = rct.capacity_type_id
+                 join amstruck_inward_plan aip on oo.order_plan_id = aip.plan_id
+                 join amstruck_requirement_plan arp on aip.plan_id = arp.plan_id
+                 join amstruck_inward_requirement air on arp.requirement_plan_id = air.requirement_id
+                 join rms_line rl on air.line_id = rl.line_id
+        where air.requirement_type = 0
+          and bdo.wether_to_statement = 0
+          and oo.order_type = 4
     </select>
     <!--包月-->
-    <select id="getUnFinishedMonthTruckDetailsOrderList"  parameterType="java.util.Map" resultType="java.util.Map">
-    select bdo.details_no as "detailsNo",
-       bdo.order_id as "orderId",
-       bdo.details_time as "detailsTime",
-       rc.capacity_number as "capacityNumber",
-       rct.capacity_type_name as "capacityType",
-       air.requirement_type as "requirementType",
-       bdo.price_id as "priceId",
-       bdo.details_amount as "detailsAmount"
-from bmstruck_details_order bdo
-join omstruck_order oo on bdo.order_id=oo.order_id
-join rms_capacity rc on oo.capacity_id=rc.capacity_id
-join rms_capacity_type rct on rc.capacity_type_id=rct.capacity_type_id
-join amstruck_inward_plan aip on oo.order_plan_id=aip.plan_id
-join amstruck_requirement_plan arp on aip.plan_id=arp.plan_id
-join amstruck_inward_requirement air on arp.requirement_plan_id=air.requirement_id
-join rms_line rl on air.line_id=rl.line_id
-where air.requirement_type=3 and bdo.wether_to_statement=0 and oo.order_type=4
+    <select id="getUnFinishedMonthTruckDetailsOrderList" parameterType="java.util.Map" resultType="java.util.Map">
+        select bdo.details_no         as "detailsNo",
+               bdo.order_id           as "orderId",
+               bdo.details_time       as "detailsTime",
+               rc.capacity_number     as "capacityNumber",
+               rct.capacity_type_name as "capacityType",
+               air.requirement_type   as "requirementType",
+               bdo.price_id           as "priceId",
+               bdo.details_amount     as "detailsAmount"
+        from bmstruck_details_order bdo
+                 join omstruck_order oo on bdo.order_id = oo.order_id
+                 join rms_capacity rc on oo.capacity_id = rc.capacity_id
+                 join rms_capacity_type rct on rc.capacity_type_id = rct.capacity_type_id
+                 join amstruck_inward_plan aip on oo.order_plan_id = aip.plan_id
+                 join amstruck_requirement_plan arp on aip.plan_id = arp.plan_id
+                 join amstruck_inward_requirement air on arp.requirement_plan_id = air.requirement_id
+                 join rms_line rl on air.line_id = rl.line_id
+        where air.requirement_type = 3
+          and bdo.wether_to_statement = 0
+          and oo.order_type = 4
     </select>
 
-<!--  通过运单id获取需求类型(需求类型(0:计重;1:计时;2:计次;3:包月))-->
+    <!--  通过运单id获取需求类型(需求类型(0:计重;1:计时;2:计次;3:包月))-->
     <select id="getSettlement" parameterType="java.math.BigDecimal" resultType="java.util.Map">
         select air.requirement_type as "requirementType",
-               oom.material_id as "materialId"
+               oom.material_id      as "materialId"
         from omstruck_order oo
-               left join omstruck_order_material oom on oo.order_id=oom.order_id
-               left join amstruck_inward_plan aip on oo.order_plan_id=aip.plan_id
-               left join amstruck_requirement_plan arp on arp.plan_id=aip.plan_id
-               left join amstruck_inward_requirement air on arp.requirement_id=air.requirement_id
-        where oo.order_id=#{orderId}
+                 left join omstruck_order_material oom on oo.order_id = oom.order_id
+                 left join amstruck_inward_plan aip on oo.order_plan_id = aip.plan_id
+                 left join amstruck_requirement_plan arp on arp.plan_id = aip.plan_id
+                 left join amstruck_inward_requirement air on arp.requirement_id = air.requirement_id
+        where oo.order_id = #{orderId}
     </select>
 </mapper>