소스 검색

后端接口

dengyj 4 년 전
부모
커밋
4eafee754d

+ 34 - 1
src/main/java/com/steerinfo/baseinfo/meterbasecar/controller/MeterBaseCarController.java

@@ -237,12 +237,30 @@ public class MeterBaseCarController extends BaseRESTfulController {
                     MeterBaseCar car = new MeterBaseCar();
                     car.setCarNo(params.get("carNo").toString());
                     car.setValidFlag("0");
-                    car.setIsSpecialunit(params.get("isSpecialunit").toString());
+
+                    String unitNo = params.get("unitNo").toString();
+                    HashMap<String, Object> unitMap = new HashMap<>();
+                    unitMap.put("unitNo", unitNo);
+
+                    List<MeterBaseSpecialUnit> unitList = meterBaseSpecialUnitMapper.selectByParameters(unitMap);
+                    if(unitList.size() >= 1) {
+                        if(unitNo.equals(unitList.get(0).getUnitNo())) {
+                            car.setIsSpecialunit("1");
+                        }else {
+                            car.setIsSpecialunit("0");
+                        }
+                    }else {
+                        car.setIsSpecialunit("0");
+                    }
+                    car.setUsetDepartmentNo(params.get("unitNo").toString());
+                    car.setUsetDepartment(params.get("unitName").toString());
+
                     car.setCarTypeNo(params.get("carTypeNo").toString());
                     car.setCarTypeName(params.get("carTypeName").toString());
                     if (params.get("carCarrierWeight") != null) {
                         new BigDecimal(params.get("carCarrierWeight").toString());
                     }
+
                     // 将sso id写入车辆表,便于以后删除和重置密码
                     car.setSsoId(ssoMap.get("data").toString());
                     car.setCreateManNo("admin");
@@ -885,4 +903,19 @@ public class MeterBaseCarController extends BaseRESTfulController {
         }
     }
 
+    @ApiOperation(value = "根据车号是否是特殊单位信息", notes = "根据车号是否是特殊单位信息")
+    //@RequiresPermissions("meterbasecar:view")
+    @PostMapping(value = "/getUnitByCar")
+    public RESTfulResult getUnitByCar(@RequestBody Map params) {
+        try {
+            String carNo = params.get("carNo") == null ? "" : params.get("carNo").toString();
+            RESTfulResult rm = meterBaseCarService.getUnitByCar(carNo);
+            return rm;
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            throw new MarkerMetException(500, "操作异常!!");
+        }
+    }
+
+
 }

+ 35 - 8
src/main/java/com/steerinfo/baseinfo/meterbasecar/mapper/MeterBaseCarMapper.xml

@@ -33,6 +33,7 @@
     <result column="IS_INSURANCE" jdbcType="VARCHAR" property="isInsurance" />
     <result column="OTHER_INSURANCE" jdbcType="VARCHAR" property="otherInsurance" />
     <result column="IS_SPECIALUNIT" jdbcType="VARCHAR" property="isSpecialunit" />
+    <result column="USET_DEPARTMENT_NO" jdbcType="VARCHAR" property="usetDepartmentNo" />
   </resultMap>
   <sql id="columns">
     PK_NO, CAR_NO, MNEMONIC_CODE, CUSTOMER_SUPPLIER_NO, CUSTOMER_SUPPLIER_NAME, CAR_TYPE_NO, 
@@ -40,7 +41,7 @@
     CREATE_MAN_NAME, CREATE_TIME, UPDATE_MAN_NO, UPDATE_MAN_NAME, UPDATE_TIME, DELETE_MAN_NO, 
     DELETE_MAN_NAME, DELETE_TIME, SSO_ID, VEHICLE_TYPE, BELONG_UNIT_TYPE_NO, BELONG_UNIT_TYPE_NAME, 
     USET_DEPARTMENT, VEHICLE_IDENTIFY_NO, FILLING_DEPARTMENT, FILLING_USER, IS_INSURANCE, 
-    OTHER_INSURANCE, IS_SPECIALUNIT
+    OTHER_INSURANCE, IS_SPECIALUNIT, USET_DEPARTMENT_NO
   </sql>
   <sql id="columns_alias">
     t.PK_NO, t.CAR_NO, t.MNEMONIC_CODE, t.CUSTOMER_SUPPLIER_NO, t.CUSTOMER_SUPPLIER_NAME, 
