txf 3 years ago
parent
commit
1381606aea

+ 1 - 1
pom.xml

@@ -147,7 +147,7 @@
                     <!--包名-->
                     <targetPackage>com.steerinfo.dil</targetPackage>
                     <tables>
-                        <param>AMSTRUCK_REQUIREMENT_MATERIAL</param>
+                        <param>TMSTRUCK_TARE_RETURN_RESULT</param>
                     </tables>
                 </configuration>
                 <executions>

+ 11 - 4
src/main/java/com/steerinfo/dil/controller/TmstruckMeasureCommissionController.java

@@ -79,10 +79,17 @@ public class TmstruckMeasureCommissionController extends BaseRESTfulController {
     @ApiOperation(value="发送留皮计量委托(neizhuan)")
     @GetMapping("/sendLiuPiMeasureCommission")
     public RESTfulResult sendLiuPiMeasureCommission(String capacityNumber){
-        String str = tmstruckMeasureCommissionService.sendLiuPiMeasureCommission(capacityNumber);
-        if("no".equals(str)){
-            return failed("发送失败!请联系管理员");
+        try {
+            Map<String, Object> map = tmstruckMeasureCommissionService.sendLiuPiMeasureCommission(capacityNumber);
+            String status = (String) map.get("status");
+            if("1".equals(status)){ //如果成功则返回编码,否则返回缘由
+                return success(map.get("purchOrder"));
+            }else {
+                return failed(map.get("mes"));
+            }
+        }catch (Exception e){
+            return failed("委托发送失败!请联系管理员");
         }
-        return success(str);
+
     }
 }

+ 19 - 0
src/main/java/com/steerinfo/dil/mapper/TmstruckTareReturnResultMapper.java

@@ -0,0 +1,19 @@
+package com.steerinfo.dil.mapper;
+
+import com.steerinfo.dil.model.TmstruckTareReturnResult;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import java.math.*;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+@Mapper
+public interface TmstruckTareReturnResultMapper extends IBaseMapper<TmstruckTareReturnResult, BigDecimal> {
+    //查询最大ID
+    @Select("select seq_tare_return_result.nextval from dual")
+    BigDecimal selectMaxId();
+
+    //通过车牌号查询委托信息
+    Map<String, Object> getMesByCapacityNum(String capacityNumber);
+}

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

@@ -90,5 +90,6 @@ public interface UtilsMapper {
     //根据运输订单id查找是否有多个物资
     Integer countMaterialByOrderId(BigDecimal orderId);
 
-
+    //通过车牌号查询运力ID
+    BigDecimal getCapacityIdByNum(String capacityNumber);
 }

+ 166 - 0
src/main/java/com/steerinfo/dil/model/TmstruckTareReturnResult.java

@@ -0,0 +1,166 @@
+package com.steerinfo.dil.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;
+
+@ApiModel(value="回皮委托表")
+public class TmstruckTareReturnResult implements IBasePO<BigDecimal> {
+    /**
+     * 主键ID(RESULT_ID,DECIMAL,0)
+     */
+    @ApiModelProperty(value="主键ID",required=true)
+    private BigDecimal resultId;
+
+    @ApiModelProperty(value="",required=false)
+    private BigDecimal capacityId;
+
+    /**
+     * 回皮委托号(RETURN_NUM,VARCHAR,30)
+     */
+    @ApiModelProperty(value="回皮委托号",required=false)
+    private String returnNum;
+
+    /**
+     * 委托发送时间(RETURN_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="委托发送时间",required=false)
+    private Date returnTime;
+
+    /**
+     * 记录创建人(INSERT_USERNAME,VARCHAR,20)
+     */
+    @ApiModelProperty(value="记录创建人",required=false)
+    private String insertUsername;
+
+    /**
+     * 记录创建时间(INSERT_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="记录创建时间",required=false)
+    private Date insertTime;
+
+    /**
+     * 记录修改人(UPDATE_USERNAME,VARCHAR,20)
+     */
+    @ApiModelProperty(value="记录修改人",required=false)
+    private String updateUsername;
+
+    /**
+     * 记录修改时间(UPDATE_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="记录修改时间",required=false)
+    private Date updateTime;
+
+    /**
+     * 记录创建或修改备注(INSERT_UPDATE_REMARK,VARCHAR,100)
+     */
+    @ApiModelProperty(value="记录创建或修改备注",required=false)
+    private String insertUpdateRemark;
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public BigDecimal getId() {
+        return this.resultId;
+    }
+
+    @Override
+    public void setId(BigDecimal resultId) {
+        this.resultId = resultId;
+    }
+
+    public BigDecimal getResultId() {
+        return resultId;
+    }
+
+    public void setResultId(BigDecimal resultId) {
+        this.resultId = resultId;
+    }
+
+    public BigDecimal getCapacityId() {
+        return capacityId;
+    }
+
+    public void setCapacityId(BigDecimal capacityId) {
+        this.capacityId = capacityId;
+    }
+
+    public String getReturnNum() {
+        return returnNum;
+    }
+
+    public void setReturnNum(String returnNum) {
+        this.returnNum = returnNum == null ? null : returnNum.trim();
+    }
+
+    public Date getReturnTime() {
+        return returnTime;
+    }
+
+    public void setReturnTime(Date returnTime) {
+        this.returnTime = returnTime;
+    }
+
+    public String getInsertUsername() {
+        return insertUsername;
+    }
+
+    public void setInsertUsername(String insertUsername) {
+        this.insertUsername = insertUsername == null ? null : insertUsername.trim();
+    }
+
+    public Date getInsertTime() {
+        return insertTime;
+    }
+
+    public void setInsertTime(Date insertTime) {
+        this.insertTime = insertTime;
+    }
+
+    public String getUpdateUsername() {
+        return updateUsername;
+    }
+
+    public void setUpdateUsername(String updateUsername) {
+        this.updateUsername = updateUsername == null ? null : updateUsername.trim();
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String getInsertUpdateRemark() {
+        return insertUpdateRemark;
+    }
+
+    public void setInsertUpdateRemark(String insertUpdateRemark) {
+        this.insertUpdateRemark = insertUpdateRemark == null ? null : insertUpdateRemark.trim();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", resultId=").append(resultId);
+        sb.append(", capacityId=").append(capacityId);
+        sb.append(", returnNum=").append(returnNum);
+        sb.append(", returnTime=").append(returnTime);
+        sb.append(", insertUsername=").append(insertUsername);
+        sb.append(", insertTime=").append(insertTime);
+        sb.append(", updateUsername=").append(updateUsername);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append(", insertUpdateRemark=").append(insertUpdateRemark);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

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

@@ -31,5 +31,5 @@ public interface ITmstruckMeasureCommissionService{
     //发送计量委托
     int sendMeasureCommssion(Map<String,Object> map);
 
-    String sendLiuPiMeasureCommission(String capacityNumber);
+    Map<String, Object>  sendLiuPiMeasureCommission(String capacityNumber) throws InterruptedException;
 }

+ 53 - 15
src/main/java/com/steerinfo/dil/service/impl/TmstruckMeasureCommissionServiceImpl.java

@@ -4,11 +4,15 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.steerinfo.dil.mapper.RulesMapper;
 import com.steerinfo.dil.mapper.TmstruckMeasureCommissionMapper;
+import com.steerinfo.dil.mapper.TmstruckTareReturnResultMapper;
 import com.steerinfo.dil.mapper.UtilsMapper;
 import com.steerinfo.dil.model.TmstruckMeasureCommission;
+import com.steerinfo.dil.model.TmstruckTareReturnResult;
 import com.steerinfo.dil.service.ITmstruckMeasureCommissionService;
 import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.dil.util.HTTPRequestUtils;
+import com.sun.java.swing.plaf.motif.MotifMenuBarUI;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -42,6 +46,8 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
     UtilsMapper utilsMapper;
     @Autowired
     private RulesServiceImpl rulesService;
+    @Autowired
+    private TmstruckTareReturnResultMapper tmstruckTareReturnResultMapper;
 
     private static final  String daGangUrl = "http://172.16.33.122:44325/api/logistics/TareApplyFor";
 
@@ -548,22 +554,53 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
      * @return
      **/
     @Override
-    synchronized public String sendLiuPiMeasureCommission(String capacityNumber) {
+    synchronized public Map<String, Object> sendLiuPiMeasureCommission(String capacityNumber) throws InterruptedException {
         Map<String, Object> map = new HashMap<>();
         String num = "LP" + System.currentTimeMillis();
         map.put("carNumber", capacityNumber);
         map.put("purchOrder", num);
-        int i = sendMesToMeasure2(map, liuPiUrl);
-        if(i != 1){
-            return "no";
+        //通过车牌号查询上一次委托发送数据
+        Map<String, Object> mesMap = tmstruckTareReturnResultMapper.getMesByCapacityNum(capacityNumber);
+        if(mesMap != null){
+            Date lastDate = (Date) mesMap.get("returnTime");
+            if((System.currentTimeMillis() - lastDate.getTime()) < 3600000){ //小于一小时重复点击 返回上一次发送的委托号
+                map.put("status", "1");
+                map.put("purchOrder", mesMap.get("returnNum"));
+            }else {
+                //进行委托发送正常流程
+                dataDealWith(map, mesMap);
+            }
+        }else {
+            dataDealWith(map, null);
         }
-        // 设置单线程避免因网络问题同一时间高并发导致时间戳重复  (访问接口需要时间 也可能不需要)
-        try {
-            Thread.sleep(1);
-        } catch (InterruptedException e) {
-            e.printStackTrace();
+        Thread.sleep(1); //避免网络问题多设备同时请求导致高并发 导致委托号相同(同一时间点)
+        return map;
+    }
+
+    public void dataDealWith(Map<String, Object> map, Map<String, Object> mesMap){
+        String carNumber = (String) map.get("carNumber");
+        //委托发送正常流程
+        String isOK = sendMesToMeasure2(map);
+        if("ok".equals(isOK)){
+            //如果委托正常发送,则保存数据并返回
+            map.put("status", "1");
+            TmstruckTareReturnResult tmstruckTareReturnResult = new TmstruckTareReturnResult();
+            tmstruckTareReturnResult.setId(tmstruckTareReturnResultMapper.selectMaxId());
+            tmstruckTareReturnResult.setReturnTime(new Date());
+            tmstruckTareReturnResult.setReturnNum((String) map.get("purchOrder"));
+            tmstruckTareReturnResult.setInsertTime(new Date());
+            tmstruckTareReturnResult.setInsertUsername(carNumber);
+            if(mesMap == null){
+                //通过车牌号查询运力ID
+                tmstruckTareReturnResult.setCapacityId(utilsMapper.getCapacityIdByNum(carNumber));
+            }else {
+                tmstruckTareReturnResult.setCapacityId(DataChange.dataToBigDecimal(mesMap.get("capacityId")));
+            }
+            tmstruckTareReturnResultMapper.insertSelective(tmstruckTareReturnResult);
+        }else {
+            map.put("status", "0");
+            map.put("mes", isOK);
         }
-        return num;
     }
 
     /**
@@ -571,14 +608,13 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
      * @Author TXF
      * @Date 2022/3/8 16:19
      * @param map
-     * @param url
      * @return
      **/
-    public int sendMesToMeasure2(Map<String, Object> map, String url){
+    public String sendMesToMeasure2(Map<String, Object> map){
         JSONObject jsonObject = new JSONObject(map);
         String jsonData = null;
         try {
-            jsonData = HTTPRequestUtils.send(url, jsonObject, "utf-8");
+            jsonData = HTTPRequestUtils.send(liuPiUrl, jsonObject, "utf-8");
         } catch (IOException e) {
             e.printStackTrace();
         }
@@ -588,11 +624,13 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
             boolean success = (boolean) hashMap.get("success");
             System.out.println(hashMap.get("msg"));
             if(success){
-                return 1;
+                return "ok";
+            }else {
+                return (String) hashMap.get("msg");
             }
         }else{
             System.out.println("委托发送失败:" + jsonData);
         }
-        return 0;
+        return "委托发送失败";
     }
 }

+ 335 - 0
src/main/resources/com/steerinfo/dil/mapper/TmstruckTareReturnResultMapper.xml

@@ -0,0 +1,335 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.steerinfo.dil.mapper.TmstruckTareReturnResultMapper">
+  <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckTareReturnResult">
+    <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
+    <result column="CAPACITY_ID" jdbcType="DECIMAL" property="capacityId" />
+    <result column="RETURN_NUM" jdbcType="VARCHAR" property="returnNum" />
+    <result column="RETURN_TIME" jdbcType="TIMESTAMP" property="returnTime" />
+    <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
+    <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
+    <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
+    <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
+  </resultMap>
+  <sql id="columns">
+    RESULT_ID, CAPACITY_ID, RETURN_NUM, RETURN_TIME, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, 
+    UPDATE_TIME, INSERT_UPDATE_REMARK
+  </sql>
+  <sql id="columns_alias">
+    t.RESULT_ID, t.CAPACITY_ID, t.RETURN_NUM, t.RETURN_TIME, t.INSERT_USERNAME, t.INSERT_TIME, 
+    t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK
+  </sql>
+  <sql id="select">
+    SELECT <include refid="columns"/> FROM TMSTRUCK_TARE_RETURN_RESULT
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias"/> FROM TMSTRUCK_TARE_RETURN_RESULT t
+  </sql>
+  <sql id="where">
+    <where> 
+      <if test="resultId != null">
+        and RESULT_ID = #{resultId}
+      </if>
+      <if test="capacityId != null">
+        and CAPACITY_ID = #{capacityId}
+      </if>
+      <if test="returnNum != null and returnNum != ''">
+        and RETURN_NUM = #{returnNum}
+      </if>
+      <if test="returnTime != null">
+        and TO_CHAR(RETURN_TIME,'yyyy-MM-dd') = #{returnTime}
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        and INSERT_USERNAME = #{insertUsername}
+      </if>
+      <if test="insertTime != null">
+        and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
+      </if>
+      <if test="updateUsername != null and updateUsername != ''">
+        and UPDATE_USERNAME = #{updateUsername}
+      </if>
+      <if test="updateTime != null">
+        and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
+      </if>
+      <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
+        and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
+      </if>
+    </where>
+  </sql>
+  <sql id="whereLike">
+    <where> 
+      <if test="resultId != null">
+        and RESULT_ID = #{resultId}
+      </if>
+      <if test="capacityId != null">
+        and CAPACITY_ID = #{capacityId}
+      </if>
+      <if test="returnNum != null and returnNum != ''">
+        and RETURN_NUM LIKE '%${returnNum}%'
+      </if>
+      <if test="returnTime != null">
+        and TO_CHAR(RETURN_TIME,'yyyy-MM-dd') = #{returnTime}
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        and INSERT_USERNAME LIKE '%${insertUsername}%'
+      </if>
+      <if test="insertTime != null">
+        and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
+      </if>
+      <if test="updateUsername != null and updateUsername != ''">
+        and UPDATE_USERNAME LIKE '%${updateUsername}%'
+      </if>
+      <if test="updateTime != null">
+        and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
+      </if>
+      <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
+        and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
+      </if>
+    </where>
+  </sql>
+  <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
+    delete from TMSTRUCK_TARE_RETURN_RESULT
+    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from TMSTRUCK_TARE_RETURN_RESULT
+    where 1!=1 
+      <if test="capacityId != null">
+        or CAPACITY_ID = #{capacityId}
+      </if>
+      <if test="returnNum != null and returnNum != ''">
+        or RETURN_NUM = #{returnNum}
+      </if>
+      <if test="returnTime != null">
+        or TO_CHAR(RETURN_TIME,'yyyy-MM-dd') = '#{returnTime}'
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        or INSERT_USERNAME = #{insertUsername}
+      </if>
+      <if test="insertTime != null">
+        or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
+      </if>
+      <if test="updateUsername != null and updateUsername != ''">
+        or UPDATE_USERNAME = #{updateUsername}
+      </if>
+      <if test="updateTime != null">
+        or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
+      </if>
+      <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
+        or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
+      </if>
+  </delete>
+  <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckTareReturnResult">
+    insert into TMSTRUCK_TARE_RETURN_RESULT (RESULT_ID, CAPACITY_ID, RETURN_NUM, 
+      RETURN_TIME, INSERT_USERNAME, INSERT_TIME, 
+      UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
+      )
+    values (#{resultId,jdbcType=DECIMAL}, #{capacityId,jdbcType=DECIMAL}, #{returnNum,jdbcType=VARCHAR}, 
+      #{returnTime,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, 
+      #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckTareReturnResult">
+    insert into TMSTRUCK_TARE_RETURN_RESULT
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="resultId != null">
+        RESULT_ID,
+      </if>
+      <if test="capacityId != null">
+        CAPACITY_ID,
+      </if>
+      <if test="returnNum != null">
+        RETURN_NUM,
+      </if>
+      <if test="returnTime != null">
+        RETURN_TIME,
+      </if>
+      <if test="insertUsername != null">
+        INSERT_USERNAME,
+      </if>
+      <if test="insertTime != null">
+        INSERT_TIME,
+      </if>
+      <if test="updateUsername != null">
+        UPDATE_USERNAME,
+      </if>
+      <if test="updateTime != null">
+        UPDATE_TIME,
+      </if>
+      <if test="insertUpdateRemark != null">
+        INSERT_UPDATE_REMARK,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="resultId != null">
+        #{resultId,jdbcType=DECIMAL},
+      </if>
+      <if test="capacityId != null">
+        #{capacityId,jdbcType=DECIMAL},
+      </if>
+      <if test="returnNum != null">
+        #{returnNum,jdbcType=VARCHAR},
+      </if>
+      <if test="returnTime != null">
+        #{returnTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUsername != null">
+        #{insertUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="insertTime != null">
+        #{insertTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateUsername != null">
+        #{updateUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUpdateRemark != null">
+        #{insertUpdateRemark,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckTareReturnResult">
+    update TMSTRUCK_TARE_RETURN_RESULT
+    set CAPACITY_ID = #{capacityId,jdbcType=DECIMAL},
+      RETURN_NUM = #{returnNum,jdbcType=VARCHAR},
+      RETURN_TIME = #{returnTime,jdbcType=TIMESTAMP},
+      INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
+      INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+      UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
+      UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
+      INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR}
+    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckTareReturnResult">
+    update TMSTRUCK_TARE_RETURN_RESULT
+    <set>
+      <if test="capacityId != null">
+        CAPACITY_ID = #{capacityId,jdbcType=DECIMAL},
+      </if>
+      <if test="returnNum != null">
+        RETURN_NUM = #{returnNum,jdbcType=VARCHAR},
+      </if>
+      <if test="returnTime != null">
+        RETURN_TIME = #{returnTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUsername != null">
+        INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="insertTime != null">
+        INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateUsername != null">
+        UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="updateTime != null">
+        UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUpdateRemark != null">
+        INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+  </update>
+  <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
+    <include refid="select"/>
+    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+  </select>
+  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select"/>
+    <include refid="where"/>
+  </select>
+  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select"/>
+    <include refid="whereLike"/>
+  </select>
+  <insert id="batchInsert" parameterType="java.util.List">
+    insert into TMSTRUCK_TARE_RETURN_RESULT 
+      (RESULT_ID, 
+      CAPACITY_ID, RETURN_NUM, RETURN_TIME, 
+      INSERT_USERNAME, INSERT_TIME, 
+      UPDATE_USERNAME, UPDATE_TIME, 
+      INSERT_UPDATE_REMARK)
+    ( <foreach collection="list" item="item" separator="union all"> 
+   select  
+      #{item.resultId,jdbcType=DECIMAL}, 
+      #{item.capacityId,jdbcType=DECIMAL}, #{item.returnNum,jdbcType=VARCHAR}, #{item.returnTime,jdbcType=TIMESTAMP}, 
+      #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP}, 
+      #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, 
+      #{item.insertUpdateRemark,jdbcType=VARCHAR} from dual  
+   </foreach> )
+  </insert>
+  <update id="batchUpdate" parameterType="java.util.List">
+     update TMSTRUCK_TARE_RETURN_RESULT
+     set
+       RESULT_ID=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
+       </foreach>
+       ,CAPACITY_ID=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.capacityId,jdbcType=DECIMAL}
+       </foreach>
+       ,RETURN_NUM=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.returnNum,jdbcType=VARCHAR}
+       </foreach>
+       ,RETURN_TIME=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.returnTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,INSERT_USERNAME=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
+       </foreach>
+       ,INSERT_TIME=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,UPDATE_USERNAME=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
+       </foreach>
+       ,UPDATE_TIME=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,INSERT_UPDATE_REMARK=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
+       </foreach>
+     where RESULT_ID in 
+     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+    #{item.resultId,jdbcType=DECIMAL}
+     </foreach> 
+  </update>
+  <delete id="batchDelete" parameterType="java.util.List">
+    delete from TMSTRUCK_TARE_RETURN_RESULT
+    where RESULT_ID in 
+    <foreach collection="list" item="id" open="(" close=")" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+
+<!-- 通过车牌号查询委托信息 -->
+  <select id="getMesByCapacityNum" parameterType="string" resultType="java.util.Map">
+    select *
+    from (
+           select TTRR.CAPACITY_ID "capacityId",
+                  TTRR.RETURN_TIME "returnTime",
+                  TTRR.RETURN_NUM   "returnNum"
+           from TMSTRUCK_TARE_RETURN_RESULT TTRR
+           where CAPACITY_ID = (
+             select RC.CAPACITY_ID
+             from RMS_CAPACITY RC
+             where RC.CAPACITY_NUMBER = #{capacityNumber})
+           order by TTRR.RETURN_TIME DESC
+         )
+    where rownum = 1
+  </select>
+
+</mapper>

+ 4 - 0
src/main/resources/com/steerinfo/dil/mapper/UtilsMapper.xml

@@ -212,4 +212,8 @@
         from OMSTRUCK_ORDER OO
         where OO.ORDER_NUMBER = #{orderNumber}
     </select>
+
+    <select id="getCapacityIdByNum" parameterType="string" resultType="java.math.BigDecimal">
+        select RC.CAPACITY_ID from RMS_CAPACITY RC where RC.CAPACITY_NUMBER = #{capacityNumber}
+    </select>
 </mapper>