Quellcode durchsuchen

'joinapi修改'

HUJIANGUO vor 3 Jahren
Ursprung
Commit
d973c0238d

+ 0 - 1
pom.xml

@@ -123,7 +123,6 @@
                     </execution>
                 </executions>
             </plugin>
-
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>

+ 2 - 0
src/main/java/com/steerinfo/dil/controller/TmsTruckSmsRusultController.java

@@ -3,6 +3,7 @@ package com.steerinfo.dil.controller;
 import com.steerinfo.dil.service.impl.TmsTruckSmsRusultService;
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.framework.controller.RESTfulResult;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -25,6 +26,7 @@ public class TmsTruckSmsRusultController extends BaseRESTfulController {
      * @return
      */
     @PostMapping("/insertSms")
+    @ApiOperation("value=触发发送短信")
     public boolean addSmsResult(Map<String,Object>map){
             //获取一个个值
         String AppId= (String) map.get("AppId");

+ 12 - 7
src/main/java/com/steerinfo/dil/controller/TmstruckMeasureCommissionController.java

@@ -1,8 +1,10 @@
 package com.steerinfo.dil.controller;
 
+import com.steerinfo.dil.feign.TmstruckFeign;
 import com.steerinfo.dil.service.impl.TmstruckMeasureCommissionServiceImpl;
 import com.steerinfo.dil.service.impl.TmstruckWeightResultServiceImpl;
 import com.steerinfo.dil.util.BaseRESTfulController;
+import com.steerinfo.framework.controller.RESTfulResult;
 import io.swagger.annotations.ApiModelProperty;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -11,8 +13,8 @@ import java.util.Map;
 
 /**
  * @Description:
- * @Author:HuJianGuo
- * @GreateTime:2021/10/25 17:34
+ * @Author:luobang
+ * @GreateTime:2021/11/09 14:13
  * @Version:V2.0
  */
 @RestController
@@ -22,18 +24,21 @@ public class TmstruckMeasureCommissionController extends BaseRESTfulController {
     @Autowired
     TmstruckMeasureCommissionServiceImpl tmstruckMeasureCommissionService;
 
+    @Autowired
+    TmstruckFeign tmstruckFeign;
+
     /**
      * 推送运输订单信息(计量委托)
      *
-     * @param orderNumber
+     *
      * @return
      */
     @ApiModelProperty(value = "推送运输订单信息(计量委托)")
     @PostMapping("/pushTruckWeightApply")
-    public int pushTruckWeightApply(@RequestParam String orderNumber,
-                                    Integer type) {
-        Map<String,Object> resultMap = tmstruckMeasureCommissionService.pushTruckWeightApply(orderNumber,type);
-        return 0;
+    public RESTfulResult pushTruckWeightApply(@RequestBody(required = true)Map<String,Object>map) {
+
+
+       return success(tmstruckFeign.pushWeightApply(map));
     }
 
 

+ 33 - 18
src/main/java/com/steerinfo/dil/controller/TmstruckWeightResultController.java

@@ -1,5 +1,6 @@
 package com.steerinfo.dil.controller;
 
+import com.steerinfo.dil.feign.TmstruckFeign;
 import com.steerinfo.dil.service.impl.TmstruckWeightResultServiceImpl;
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.framework.controller.RESTfulResult;
@@ -7,6 +8,7 @@ import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -20,7 +22,11 @@ import java.util.Map;
 public class TmstruckWeightResultController extends BaseRESTfulController {
 
     @Autowired
-    TmstruckWeightResultServiceImpl tmstruckWeightResultService;
+    TmstruckWeightResultServiceImpl tmstruckWeightResultServiceImpl;
+
+    @Autowired
+    TmstruckFeign tmstruckFeign;
+
 
     /**
      * 接收计量实绩(计量实绩)
@@ -36,35 +42,44 @@ public class TmstruckWeightResultController extends BaseRESTfulController {
                     name = "orderNumber",value = "运输订单号",required = true,dataType = "String"
             ),
             @ApiImplicitParam(
-                    name = "tareCalculateNumber",value = "计皮汽车衡编号",required = true,dataType = "String"
-            ),
-            @ApiImplicitParam(
-                    name = "grossCalculatedNumber",value = "计毛汽车衡编号",required = true,dataType = "String"
-            ),
-            @ApiImplicitParam(
-                    name = "resultTareWeight",value = "皮重",required = true,dataType = "Double"
-            ),
-            @ApiImplicitParam(
-                    name = "resultTareWeightTime",value = "计皮时间",required = true,dataType = "Date"
+                    name = "tareCalculateNumber",value = "计皮/计毛汽车衡编号",required = true,dataType = "String"
             ),
             @ApiImplicitParam(
-                    name = "resultFrossWeight",value = "皮重",required = true,dataType = "Double"
+                    name = "resultWeight",value = "皮重或者毛重",required = true,dataType = "Double"
             ),
             @ApiImplicitParam(
-                    name = "resultGrossWeightTime",value = "计毛时间",required = true,dataType = "Date"
+                    name = "resultWeightTime",value = "计皮/计毛时间,毫秒数的时间戳",required = true,dataType = "Long"
             ),
             @ApiImplicitParam(
                     name = "resultNetWeight",value = "净重",required = true,dataType = "Double"
+            ),@ApiImplicitParam(
+                    name = "resultPoundNo",value = "磅单号",required = true,dataType = "String"
+            ),@ApiImplicitParam(
+                    name = "weightType",value = "计皮/计毛",required = true,dataType = "String"
             )
     }
-
     )
-
     @PostMapping("/receiveTmsTruckWeightResult")
-    public RESTfulResult receiveTmsTruckWeightResult(@RequestBody Map<String,Object> mapValue) {
-        int result = tmstruckWeightResultService.receiveTmsTruckWeightResult(mapValue);
-        return success();
+    public RESTfulResult receiveTmsTruckWeightResult(@RequestBody(required = true) Map<String,Object> mapValue) {
+        int result = tmstruckWeightResultServiceImpl.receiveTmsTruckWeightResult(mapValue);
+        return success(result);
     }
 
 
+    /**
+     * 计量退货异常
+     * @param orderNo
+     * @return
+     */
+    @PostMapping("/abnormalReturn")
+    @ApiOperation("value=触发退货实绩")
+    @ApiImplicitParam(name = "orderNo",value = "运输订单号",required = true,dataType = "String")
+    public RESTfulResult sendAbnormalReturn(String orderNo){
+        Map<String, Object> map = new HashMap<>();
+        map.put("purchOrder",orderNo);
+        return success(tmstruckFeign.sendAbnormalReturn(map));
+    }
+
+
+
 }

+ 24 - 0
src/main/java/com/steerinfo/dil/feign/TmstruckFeign.java

@@ -0,0 +1,24 @@
+package com.steerinfo.dil.feign;
+
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author luobang
+ * @create 2021-11-09 11:30
+ */
+@FeignClient(value = "logistic",url = "172.16.33.122:44325")
+public interface TmstruckFeign {
+    @PostMapping("api/logistics/AbnormalReturn")
+    Map<String,Object> sendAbnormalReturn(@RequestBody(required = true) Map<String,Object>map);
+
+    @PostMapping("api/logistics/TareApplyFor")
+    Map<String,Object> pushWeightApply(Map<String, Object> map);
+
+}

+ 5 - 2
src/main/java/com/steerinfo/dil/mapper/TmstruckWeightResultMapper.java

@@ -3,13 +3,16 @@ package com.steerinfo.dil.mapper;
 import com.steerinfo.dil.model.TmstruckWeightResult;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import java.math.*;
+import java.util.Map;
+
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 @Mapper
-public interface TmstruckWeightResultMapper extends IBaseMapper<TmstruckWeightResult, Short> {
+public interface TmstruckWeightResultMapper extends IBaseMapper<TmstruckWeightResult, BigDecimal> {
 
     // 得到计重实绩主键id
-    BigDecimal getWeightTaskResultId(String orderNumber);
+    BigDecimal getWeightTaskResultId(Map<String,Object>mapValue);
 
     // 得到汽车衡id
     BigDecimal getTruckCalculateId(String resultCalculateNumber);

+ 38 - 27
src/main/java/com/steerinfo/dil/service/impl/TmstruckWeightResultServiceImpl.java

@@ -36,33 +36,44 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
     @Override
     public int receiveTmsTruckWeightResult(Map<String, Object> mapValue) {
         // 得到运输订单号
-        String orderNumber = (String) mapValue.get("orderNumber");
-        BigDecimal weightTaskResultId = tmstruckWeightResultMapper.getWeightTaskResultId(orderNumber);
-        // 得到计皮汽车衡编号
-        String tareCalculateNumber = (String) mapValue.get("tareCalculateNumber");
-        BigDecimal resultTarePlaceId = tmstruckWeightResultMapper.getTruckCalculateId(tareCalculateNumber);
-        // 得到计毛汽车衡编号
-        String grossCalculateNumber = (String) mapValue.get("grossCalculateNumber");
-        BigDecimal resultGrossPlaceId = tmstruckWeightResultMapper.getTruckCalculateId(grossCalculateNumber);
-        // 得到皮重
-        Double resultTareWeight = (Double) mapValue.get("resultTareWeight");
-        // 得到计皮时间
-        Date resultTareWeightTime = (Date) mapValue.get("resultTareWeightTime");
-        // 得到毛重
-        Double resultGrossWeight = (Double)mapValue.get("resultGrossWeight");
-        // 得到计毛时间
-        Date resultGrossWeightTime = (Date) mapValue.get("resultGrossWeightTime");
-        // 得到净重
-        Double resultNetWeight = (Double)mapValue.get("resultNetWeight");
-        TmstruckWeightResult tmstruckWeightResult = new TmstruckWeightResult();
-        tmstruckWeightResult.setWeightTaskResultId(weightTaskResultId);
-        tmstruckWeightResult.setResultTareWeight(new BigDecimal(resultTareWeight));
-        tmstruckWeightResult.setResultTareWeightTime(resultTareWeightTime);
-        tmstruckWeightResult.setResultGrossWeight(new BigDecimal(resultGrossWeight));
-        tmstruckWeightResult.setResultGrossWeightTime(resultGrossWeightTime);
-        tmstruckWeightResult.setResultNetWeight(new BigDecimal(resultNetWeight));
-        tmstruckWeightResult.setResultGrossPlaceId(resultGrossPlaceId);
-        tmstruckWeightResult.setResultTarePlaceId(resultTarePlaceId);
+//        String orderNumber = (String) mapValue.get("orderNumber");
+        BigDecimal weightTaskResultId = tmstruckWeightResultMapper.getWeightTaskResultId(mapValue);
+        TmstruckWeightResult tmstruckWeightResult =tmstruckWeightResultMapper.selectByPrimaryKey(weightTaskResultId);
+        String weightType=(String)mapValue.get("weightType");
+        if (weightType.equals("计皮")){
+            // 得到计皮汽车衡编号
+            String calculateNumber = (String) mapValue.get("calculateNumber");
+            BigDecimal resultTarePlaceId = tmstruckWeightResultMapper.getTruckCalculateId(calculateNumber);
+            // 得到皮重
+            String resultWeight = (String) mapValue.get("resultWeight");
+            // 得到计皮时间
+            Date resultWeightTime = new Date((Long) mapValue.get("resultWeightTime"));
+            // 得到净重
+            String resultNetWeight = (String)mapValue.get("resultNetWeight");
+            String resultPoundNo=(String) mapValue.get("resultPoundNo");
+            tmstruckWeightResult.setResultPoundNo(resultPoundNo);
+            tmstruckWeightResult.setResultTarePlaceId(resultTarePlaceId);
+            tmstruckWeightResult.setResultTareWeight(new BigDecimal(resultWeight));
+            tmstruckWeightResult.setResultTareWeightTime(resultWeightTime);
+            tmstruckWeightResult.setResultNetWeight(new BigDecimal(resultNetWeight));
+        }
+        if (weightType.equals("计毛")){
+            // 得到计毛汽车衡编号
+            String calculateNumber = (String) mapValue.get("calculateNumber");
+            // 得到毛重
+            String resultWeight = (String) mapValue.get("resultWeight");
+            // 得到计毛时间
+            Date resultWeightTime = new Date((Long) mapValue.get("resultWeightTime"));
+            BigDecimal resultGrossPlaceId = tmstruckWeightResultMapper.getTruckCalculateId(calculateNumber);
+            String resultPoundNo=(String) mapValue.get("resultPoundNo");
+            tmstruckWeightResult.setResultPoundNo(resultPoundNo);
+            tmstruckWeightResult.setResultGrossPlaceId(resultGrossPlaceId);
+            tmstruckWeightResult.setResultGrossWeight(new BigDecimal(resultWeight));
+            tmstruckWeightResult.setResultGrossWeightTime(resultWeightTime);
+            // 得到净重
+            String resultNetWeight = (String) mapValue.get("resultNetWeight");
+            tmstruckWeightResult.setResultNetWeight(new BigDecimal(resultNetWeight));
+        }
         int result = tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
         return result;
     }

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

@@ -16,7 +16,7 @@ spring:
 eureka:
   client:
     service-url:
-      defaultZone: http://root:root@${EUREKA_HOST:localhost}:${EUREKA_PORT:8061}/eureka/
+      defaultZone: http://root:root@${EUREKA_HOST:172.16.33.161}:${EUREKA_PORT:8061}/eureka/
   instance:
     prefer-ip-address: true
     status-page-url: http://${spring.cloud.client.ip-address}:${server.port}/swagger-ui.html#/

+ 13 - 11
src/main/resources/com/steerinfo/dil/mapper/TmstruckWeightResultMapper.xml

@@ -152,7 +152,7 @@
             </if>
         </where>
     </sql>
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
+    <delete id="deleteByPrimaryKey" parameterType="DECIMAL">
         delete
         from TMSTRUCK_WEIGHT_RESULT
         where WEIGHT_TASK_RESULT_ID = #{weightTaskResultId,jdbcType=DECIMAL}
@@ -412,7 +412,7 @@
         </set>
         where WEIGHT_TASK_RESULT_ID = #{weightTaskResultId,jdbcType=DECIMAL}
     </update>
-    <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
+    <select id="selectByPrimaryKey" parameterType="DECIMAL" resultMap="BaseResultMap">
         <include refid="select"/>
         where WEIGHT_TASK_RESULT_ID = #{weightTaskResultId,jdbcType=DECIMAL}
     </select>
@@ -553,15 +553,7 @@
     <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
 
     <!-- 得到计重实绩主键id -->
-    <select id="getWeightTaskResultId" parameterType="java.lang.String" resultType="DECIMAL">
-        SELECT TWR.WEIGHT_TASK_RESULT_ID as "weightTaskResultId"
-        FROM TMSTRUCK_WEIGHT_RESULT TWR
-                 LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
-                           ON TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
-                 LEFT JOIN OMSTRUCK_ORDER OO
-                           ON OO.ORDER_ID = TTR.ORDER_ID
-        WHERE OO.ORDER_NUMBER = #{orderNumber}
-    </select>
+
 
     <!-- 得到汽车衡id -->
     <select id="getTruckCalculateId" parameterType="java.lang.String" resultType="DECIMAL">
@@ -570,5 +562,15 @@
         FROM RMS_TRUCK_CALCULATE RTC
         WHERE RTC.TRUCK_CALCULATE_NUMBER = #{resultCalculateNumber}
     </select>
+    <select id="getWeightTaskResultId" resultType="DECIMAL" parameterType="java.util.Map">
+        SELECT TWR.WEIGHT_TASK_RESULT_ID as "weightTaskResultId"
+        FROM TMSTRUCK_WEIGHT_RESULT TWR
+                 LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
+                           ON TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
+                 LEFT JOIN OMSTRUCK_ORDER OO
+                           ON OO.ORDER_ID = TTR.ORDER_ID
+        WHERE OO.ORDER_NUMBER = #{orderNumber,jdbcType=VARCHAR}
+        and TWR.MATERIAL_ID=#{materialId,jdbcType=DECIMAL}
+    </select>
 
 </mapper>