dengyj 3 سال پیش
والد
کامیت
e54bfb06ce

+ 12 - 0
src/main/java/com/steerinfo/baseinfo/meterbasespotinfo/controller/MeterBaseSpotInfoController.java

@@ -69,6 +69,18 @@ public class MeterBaseSpotInfoController extends BaseRESTfulController {
         }
     }
 
+    @ApiOperation(value = "获取静态铁水衡、吊钩秤站点列表", notes = "不分页查询")
+    @GetMapping(value = "/TSDGSpotInfo")
+    public RESTfulResult list(@RequestParam HashMap parmas) {
+        try {
+            List<MeterBaseSpotInfo> list = meterBaseSpotInfoService.TSDGSpotInfo(parmas);
+            return success(list);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            throw new MarkerMetException(500, "操作异常!!");
+        }
+    }
+
 
     @ApiOperation(value = "获取列表", notes = "不分页查询")
     @GetMapping(value = "/noPage")

+ 2 - 0
src/main/java/com/steerinfo/baseinfo/meterbasespotinfo/mapper/MeterBaseSpotInfoMapper.java

@@ -23,4 +23,6 @@ public interface MeterBaseSpotInfoMapper extends IBaseMapper<MeterBaseSpotInfo,
      List<MeterBaseSpotInfo> calibcorrelation();
 
      List<MeterBaseSpotInfo> selectSpotByUserID(Map<String, Object> parameters);
+
+     List<MeterBaseSpotInfo> TSDGSpotInfo(Map<String, Object> parameters);
 }

+ 5 - 1
src/main/java/com/steerinfo/baseinfo/meterbasespotinfo/mapper/MeterBaseSpotInfoMapper.xml

@@ -1026,5 +1026,9 @@
   <select id="selectSpotByUserID"  parameterType="java.util.HashMap" resultMap="BaseResultMap">
     select * from METER_BASE_SPOT_INFO where BASE_SPOT_NO not in (select BASE_SPOT_NO from METER_BASE_USER_SPOT where USER_ID = '${userID}')
   </select>
-  
+
+  <select id ="TSDGSpotInfo" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    select * from meter_base_spot_info
+        where spot_type_no in ('001019003','001019005')
+  </select>
 </mapper>

+ 1 - 0
src/main/java/com/steerinfo/baseinfo/meterbasespotinfo/service/IMeterBaseSpotInfoService.java

@@ -42,4 +42,5 @@ public interface IMeterBaseSpotInfoService extends IBaseService<MeterBaseSpotInf
      MeterBaseSpotInfo doUpdateWf(MeterBaseSpotInfo model);
 
      MeterBaseSpotInfo doUpdateNumWf(MeterBaseSpotInfo model);
+     List<MeterBaseSpotInfo> TSDGSpotInfo(HashMap<String, Object> param);
 }

+ 5 - 1
src/main/java/com/steerinfo/baseinfo/meterbasespotinfo/service/impl/MeterBaseSpotInfoServiceImpl.java

@@ -223,5 +223,9 @@ public class MeterBaseSpotInfoServiceImpl extends BaseServiceImpl<MeterBaseSpotI
         return meterBaseSpotInfoMapper.selectByPrimaryKey(model.getBaseSpotNo());
     }
 
-
+    @Override
+    public List<MeterBaseSpotInfo> TSDGSpotInfo(HashMap<String, Object> param) {
+        List<MeterBaseSpotInfo> models = meterBaseSpotInfoMapper.TSDGSpotInfo(param);
+        return models;
+    }
 }

+ 121 - 115
src/main/java/com/steerinfo/baseinfo/meterbasetermtaredata/service/impl/MeterBaseTermTareDataServiceImpl.java

@@ -23,6 +23,7 @@ import com.steerinfo.meterwork.except.MarkerMetException;
 import com.steerinfo.meterwork.meterworkcaractualfirst.mapper.MeterWorkCarActualFirstMapper;
 import com.steerinfo.meterwork.meterworkcaractualfirst.model.MeterWorkCarActualFirst;
 import com.steerinfo.util.FieldsCollector;
