Browse Source

Merge branch 'master' of https://git.steerinfo.com/DAL-DAZHOU2/DAL-DAZHOU-OTMS-API

luobang 2 years ago
parent
commit
c259005d01

+ 2 - 1
src/main/java/com/steerinfo/dil/controller/OffSiteTransportationController.java

@@ -346,10 +346,11 @@ public class OffSiteTransportationController extends BaseRESTfulController {
             }
         }else{
             System.out.println("没有抵达实绩");
+            return failed("请先抵达作业!");
         }
 
 
-        return success(resTfulResult);
+        return success("签收成功");
     }
 
     //如果内容丢失重新获得

+ 8 - 72
src/main/java/com/steerinfo/dil/controller/TmstruckReceiptResultController.java

@@ -109,43 +109,15 @@ public class TmstruckReceiptResultController extends BaseRESTfulController {
             //获取运输订单号和收货点地址
             String orderNumber = (String) map.get("orderNumber");
             String resultArrivalAddress = (String) map.get("resultArrivalAddress");
-            //获取空货箱照片、已签字的送货单照片
-            String resultEmptyContainerPhoto = (String) map.get("url1");
-            String resultSignedNotePhoto = (String) map.get("url2");
+            //获取所有的图片
+            String resultEmptyContainerPhoto = (String) map.get("url");
             tmstruckReceiptResult.setResultArrivalAddress(resultArrivalAddress);
             tmstruckReceiptResult.setResultEmptyContainerPhoto(resultEmptyContainerPhoto);
-            tmstruckReceiptResult.setResultSignedNotePhoto(resultSignedNotePhoto);
-            if(map.containsKey("url3")){
-                //如果有,获取客户签收单照片
-                String resultReceiveNotePhoto = (String) map.get("url3");
-                tmstruckReceiptResult.setResultReceiveNotePhoto(resultReceiveNotePhoto);
-            }
             //新增收货实绩主表
             BigDecimal receiptResultId = tmstruckReceiptResultService.addTmstruckReceiptResult(orderNumber, tmstruckReceiptResult);
-            //初始化收货实绩子表信息
-            TmstruckReceiptResultChild tmstruckReceiptResultChild = new TmstruckReceiptResultChild();
-            //关联收货实绩主表
-            tmstruckReceiptResultChild.setReceiptResultId(receiptResultId);
-            //如果有,获取最多三张其他照片
-            if(map.containsKey("fourFiles")){
-                List<String> fourFiles = (List<String>) map.get("fourFiles");
-                if(fourFiles.size()==0){}
-                else if(fourFiles.size()==1){
-                    tmstruckReceiptResultChild.setOtherPhoto1(fourFiles.get(0));
-                }else if(fourFiles.size()==2){
-                    tmstruckReceiptResultChild.setOtherPhoto1(fourFiles.get(0));
-                    tmstruckReceiptResultChild.setOtherPhoto2(fourFiles.get(1));
-                }else {
-                    tmstruckReceiptResultChild.setOtherPhoto1(fourFiles.get(0));
-                    tmstruckReceiptResultChild.setOtherPhoto2(fourFiles.get(1));
-                    tmstruckReceiptResultChild.setOtherPhoto3(fourFiles.get(2));
-                }
-            }
-            //新增收货实绩子表
-            int i = tmstruckReceiptResultChildService.addTmstruckReceiptResultChild(tmstruckReceiptResultChild);
-            return success(i);
+            return success("签收成功!");
         }else{
-            return success(4);
+            return failed("没有收货实绩!");
         }
 
     }