@@ -49,7 +50,7 @@
     t.UPDATE_MAN_NAME, t.UPDATE_TIME, t.DELETE_MAN_NO, t.DELETE_MAN_NAME, t.DELETE_TIME, 
     t.SSO_ID, t.VEHICLE_TYPE, t.BELONG_UNIT_TYPE_NO, t.BELONG_UNIT_TYPE_NAME, t.USET_DEPARTMENT, 
     t.VEHICLE_IDENTIFY_NO, t.FILLING_DEPARTMENT, t.FILLING_USER, t.IS_INSURANCE, t.OTHER_INSURANCE, 
-    t.IS_SPECIALUNIT
+    t.IS_SPECIALUNIT, t.USET_DEPARTMENT_NO
   </sql>
   <sql id="select">
     SELECT <include refid="columns"/> FROM METER_BASE_CAR
@@ -152,6 +153,9 @@
       <if test="isSpecialunit != null and isSpecialunit != ''">
         and IS_SPECIALUNIT = #{isSpecialunit}
       </if>
+      <if test="usetDepartmentNo != null and usetDepartmentNo != ''">
+        and USET_DEPARTMENT_NO = #{usetDepartmentNo}
+      </if>
     </where>
   </sql>
   <sql id="whereLike">
@@ -249,6 +253,9 @@
       <if test="isSpecialunit != null and isSpecialunit != ''">
         and IS_SPECIALUNIT LIKE '%${isSpecialunit}%'
       </if>
+      <if test="usetDepartmentNo != null and usetDepartmentNo != ''">
+        and USET_DEPARTMENT_NO LIKE '%${usetDepartmentNo}%'
+      </if>
     </where>
   </sql>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
@@ -348,6 +355,9 @@
       <if test="isSpecialunit != null and isSpecialunit != ''">
         or IS_SPECIALUNIT = #{isSpecialunit}
       </if>
