Преглед изворни кода

联合查询和智能料场接口修改

duyong пре 3 година
родитељ
комит
c09613c860

+ 2 - 2
src/main/java/com/steerinfo/meterwork/meterworkoldandnew/mapper/MeterWorkOldAndNewMapper.xml

@@ -96,7 +96,7 @@
         <if test="remark != null and remark != ''">
             and '老系统' LIKE '%${remark}%'
         </if>
-        <if test="predictionNo != null and predictionNo != ''">Dynamic
+        <if test="predictionNo != null and predictionNo != ''">
             and fs_noticeId LIKE '%${predictionNo}%'
         </if>
         <if test="senderRemark != null and senderRemark != ''">
@@ -903,7 +903,7 @@ where FS_ISVALID = '1' and FS_DELETEDTAG = 'N' and (FS_BALANCETYPE='静态' or F
         sender_remark,
         '新系统' remark
         from meter_work_railway_act_first
-        where VALUE_FLAG in ('2') and RAILWAY_TYPE_NO in ('001019002', '001019004')
+        where VALUE_FLAG in ('1','2') and RAILWAY_TYPE_NO in ('001019002', '001019004')
         <if test="remark != null and remark != ''">
             and '新系统' LIKE '%${remark}%'
         </if>

+ 16 - 1
src/main/java/com/steerinfo/meterwork/meterworkznlc/controller/MeterWorkZnlcController.java

@@ -11,6 +11,7 @@ import com.steerinfo.meterwork.meterworkcaractualfirst.mapper.MeterWorkCarActual
 import com.steerinfo.meterwork.meterworkcaractualfirst.model.MeterWorkCarActualFirst;
 import com.steerinfo.meterwork.meterworkznlc.service.IMeterWorkZnlcService;
 import com.steerinfo.meterwork.meterworkznlc.service.impl.MeterWorkZnlcService;
+import com.steerinfo.util.StringUtils;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -74,7 +75,21 @@ public class MeterWorkZnlcController extends BaseRESTfulController {
     @ApiOperation(value="根据检斤号查询称重信息", notes="根据检斤号查询称重信息")
     @PostMapping(value = "/GetWeightFromJL")
     public RESTfulResult GetWeightFromJL(@RequestBody String weightVoucherNo) {
-        RESTfulResult rm = meterWorkZnlcService.getOldActual(weightVoucherNo);
+        RESTfulResult rm = new RESTfulResult();
+        rm.setSucceed();
+        rm.setCode("200");
+        rm.setMessage("操作成功!!");
+        if(StringUtils.isEmpty(weightVoucherNo)) {
+            rm.setData(null);
+            return rm;
+        }
+
+        HashMap<String, Object> map = new HashMap<>();
+        HashMap<String, Object> param = new HashMap<>();
+        map.put("predictionNo", weightVoucherNo);
+        if(meterWorkZnlcService.getNewActual(rm, map, param)) return rm;
+        else if (meterWorkZnlcService.getOldActual(rm, map, param)) return rm;
+
         return rm;
     }
 

+ 3 - 3
src/main/java/com/steerinfo/meterwork/meterworkznlc/mapper/MeterWorkZnlcMapper.xml

@@ -11,7 +11,7 @@
         FS_NetWeight as NetWeight,
         FS_NETWeighttime as MeteringTime,
         '系统' as MetringPerson
-        from view_car_net
+        from JGWEIGHT.view_car_net
         where fs_noticeid = #{predictionNo}
     </select>
 
@@ -21,8 +21,8 @@
                 carNo as ConveyanceNo,
                 weight as GrossWeight,
                 weightTime as MeteringTime
-                from view_car_first
-        where fs_noticeid = #{predictionNo}
+                from JGWEIGHT.view_car_first
+        where noticeid = #{predictionNo}
     </select>
 
 </mapper>

+ 2 - 2
src/main/java/com/steerinfo/meterwork/meterworkznlc/service/IMeterWorkZnlcService.java

@@ -12,6 +12,6 @@ import java.util.List;
 public interface IMeterWorkZnlcService {
 
     // 汽车衡联合查询Service
-    RESTfulResult getOldActual(String predictionNo);
-    Boolean oldMetering(RESTfulResult rm, HashMap<String, Object> map, HashMap<String, Object> param);
+    Boolean getNewActual(RESTfulResult rm, HashMap<String, Object> map, HashMap<String, Object> param);
+    Boolean getOldActual(RESTfulResult rm, HashMap<String, Object> map, HashMap<String, Object> param);
 }

+ 21 - 32
src/main/java/com/steerinfo/meterwork/meterworkznlc/service/impl/MeterWorkZnlcService.java

@@ -9,7 +9,6 @@ import com.steerinfo.meterwork.meterworkcaractualfirst.mapper.MeterWorkCarActual
 import com.steerinfo.meterwork.meterworkcaractualfirst.model.MeterWorkCarActualFirst;
 import com.steerinfo.meterwork.meterworkznlc.mapper.MeterWorkZnlcMapper;
 import com.steerinfo.meterwork.meterworkznlc.service.IMeterWorkZnlcService;
-import com.steerinfo.util.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -31,20 +30,7 @@ public class MeterWorkZnlcService implements IMeterWorkZnlcService {
     MeterWorkCarActualFirstMapper meterWorkCarActualFirstMapper;
 
     @Override
-    public RESTfulResult getOldActual(String predictionNo) {
-        RESTfulResult rm =new RESTfulResult();
-        rm.setSucceed();
-        rm.setCode("200");
-        rm.setMessage("操作成功!!");
-
-        if(StringUtils.isEmpty(predictionNo)) {
-            rm.setData(null);
-            return rm;
-        }
-
-        HashMap<String, Object> map = new HashMap<>();
-        HashMap<String, Object> param = new HashMap<>();
-        map.put("predictionNo", predictionNo);
+    public Boolean getNewActual(RESTfulResult rm, HashMap<String, Object> map, HashMap<String, Object> param) {
 
         //根据委托号查询洁净数据(新系统)
         List<MeterWorkCarActual> actualList = meterWorkCarActualMapper.selectByParameters(map);
@@ -58,7 +44,7 @@ public class MeterWorkZnlcService implements IMeterWorkZnlcService {
             param.put("MeteringTime", actualList.get(0).getNetTime());   //计量时刻
             param.put("MetringPerson", actualList.get(0).getNetManName());  //计量人
             rm.setData(param);
-            return rm;
+            return true;
         }else {
             //根据委托号查询一次数据(新系统)
             List<MeterWorkCarActualFirst> firstList = meterWorkCarActualFirstMapper.selectByParameters(map);
@@ -73,18 +59,16 @@ public class MeterWorkZnlcService implements IMeterWorkZnlcService {
                 param.put("MetringPerson", firstList.get(0).getCreateManName());  //计量人
 
                 rm.setData(param);
-                return rm;
-            }else {
-                if (oldMetering(rm, map, param)) return rm;
+                return true;
             }
         }
-        return rm;
+        return false;
     }
 
 
     @Override
     @TargetDataSource(dataSourceKey = DataSourceKey.DB_SLAVE1)
-    public Boolean oldMetering(RESTfulResult rm, HashMap<String, Object> map, HashMap<String, Object> param) {
+    public Boolean getOldActual(RESTfulResult rm, HashMap<String, Object> map, HashMap<String, Object> param) {
         List<HashMap> oldActuals = meterWorkZnlcMapper.doQueryActualOld(map);
         if(oldActuals.size() >= 1) {
             param.put("DeviceNo", oldActuals.get(0).get("DEVICENO"));    //计量设备号
@@ -96,20 +80,25 @@ public class MeterWorkZnlcService implements IMeterWorkZnlcService {
             param.put("MeteringTime", oldActuals.get(0).get("METERINGTIME"));   //计量时刻
             param.put("MetringPerson", oldActuals.get(0).get("METRINGPERSON"));  //计量人
             rm.setData(param);
-        }else {
-            List<HashMap> oldFirsts = meterWorkZnlcMapper.doQueryFirstOld(map);
-            param.put("DeviceNo", oldFirsts.get(0).get("DEVICENO"));    //计量设备号
-            param.put("WeightVoucherNo", oldFirsts.get(0).get("WEIGHTVOUCHERNO")); //检斤委托号
-            param.put("ConveyanceNo", oldFirsts.get(0).get("CONVEYANCENO").toString().replaceAll("-", ""));   //车牌号
-            param.put("GrossWeight", oldFirsts.get(0).get("GROSSWEIGHT"));    //过磅量
-            param.put("TareWeight", null);     //空车重
-            param.put("NetWeight", null);      //过磅净重
-            param.put("MeteringTime", oldFirsts.get(0).get("METERINGTIME"));   //计量时刻
-            param.put("MetringPerson", "老系统一次");  //计量人
 
-            rm.setData(param);
             return true;
         }
+        else {
+            List<HashMap> oldFirsts = meterWorkZnlcMapper.doQueryFirstOld(map);
+            if(oldFirsts.size() >= 1) {
+                param.put("DeviceNo", oldFirsts.get(0).get("DEVICENO"));    //计量设备号
+                param.put("WeightVoucherNo", oldFirsts.get(0).get("WEIGHTVOUCHERNO")); //检斤委托号
+                param.put("ConveyanceNo", oldFirsts.get(0).get("CONVEYANCENO").toString().replaceAll("-", ""));   //车牌号
+                param.put("GrossWeight", oldFirsts.get(0).get("GROSSWEIGHT"));    //过磅量
+                param.put("TareWeight", null);     //空车重
+                param.put("NetWeight", null);      //过磅净重
+                param.put("MeteringTime", oldFirsts.get(0).get("METERINGTIME"));   //计量时刻
+                param.put("MetringPerson", "老系统一次");  //计量人
+
+                rm.setData(param);
+                return true;
+            }
+        }
         return false;
     }
 }