@@ -211,49 +183,13 @@ public class TmstruckReceiptResultController extends BaseRESTfulController {
 
     @ApiOperation(value = "获取收货作业照片")
     @PostMapping("/getReceivingPhoto")
-    public RESTfulResult getReceivingPhoto(@RequestParam String orderNumber) throws Exception {
-        List<Map<String,Object>> mapList = tmstruckReceiptResultService.getReceivingPhoto(orderNumber);
-        Map<String,Object> result=new HashMap<>();
-        for(Map<String,Object> map:mapList){
-            if(map.containsKey("resultEmptyContainerPhoto") && map.get("resultEmptyContainerPhoto")!=null){
-                String resultEmptyContainerPhoto = (String) imageFileUtils.downloadFile(map.get("resultEmptyContainerPhoto").toString());
-                result.put("resultEmptyContainerPhoto",resultEmptyContainerPhoto);
-            }
-            if(map.containsKey("resultSignedNotePhoto") && map.get("resultSignedNotePhoto")!=null){
-                String resultSignedNotePhoto = (String) imageFileUtils.downloadFile(map.get("resultSignedNotePhoto").toString());
-                result.put("resultSignedNotePhoto",resultSignedNotePhoto);
-            }
-            //追加的图片
-            if(map.containsKey("otherPhoto1") && map.get("otherPhoto1")!=null){
-                String resultSignedNotePhoto =(String) imageFileUtils.downloadFile(map.get("otherPhoto1").toString());
-                result.put("otherPhoto1",resultSignedNotePhoto);
-            }
-            if(map.containsKey("otherPhoto2") && map.get("otherPhoto2") !=null){
-                String resultSignedNotePhoto =(String) imageFileUtils.downloadFile(map.get("otherPhoto2").toString());
-                result.put("otherPhoto2",resultSignedNotePhoto);
-            }
-            if(map.containsKey("otherPhoto3") && map.get("otherPhoto3") !=null){
-                String resultSignedNotePhoto =(String) imageFileUtils.downloadFile(map.get("otherPhoto3").toString());
-                result.put("otherPhoto3",resultSignedNotePhoto);
-            }
-        }
-        return success(result);
+    public String getReceivingPhoto(@RequestParam String orderNumber) throws Exception {
+        return tmstruckReceiptResultService.getReceivingPhoto(orderNumber);
     }
     @ApiOperation(value = "获取收货作业照片")
     @PostMapping("/getReceivingPhotoByUrl")
-    public Map<String,Object> getReceivingPhotoByUrl(@RequestParam String orderNumber) throws Exception {
-        List<Map<String,Object>> mapList = tmstruckReceiptResultService.getReceivingPhoto(orderNumber);
-        Map<String,Object> mapvalue = null;
-        if (mapList!=null && mapList.size()>0){
-            //必选的图片
-            mapvalue=mapList.get(0);
-            //追加的三张图片
-            if(mapList.get(1)!=null){
-               mapvalue.putAll(mapList.get(1));
-            }
-        }
-        
-        return mapvalue;
+    public String getReceivingPhotoByUrl(@RequestParam String orderNumber) throws Exception {
+        return tmstruckReceiptResultService.getReceivingPhoto(orderNumber);
     }
 
 }

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

@@ -37,7 +37,7 @@ public interface TmstruckReceiptResultMapper extends IBaseMapper<TmstruckReceipt
 
     List<Map<String, Object>> getReceivingResult(Map<String, Object> mapValue);
 
-    List<Map<String, Object>> getReceivingPhoto(String orderNumber);
+    String getReceivingPhoto(String orderNumber);
 
     List<Map<String,Object>> getChildPhoto(String orderNumber);
 }

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

@@ -38,5 +38,5 @@ public interface ITmstruckReceiptResultService{
 
     List<Map<String, Object>> getReceivingResult(Map<String, Object> mapValue);
 
-    List<Map<String, Object>> getReceivingPhoto(String orderNumber);
+    String getReceivingPhoto(String orderNumber);
 }

+ 3 - 32
src/main/java/com/steerinfo/dil/service/impl/OffSiteTransportationServiceImpl.java

@@ -244,46 +244,17 @@ public class OffSiteTransportationServiceImpl implements OffSiteTransportationSe
     public Integer addTmstruckReceiptResult(@RequestBody(required = false) Map<String,Object> map){
         BigDecimal alreadyExistsArrivalResult = tmstruckArrivalResultMapper.alreadyExistsArrivalResult((String) map.get("orderNumber"));
         if(alreadyExistsArrivalResult!=null){
-            //删除所有入库时机
             TmstruckReceiptResult tmstruckReceiptResult = new TmstruckReceiptResult();
             //获取运输订单号和收货点地址
             String orderNumber = (String) map.get("orderNumber");
             String resultArrivalAddress = (String) map.get("resultArrivalAddress");
-            //获取空货箱照片、已签字的送货单照片
-            String resultEmptyContainerPhoto = (String) map.get("url0");
-            String resultSignedNotePhoto = (String) map.get("url1");
+            //获取所有照片
+            String resultEmptyContainerPhoto = (String) map.get("url");
             tmstruckReceiptResult.setResultArrivalAddress(resultArrivalAddress);
             tmstruckReceiptResult.setResultEmptyContainerPhoto(resultEmptyContainerPhoto);
-            tmstruckReceiptResult.setResultSignedNotePhoto(resultSignedNotePhoto);
-            if(map.containsKey("url2")){
-                //如果有,获取客户签收单照片
-                String resultReceiveNotePhoto = (String) map.get("url2");
-                tmstruckReceiptResult.setResultReceiveNotePhoto(resultReceiveNotePhoto);
-            }
             //新增收货实绩主表
             BigDecimal receiptResultId = tmstruckReceiptResultService.addTmstruckReceiptResult(orderNumber, tmstruckReceiptResult);
-            //初始化收货实绩子表信息
-            TmstruckReceiptResultChild tmstruckReceiptResultChild = new TmstruckReceiptResultChild();
-            //关联收货实绩主表
-            tmstruckReceiptResultChild.setReceiptResultId(receiptResultId);
-            //如果有,获取最多三张其他照片
-            if(map.containsKey("fourFiles")){
-                List<String> fourFiles = (List<String>) map.get("fourFiles");
-                if(fourFiles.size()==0){}
-                else if(fourFiles.size()==1){
-                    tmstruckReceiptResultChild.setOtherPhoto1(fourFiles.get(0));
-                }else if(fourFiles.size()==2){
-                    tmstruckReceiptResultChild.setOtherPhoto1(fourFiles.get(0));
-                    tmstruckReceiptResultChild.setOtherPhoto2(fourFiles.get(1));
-                }else {
-                    tmstruckReceiptResultChild.setOtherPhoto1(fourFiles.get(0));
-                    tmstruckReceiptResultChild.setOtherPhoto2(fourFiles.get(1));
-                    tmstruckReceiptResultChild.setOtherPhoto3(fourFiles.get(2));
-                }
-            }
-            //新增收货实绩子表
-            int i = tmstruckReceiptResultChildService.addTmstruckReceiptResultChild(tmstruckReceiptResultChild);
-            return i;
+            return 0;
         }else{
             return 4;
         }

+ 4 - 5
src/main/java/com/steerinfo/dil/service/impl/TmstruckReceiptResultServiceImpl.java

@@ -9,6 +9,7 @@ import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.route.mapper.TmstruckArrivalResultMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -45,6 +46,7 @@ public class TmstruckReceiptResultServiceImpl implements ITmstruckReceiptResultS
     private TmstruckArrivalResultMapper tmstruckArrivalResultMapper;
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public synchronized BigDecimal addTmstruckReceiptResult(String orderNumber, TmstruckReceiptResult tmstruckReceiptResult) {
         long id;
         if(tmstruckReceiptResultMapper.selectMaxId()==null){
@@ -85,11 +87,8 @@ public class TmstruckReceiptResultServiceImpl implements ITmstruckReceiptResultS
     }
 
     @Override
-    public List<Map<String, Object>> getReceivingPhoto(String orderNumber) {
-        List<Map<String,Object>> photos=new ArrayList<>();
-        photos.addAll(tmstruckReceiptResultMapper.getReceivingPhoto(orderNumber));//主表的图片
-        photos.addAll(tmstruckReceiptResultMapper.getChildPhoto(orderNumber));//子表三张追加的图片
-        return photos;
+    public String getReceivingPhoto(String orderNumber) {
+        return tmstruckReceiptResultMapper.getReceivingPhoto(orderNumber);
     }
 
     /**

+ 1 - 1
src/main/java/com/steerinfo/route/service/impl/RouteServiceImpl.java

@@ -104,7 +104,7 @@ public class RouteServiceImpl implements RouteService {
             //创建收货地址需要的字段    addressProvince 省份、addressDistrict 市区、addressTown 县镇 、addressDeliveryAddress 收货地址、 addressLongitude 收货地址经度、addressLatitude 收货地址纬度
             String searchPointJson2 = HTTPRequestUtils.sendGet("https://restapi.amap.com/v3/geocode/geo", "address=" + URLEncoder.encode(mapValue.get("receiveAddress").toString() == null ? "长沙市" : mapValue.get("receiveAddress").toString(), "utf-8") + "&key=" + gaodeTonken);
             SearchPoint2 searchPoint2 = JSON.parseObject(searchPointJson2, SearchPoint2.class);
-            if (searchPoint2.getStatus() == "0") {
+            if (searchPoint2.getStatus().equals("1")) {
 
                 if (searchPoint2.getGeocodes() != null) {
                     materieldesMap.put("addressProvince", searchPoint2.getGeocodes().get(0).getProvince() == null ? "湖南省" : searchPoint2.getGeocodes().get(0).getProvince());

+ 2 - 0
src/main/java/com/steerinfo/route/service/impl/TmstruckArrivalResultServiceImpl.java

@@ -6,6 +6,7 @@ import com.steerinfo.route.model.TmstruckArrivalResult;
 import com.steerinfo.route.service.ITmstruckArrivalResultService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -55,6 +56,7 @@ public class TmstruckArrivalResultServiceImpl implements ITmstruckArrivalResultS
 //    }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public synchronized int addtmstruckArrivalResult(String orderNumber, TmstruckArrivalResult tmstruckArrivalResult) {
         //先删除实绩,保证可以插入
         int  deleteNumber=tmstruckArrivalResultMapper.deleteAllArrival(orderNumber);

+ 3 - 4
src/main/resources/com/steerinfo/dil/mapper/TmstruckReceiptResultMapper.xml

@@ -1207,16 +1207,15 @@
     <include refid="orderBy"></include>
   </select>
 
-  <select id="getReceivingPhoto" parameterType="java.lang.String" resultType="java.util.Map">
-    select trr.RESULT_EMPTY_CONTAINER_PHOTO "resultEmptyContainerPhoto",
-           trr.RESULT_SIGNED_NOTE_PHOTO "resultSignedNotePhoto",
-           trr.RESULT_RECEIVE_NOTE_PHOTO "resultReceiveNotePhoto"
+  <select id="getReceivingPhoto" parameterType="java.lang.String" resultType="java.lang.String">
+    select trr.RESULT_EMPTY_CONTAINER_PHOTO "resultEmptyContainerPhoto"
     from TMSTRUCK_RECEIPT_RESULT trr
     left join TMSTRUCK_TOTAL_RESULT ttr
     on ttr.RESULT_TOTAL_ID = trr.RESULT_TOTAL_ID
     left join OMSTRUCK_ORDER oo
     on oo.ORDER_ID = ttr.ORDER_ID
     where oo.ORDER_NUMBER = #{orderNumber}
+    fetch next 1 rows only
   </select>
 
   <select id="getChildPhoto" parameterType="java.lang.String" resultType="java.util.Map">