+import com.steerinfo.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -250,126 +251,131 @@ public class MeterBaseTermTareDataServiceImpl extends BaseServiceImpl<MeterBaseT
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public RESTfulResult doSaveTerm(String id) {
         RESTfulResult rm = new RESTfulResult();
-        rm.setCode("200");
-
-        //从一次计量表里取出:车号、计量点编号、计量点名称、计量时间、计量重量
-        String actualFirstNo = id;
-        MeterWorkCarActualFirst modelTemp = meterWorkCarActualFirstMapper.selectByPrimaryKey(actualFirstNo);
-        String carNo = modelTemp.getCarNo();
-        String baseSpotName = modelTemp.getBaseSpotName();
-        String baseSpotNo = modelTemp.getBaseSpotNo();
-        Date meterTime = modelTemp.getCreateTime();
-        BigDecimal meterWeight = modelTemp.getMeterWeight();
-        if(carNo == null){
-            rm.setMessage("车号不能为空,请确认!!");
-            rm.setCode("1");
-            return rm;
-        }
-        if(baseSpotNo == null && baseSpotName  == null){
-            rm.setMessage("计量点编号或者计量点名称为空,请确认!!");
-            rm.setCode("1");
-            return rm;
-        }
-        if(meterTime == null){
-            rm.setMessage("计量时间不能为空!!");
-            rm.setCode("1");
-            return rm;
-        }
-
-        HashMap<String, Object> ms = new HashMap<>();
-        ms.put("carNo", carNo);
-        ms.put("validFlag", "0");
-        ms.put("carTypeNo", "001004003");
-        List<MeterBaseCar> models = meterBaseCarMapper.selectByParameters(ms);
-        if(models.size() < 1 ) {
-            rm.setMessage("车辆不是内部车辆不能留存期限皮!!");
-            rm.setCode("1");
-            return rm;
-        }
+        rm.setFailed();
+        try{
+            //从一次计量表里取出:车号、计量点编号、计量点名称、计量时间、计量重量
+            String actualFirstNo = id;
+            MeterWorkCarActualFirst modelTemp = meterWorkCarActualFirstMapper.selectByPrimaryKey(actualFirstNo);
+            String carNo = modelTemp.getCarNo();
+            String baseSpotName = modelTemp.getBaseSpotName();
+            String baseSpotNo = modelTemp.getBaseSpotNo();
+            Date meterTime = modelTemp.getCreateTime();
+            BigDecimal meterWeight = modelTemp.getMeterWeight();
+            if(StringUtils.isEmpty(carNo)){
+                rm.setMessage("车号不能为空,请确认!!");
+                rm.setCode("1");
+                return rm;
+            }
+            if(StringUtils.isEmpty(baseSpotNo) && StringUtils.isEmpty(baseSpotName)){
+                rm.setMessage("计量点编号或者计量点名称为空,请确认!!");
+                rm.setCode("1");
+                return rm;
+            }
+            if(meterTime == null || StringUtils.isEmpty(meterTime.toString())){
+                rm.setMessage("计量时间不能为空!!");
+                rm.setCode("1");
+                return rm;
+            }
 
-        UserPayload payload = UserPayload.getCurrUser();
-        String userId = payload.getId();
-        String userName = payload.getUserName();
-        if(modelTemp.getWeightType().equals("0")) {
-            rm.setMessage("计量类型为毛重,不能进行期限皮重保存!!");
-            rm.setCode("1");
-            return rm;
-        }else {
-            modelTemp.setWeightType("2");
-            modelTemp.setValueFlag("0");
-            modelTemp.setUpdateManName(userId);
-            modelTemp.setUpdateManNo(userName);
-            modelTemp.setUpdateTime(new Date());
-            modelTemp.setNote("期限皮重保存");
-            meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(modelTemp);
-        }
+            HashMap<String, Object> ms = new HashMap<>();
+            ms.put("carNo", carNo);
+            ms.put("validFlag", "0");
+            ms.put("carTypeNo", "001004003");
+            List<MeterBaseCar> models = meterBaseCarMapper.selectByParameters(ms);
+            if(models.size() < 1 ) {
+                rm.setMessage("车辆不是内部车辆不能留存期限皮!!");
+                rm.setCode("1");
+                return rm;
+            }
+            String userId = "";
+            String userName = "";
+            try{
+                UserPayload payload = UserPayload.getCurrUser();
+                userId = payload.getUserCode();
+                userName = payload.getUserName();
+            }catch(Exception e) {
+                userId = "system";
+                userName = "system";
+            }
+            if(StringUtils.isEmpty(modelTemp.getWeightType())
+                    || !(modelTemp.getWeightType().equals("1") || modelTemp.getWeightType().equals("2"))) {
+                rm.setMessage("计量类型不是皮重类型,请进行毛皮转换成皮重之后再保存期限皮!!");
+                rm.setCode("1");
+                return rm;
+            }else {
+                modelTemp.setWeightType("2");
+                modelTemp.setValueFlag("0");
+                modelTemp.setUpdateManName(userId);
+                modelTemp.setUpdateManNo(userName);
+                modelTemp.setUpdateTime(new Date());
+                modelTemp.setNote("期限皮重保存");
+                meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(modelTemp);
+            }
 
-        if(userId == null && userName == null){
-            rm.setMessage("计量人编号或者计量员为空,请确认");
-            rm.setCode("1");
-            return rm;
-        }
-        //根据车号查询期限表的期限皮重信息
-        HashMap<String, Object> map = new HashMap();
-        map.put("carNo", carNo);
-        MeterBaseTermTareData modelTerm = meterBaseTermTareDataMapper.selectWhereCarNo(map);
-        //设置数据编号
-        MeterBaseTermTareData model = new MeterBaseTermTareData();
-
-        //设置计量点编号、名称、车号
-        model.setBaseSpotName(baseSpotName);
-        model.setBaseSpotNo(baseSpotNo);
-        model.setCarNo(carNo);
-        //设置皮重时间、开始时间、结束时间、提醒留皮时间
-        HashMap<String, Object> tareTimemap = new HashMap();
-        tareTimemap.put("valueFlag", "0");
-        MeterBaseTermTareTime tareTimeModel = meterBaseTermTareTimeMapper.selectByMap(tareTimemap);
-        if(tareTimeModel != null){
-            Date endDate = new Date();
-            Date warnDate = new Date();
-            int day = tareTimeModel.getFixedValue();
-            endDate.setDate(endDate.getDate()+day);
-            warnDate.setDate(warnDate.getDate()+tareTimeModel.getWarnValue());
-            model.setStartTime(new Date());
-            model.setEndTime(new Date(endDate.getTime()));
-            model.setWarnTime(new Date(warnDate.getTime()));
-        }else{
-            rm.setMessage("计量人编号或者计量员为空,请确认");
-            rm.setCode("1");
-            return rm;
-        }
-        model.setMeterTime(meterTime);
-
-        //设置状态(0:有效;1:无效)、创建人编号、创建人、创建时间
-        model.setValueFlag("0");
-        model.setCreateManNo(userId);
-        model.setCreateManName(userName);
-
-        //model.setCreateManNo("userId");
-        //model.setCreateManName("userName");
-        model.setCreateTime(new Date());
-        //设置皮重次数(默认7次)、设置皮重
-        model.setMeterNum(7L);
-        model.setMeterWeight(meterWeight);
-        //期限皮表未查到车号信息,直接插入,否则,更新车号信息
-        if(modelTerm == null){
-            model.setUpWeight(meterWeight.longValue());
-            model.setAvgWeight(meterWeight.longValue());
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
-            model.setDataNo(sdf.format(new Date()));
-            meterBaseTermTareDataMapper.insertSelective(model);
-        }else if(modelTerm.getCarNo().equals(carNo)){
-            //设置上一次皮重、平均皮重
-            model.setUpWeight(modelTerm.getMeterWeight().longValue());  //BigDecimal转long类型
-            long avgValue = modelTerm.getAvgWeight() == null? 0: modelTerm.getAvgWeight();
-            long avg =avgValue + modelTerm.getMeterWeight().longValue();
-            model.setAvgWeight(avg/2);
-            model.setDataNo(modelTerm.getDataNo());
-            meterBaseTermTareDataMapper.updateByPrimaryKeySelective(model);
+            //根据车号查询期限表的期限皮重信息
+            HashMap<String, Object> map = new HashMap();
+            map.put("carNo", carNo);
+            MeterBaseTermTareData modelTerm = meterBaseTermTareDataMapper.selectWhereCarNo(map);
+            //设置数据编号
+            MeterBaseTermTareData model = new MeterBaseTermTareData();
+            //设置计量点编号、名称、车号
+            model.setBaseSpotName(baseSpotName);
+            model.setBaseSpotNo(baseSpotNo);
+            model.setCarNo(carNo);
+            //设置皮重时间、开始时间、结束时间、提醒留皮时间
+            HashMap<String, Object> tareTimemap = new HashMap();
+            tareTimemap.put("valueFlag", "0");
+            MeterBaseTermTareTime tareTimeModel = meterBaseTermTareTimeMapper.selectByMap(tareTimemap);
+            if(tareTimeModel != null){
+                Date endDate = new Date();
+                Date warnDate = new Date();
+                int day = tareTimeModel.getFixedValue();
+                endDate.setDate(endDate.getDate()+day);
+                warnDate.setDate(warnDate.getDate()+tareTimeModel.getWarnValue());
+                model.setStartTime(new Date());
+                model.setEndTime(new Date(endDate.getTime()));
+                model.setWarnTime(new Date(warnDate.getTime()));
+            }else{
+                rm.setMessage("计量人编号或者计量员为空,请确认");
+                rm.setCode("1");
+                return rm;
+            }
+            model.setMeterTime(meterTime);
+            //设置状态(0:有效;1:无效)、创建人编号、创建人、创建时间
+            model.setValueFlag("0");
+            model.setCreateManNo(userId);
+            model.setCreateManName(userName);
+            model.setCreateTime(new Date());
+            //设置皮重次数(默认7次)、设置皮重
+            model.setMeterNum(7L);
+            model.setMeterWeight(meterWeight);
+            //期限皮表未查到车号信息,直接插入,否则,更新车号信息
+            if(modelTerm == null){
+                model.setUpWeight(meterWeight.longValue());
+                model.setAvgWeight(meterWeight.longValue());
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+                model.setDataNo(sdf.format(new Date()));
+                meterBaseTermTareDataMapper.insertSelective(model);
+            }else if(modelTerm.getCarNo().equals(carNo)){
+                //设置上一次皮重、平均皮重
+                model.setUpWeight(modelTerm.getMeterWeight().longValue());  //BigDecimal转long类型
+                long avgValue = modelTerm.getAvgWeight() == null? 0: modelTerm.getAvgWeight();
+                long avg =avgValue + modelTerm.getMeterWeight().longValue();
+                model.setAvgWeight(avg/2);
+                model.setDataNo(modelTerm.getDataNo());
+                meterBaseTermTareDataMapper.updateByPrimaryKeySelective(model);
+            }
+            rm.setSucceed();
+            rm.setCode("200");
+            rm.setMessage("操作成功");
+        }catch(Exception e) {
+            e.printStackTrace();
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            rm.setMessage("操作失败," + e.getMessage());
         }
-        rm.setMessage("操作成功");
         return rm;
     }
 

+ 31 - 6
src/main/java/com/steerinfo/meterwork/meterworkparammap/service/impl/MeterWorkParamMapService.java

@@ -40,37 +40,62 @@ public class MeterWorkParamMapService implements IMeterWorkParamMapService {
     @Override
     public RESTfulResult combinationByParams(HashMap<String, Object> params) {
         RESTfulResult rm = new RESTfulResult();
+        rm.setFailed();
         try{
             String baseSpotNo = params.get("baseSpotNo") == null ? "": params.get("baseSpotNo").toString();
             String carNo = params.get("carNo") == null ? "": params.get("carNo").toString();
             String predictionNo = params.get("predicitonNo") == null ? "": params.get("predicitonNo").toString();
-
+            HashMap<String, Object> paramMap = new HashMap<>();
             //根据称点查询监控信息
             HashMap<String, Object> spotInfoMap = new HashMap<>();
             spotInfoMap.put("pointNo", baseSpotNo);
             List<MeterWorkMonitor> spotInfoList = meterWorkMonitorMapper.selectByParameters(spotInfoMap);
-
+            if(spotInfoList.size() >= 1){
+                paramMap.put("spotInfoList", spotInfoList);
+            }else {
+                paramMap.put("spotInfoList", null);
+            }
             // VALUE_FLAG 状态(0=作废,1=有效(已匹配),2=结净,3=未匹配)
             // 根据车号查询最近的一次计量数据
             List<MeterWorkCarActualFirst> firstInfoList = meterWorkCarActualFirstMapper.selectByCarNo(carNo);
-
+            if(spotInfoList.size() >= 1){
+                paramMap.put("firstInfoList", firstInfoList);
+            }else {
+                paramMap.put("firstInfoList", null);
+            }
             // 根据车号查询委托表中未使用和使用中的委托
             // 状态(0:未配车;1:未使用;2:已使用;3:已作废;4:正使用)
             HashMap<String, Object> scaleInfoMap = new HashMap<>();
             scaleInfoMap.put("carNo", carNo);
             List<PreTrackScale> scaleInfoList = preTrackScaleMapper.selectBy(scaleInfoMap);
-
+            if(spotInfoList.size() >= 1){
+                paramMap.put("scaleInfoList", scaleInfoList);
+            }else {
+                paramMap.put("scaleInfoList", null);
+            }
             //计量实绩
             HashMap<String, Object> actualInfoMap = new HashMap<>();
             actualInfoMap.put("carNo", carNo);
             List<MeterWorkCarActual> actualInfoList = meterWorkCarActualMapper.selectByMap(actualInfoMap);
-
+            if(spotInfoList.size() >= 1){
+                paramMap.put("actualInfoList", actualInfoList);
+            }else {
+                paramMap.put("actualInfoList", null);
+            }
             // 签发时间比较
             // 通过上次结净记录,找到该委托的签发时间
             HashMap<String, Object> scaleNewInfoMap = new HashMap<>();
             scaleNewInfoMap.put("predictionNo", predictionNo);
             List<PreTrackScale> scaleNewInfoList = preTrackScaleMapper.selectByParameters(scaleNewInfoMap);
-
+            if(spotInfoList.size() >= 1){
+                paramMap.put("scaleNewInfoList", scaleNewInfoList);
+            }else {
+                paramMap.put("scaleNewInfoList", null);
+            }
+            rm.setSucceed(true);
+            rm.setCode("200");
+            rm.setData(paramMap);
+            rm.setMessage("操作成功");
         }catch(Exception e) {
             e.printStackTrace();
             rm.setMessage("操作异常," + e.getMessage());

+ 1 - 1
src/main/java/com/steerinfo/meterwork/meterworkrailwayactfirst/mapper/MeterWorkRailwayActFirstMapper.xml

@@ -3502,7 +3502,7 @@
         and ACTUAL_FIRST_NO LIKE '%${actualFirstNo}%'
       </if>
       <if test="railwayNo != null and railwayNo != ''">
-        and RAILWAY_NO LIKE '%${railwayNo}%'
+        and RAILWAY_NO LIKE '%${railwayNo}'
       </if>
       <if test="predictionNo != null and predictionNo != ''">
         and PREDICTION_NO like '%${predictionNo}%'