+      <if test="usetDepartmentNo != null and usetDepartmentNo != ''">
+        or USET_DEPARTMENT_NO = #{usetDepartmentNo}
+      </if>
   </delete>
   <insert id="insert" parameterType="com.steerinfo.baseinfo.meterbasecar.model.MeterBaseCar">
     insert into METER_BASE_CAR (PK_NO, CAR_NO, MNEMONIC_CODE, 
@@ -360,7 +370,8 @@
       SSO_ID, VEHICLE_TYPE, BELONG_UNIT_TYPE_NO, 
       BELONG_UNIT_TYPE_NAME, USET_DEPARTMENT, VEHICLE_IDENTIFY_NO, 
       FILLING_DEPARTMENT, FILLING_USER, IS_INSURANCE, 
-      OTHER_INSURANCE, IS_SPECIALUNIT)
+      OTHER_INSURANCE, IS_SPECIALUNIT, USET_DEPARTMENT_NO
+      )
     values (#{pkNo,jdbcType=VARCHAR}, #{carNo,jdbcType=VARCHAR}, #{mnemonicCode,jdbcType=VARCHAR}, 
       #{customerSupplierNo,jdbcType=VARCHAR}, #{customerSupplierName,jdbcType=VARCHAR}, 
       #{carTypeNo,jdbcType=VARCHAR}, #{carTypeName,jdbcType=VARCHAR}, #{carCarrierWeight,jdbcType=DECIMAL}, 
@@ -371,7 +382,8 @@
       #{ssoId,jdbcType=VARCHAR}, #{vehicleType,jdbcType=VARCHAR}, #{belongUnitTypeNo,jdbcType=VARCHAR}, 
       #{belongUnitTypeName,jdbcType=VARCHAR}, #{usetDepartment,jdbcType=VARCHAR}, #{vehicleIdentifyNo,jdbcType=VARCHAR}, 
       #{fillingDepartment,jdbcType=VARCHAR}, #{fillingUser,jdbcType=VARCHAR}, #{isInsurance,jdbcType=VARCHAR}, 
-      #{otherInsurance,jdbcType=VARCHAR}, #{isSpecialunit,jdbcType=VARCHAR})
+      #{otherInsurance,jdbcType=VARCHAR}, #{isSpecialunit,jdbcType=VARCHAR}, #{usetDepartmentNo,jdbcType=VARCHAR}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.steerinfo.baseinfo.meterbasecar.model.MeterBaseCar">
     insert into METER_BASE_CAR
@@ -469,6 +481,9 @@
       <if test="isSpecialunit != null">
         IS_SPECIALUNIT,
       </if>
+      <if test="usetDepartmentNo != null">
+        USET_DEPARTMENT_NO,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="pkNo != null">
@@ -564,6 +579,9 @@
       <if test="isSpecialunit != null">
         #{isSpecialunit,jdbcType=VARCHAR},
       </if>
+      <if test="usetDepartmentNo != null">
+        #{usetDepartmentNo,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.steerinfo.baseinfo.meterbasecar.model.MeterBaseCar">
@@ -597,7 +615,8 @@
       FILLING_USER = #{fillingUser,jdbcType=VARCHAR},
       IS_INSURANCE = #{isInsurance,jdbcType=VARCHAR},
       OTHER_INSURANCE = #{otherInsurance,jdbcType=VARCHAR},
-      IS_SPECIALUNIT = #{isSpecialunit,jdbcType=VARCHAR}
+      IS_SPECIALUNIT = #{isSpecialunit,jdbcType=VARCHAR},
+      USET_DEPARTMENT_NO = #{usetDepartmentNo,jdbcType=VARCHAR}
     where PK_NO = #{pkNo,jdbcType=VARCHAR}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.baseinfo.meterbasecar.model.MeterBaseCar">
@@ -693,6 +712,9 @@
       <if test="isSpecialunit != null">
         IS_SPECIALUNIT = #{isSpecialunit,jdbcType=VARCHAR},
       </if>
+      <if test="usetDepartmentNo != null">
+        USET_DEPARTMENT_NO = #{usetDepartmentNo,jdbcType=VARCHAR},
+      </if>
     </set>
     where PK_NO = #{pkNo,jdbcType=VARCHAR}
   </update>
@@ -722,7 +744,8 @@
       BELONG_UNIT_TYPE_NAME, USET_DEPARTMENT, 
       VEHICLE_IDENTIFY_NO, FILLING_DEPARTMENT, 
       FILLING_USER, IS_INSURANCE, OTHER_INSURANCE, 
-      IS_SPECIALUNIT)
+      IS_SPECIALUNIT, USET_DEPARTMENT_NO
+      )
     ( <foreach collection="list" item="item" separator="union all"> 
    select  
       #{item.pkNo,jdbcType=VARCHAR}, 
@@ -737,7 +760,8 @@
       #{item.belongUnitTypeName,jdbcType=VARCHAR}, #{item.usetDepartment,jdbcType=VARCHAR}, 
       #{item.vehicleIdentifyNo,jdbcType=VARCHAR}, #{item.fillingDepartment,jdbcType=VARCHAR}, 
       #{item.fillingUser,jdbcType=VARCHAR}, #{item.isInsurance,jdbcType=VARCHAR}, #{item.otherInsurance,jdbcType=VARCHAR}, 
-      #{item.isSpecialunit,jdbcType=VARCHAR} from dual  
+      #{item.isSpecialunit,jdbcType=VARCHAR}, #{item.usetDepartmentNo,jdbcType=VARCHAR}
+       from dual  
    </foreach> )
   </insert>
   <update id="batchUpdate" parameterType="java.util.List">
@@ -867,6 +891,10 @@
        <foreach collection="list" item="item" index="index" separator=" " open="case PK_NO" close="end">
           when #{item.pkNo,jdbcType=VARCHAR} then #{item.isSpecialunit,jdbcType=VARCHAR}
        </foreach>
+       ,USET_DEPARTMENT_NO=
+       <foreach collection="list" item="item" index="index" separator=" " open="case PK_NO" close="end">
+          when #{item.pkNo,jdbcType=VARCHAR} then #{item.usetDepartmentNo,jdbcType=VARCHAR}
+       </foreach>
      where PK_NO in 
      <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
     #{item.pkNo,jdbcType=VARCHAR}
@@ -930,5 +958,4 @@
       and car_type_no = '001004003'
     </if>
   </select>
-  
 </mapper>

+ 18 - 2
src/main/java/com/steerinfo/baseinfo/meterbasecar/model/MeterBaseCar.java

@@ -3,6 +3,7 @@ package com.steerinfo.baseinfo.meterbasecar.model;
 import com.steerinfo.framework.model.IBasePO;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -153,9 +154,9 @@ public class MeterBaseCar implements IBasePO<String> {
     private String belongUnitTypeName;
 
     /**
-     * 使用部门(USET_DEPARTMENT,VARCHAR,255)
+     * 使用部门名称(USET_DEPARTMENT,VARCHAR,255)
      */
-    @ApiModelProperty(value="使用部门",required=false)
+    @ApiModelProperty(value="使用部门名称",required=false)
     private String usetDepartment;
 
     /**
@@ -194,6 +195,12 @@ public class MeterBaseCar implements IBasePO<String> {
     @ApiModelProperty(value="是否特殊单位(0:非特殊  1:特殊)",required=false)
     private String isSpecialunit;
 
+    /**
+     * 使用部门编号(USET_DEPARTMENT_NO,VARCHAR,30)
+     */
+    @ApiModelProperty(value="使用部门编号",required=false)
+    private String usetDepartmentNo;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -454,6 +461,14 @@ public class MeterBaseCar implements IBasePO<String> {
         this.isSpecialunit = isSpecialunit == null ? null : isSpecialunit.trim();
     }
 
+    public String getUsetDepartmentNo() {
+        return usetDepartmentNo;
+    }
+
+    public void setUsetDepartmentNo(String usetDepartmentNo) {
+        this.usetDepartmentNo = usetDepartmentNo == null ? null : usetDepartmentNo.trim();
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -491,6 +506,7 @@ public class MeterBaseCar implements IBasePO<String> {
         sb.append(", isInsurance=").append(isInsurance);
         sb.append(", otherInsurance=").append(otherInsurance);
         sb.append(", isSpecialunit=").append(isSpecialunit);
+        sb.append(", usetDepartmentNo=").append(usetDepartmentNo);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 1 - 1
src/main/java/com/steerinfo/baseinfo/meterbasecar/service/IMeterBaseCarService.java

@@ -41,5 +41,5 @@ public interface IMeterBaseCarService extends IBaseService<MeterBaseCar, String>
 
     List<MeterBaseCar> queryForNoPage(HashMap<String, Object> parmas);
 
-
+    RESTfulResult getUnitByCar(String CarNo);
 }

+ 50 - 0
src/main/java/com/steerinfo/baseinfo/meterbasecar/service/impl/MeterBaseCarServiceImpl.java

@@ -2,6 +2,8 @@ package com.steerinfo.baseinfo.meterbasecar.service.impl;
 
 import com.steerinfo.baseinfo.meterbasedriver.mapper.MeterBaseDriverMapper;
 import com.steerinfo.baseinfo.meterbasedriver.model.MeterBaseDriver;
+import com.steerinfo.baseinfo.meterbasespecialunit.mapper.MeterBaseSpecialUnitMapper;
+import com.steerinfo.baseinfo.meterbasespecialunit.model.MeterBaseSpecialUnit;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
@@ -17,6 +19,7 @@ import com.steerinfo.util.FieldsCollector;
 import com.steerinfo.util.SSOUtil;
 import com.steerinfo.util.StringUtils;
 import io.micrometer.core.instrument.Meter;
+import org.apache.shiro.crypto.hash.Hash;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -49,6 +52,9 @@ public class MeterBaseCarServiceImpl extends BaseServiceImpl<MeterBaseCar, Strin
     @Resource
     private MeterWorkCarActualMapper meterWorkCarActualMapper;
 
+    @Resource
+    private MeterBaseSpecialUnitMapper meterBaseSpecialUnitMapper;
+
     @Resource
     private MeterBaseDriverMapper meterBaseDriverMapper;
 
@@ -260,6 +266,50 @@ public class MeterBaseCarServiceImpl extends BaseServiceImpl<MeterBaseCar, Strin
         return list;
     }
 
+    @Override
+    public RESTfulResult getUnitByCar(String CarNo) {
+        RESTfulResult rm = new RESTfulResult();
+        rm.setFailed();
+        try {
+            HashMap<String, Object> map = new HashMap<>();
+            map.put("carNo", CarNo);
+            List<MeterBaseCar> carModels = meterBaseCarMapper.selectByParameters(map);
+            if(carModels.size() >= 1) {
+                MeterBaseCar carModel = carModels.get(0);
+                String unitNo = carModel.getUsetDepartmentNo() == null ? "": carModel.getUsetDepartmentNo();
+                if(!unitNo.equals("")){
+                    HashMap<String, Object> unitMap = new HashMap<>();
+                    unitMap.put("unitNo", unitNo);
+
+                    List<MeterBaseSpecialUnit> unitList = meterBaseSpecialUnitMapper.selectByParameters(unitMap);
+                    if(unitList.size() >= 1) {
+                        if(unitNo.equals(unitList.get(0).getUnitNo())) {
+                            carModel.setIsSpecialunit("1");
+                        }else {
+                            carModel.setIsSpecialunit("0");
+                        }
+                        meterBaseCarMapper.updateByPrimaryKeySelective(carModel);
+                    }else {
+                        carModel.setIsSpecialunit("0");
+                        meterBaseCarMapper.updateByPrimaryKeySelective(carModel);
+                    }
+                }else {
+                    carModel.setIsSpecialunit("0");
+                    meterBaseCarMapper.updateByPrimaryKeySelective(carModel);
+                }
+                rm.setSucceed();
+                rm.setCode("200");
+                rm.setMessage("操作成功!!");
+                rm.setData(carModel);
+                return rm;
+            }
+        } catch(Exception e) {
+            e.printStackTrace();
+            rm.setMessage("操作异常,请确认!!>>>" + e.getMessage());
+        }
+        return rm;
+    }
+
     private String check(MeterBaseCar model)
     {
         if (model == null){

+ 2 - 0
src/main/java/com/steerinfo/meterwork/meterworkcaractual/controller/MeterWorkCarActualController.java

@@ -1,6 +1,8 @@
 package com.steerinfo.meterwork.meterworkcaractual.controller;
 
+import com.steerinfo.baseinfo.meterbasecar.model.MeterBaseCar;
 import com.steerinfo.baseinfo.meterbasematterinfoold.mapper.MeterBaseMatterInfoOldMapper;
+import com.steerinfo.baseinfo.meterbasespecialunit.model.MeterBaseSpecialUnit;
 import com.steerinfo.framework.controller.BaseRESTfulController;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageHelper;

+ 1 - 1
src/main/java/com/steerinfo/meterwork/meterworkcaractual/mapper/MeterWorkCarActualMapper.xml

@@ -3197,7 +3197,7 @@
                t1.actual_first_no ACTUAL_FIRST1_NO, t1.meter_weight GROSS_WEIGHT, t1.create_man_no GROSS_MAN_NO, t1.create_man_name GROSS_MAN_NAME, t1.create_time GROSS_TIME,
                t1.base_spot_no BASE_SPOT1_NO, t1.base_spot_name BASE_SPOT1_NAME,t1.meter_class GROSS_CLASS, t1.meter_group GROSS_GROUP, t1.meter_mode GROSS_MODE,
                t2.actual_first_no ACTUAL_FIRST2_NO, t2.meter_weight TARE_WEIGHT, t2.create_man_no TARE_MAN_NO, t2.create_man_name TARE_MAN_NAME, t2.create_time TARE_TIME,
-               t2.base_spot_no BASE_SPOT2_NO, t2.base_spot_name BASE_SPOT2_NAME, t2.meter_class TARE_CLASS, t2.meter_group TARE_GROUP,t2.meter_mode TARE_MODE,t1.METER_NUM METER_NUM
+               t2.base_spot_no BASE_SPOT2_NO, t2.base_spot_name BASE_SPOT2_NAME, t2.base_spot_no net_spot3_no, t2.base_spot_name net_spot3_name, t2.meter_class TARE_CLASS, t2.meter_group TARE_GROUP,t2.meter_mode TARE_MODE,t1.METER_NUM METER_NUM
         from METER_WORK_CAR_ACTUAL_FIRST t1,METER_WORK_CAR_ACTUAL_FIRST t2, PRE_TRACK_SCALE T3
         where t1.actual_first_no=#{actualFirstNo,jdbcType=VARCHAR} and t2.actual_first_no=#{dataNo,jdbcType=VARCHAR} AND T3.prediction_no =#{predictionNo,jdbcType=VARCHAR}
     </select>

+ 2 - 0
src/main/java/com/steerinfo/meterwork/meterworkcaractualfirst/service/impl/MeterWorkCarActualFirstServiceImpl.java

@@ -4063,6 +4063,8 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
                 model.setValueFlag("1");
                 model.setNetManNo("admin");
                 model.setNetManName("admin");
+                model.setNetSpot3No(tareModel.getBaseSpotNo());
+                model.setNetSpot3Name(tareModel.getBaseSpotName());
                 model.setPredictionNo(scale.getPredictionNo());
                 model.setPredictionType("1");
                 model.setNetWeight(grossModel.getMeterWeight().subtract(tareModel.getMeterWeight()));