tao %!s(int64=2) %!d(string=hai) anos
pai
achega
c86f3e092b

+ 33 - 0
vseaf4.4-calc/src/main/java/cn/com/victorysoft/business/calc/dao/WaterTubularStructureDao.java

@@ -1,8 +1,14 @@
 package cn.com.victorysoft.business.calc.dao;
 
+import cn.com.victorysoft.business.calc.entity.Fla55;
+import cn.com.victorysoft.business.calc.entity.WaterTubularStructure;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * @Author TY
  * @Date: 2023/1/31 9:06
@@ -15,4 +21,31 @@ public interface WaterTubularStructureDao {
      *
      */
     void waterTubularStructure();
+
+    /**
+     *
+     * @return
+     */
+    List<WaterTubularStructure> selectList();
+
+    /**
+     *
+     * @param jh
+     * @param wjrq
+     * @return
+     */
+    List<String> selectTooLCode(@Param("jh") String jh,@Param("wjrq") Date wjrq);
+
+    /**
+     *
+     * @param tooLCode
+     * @return
+     */
+    Fla55 selectTooL(String tooLCode);
+
+    /**
+     *
+     * @param waterTubularStructure
+     */
+    void updateData(WaterTubularStructure waterTubularStructure);
 }

+ 27 - 0
vseaf4.4-calc/src/main/java/cn/com/victorysoft/business/calc/entity/Fla55.java

@@ -0,0 +1,27 @@
+package cn.com.victorysoft.business.calc.entity;
+
+import lombok.Data;
+
+/**
+ * @Author TY
+ * @Date: 2023/2/1 9:57
+ */
+@Data
+public class Fla55 {
+
+    private String lb;
+
+    private String dmmc;
+
+    private String dm;
+
+    private String lb2;
+
+    private String lb3;
+
+    private String sx1;
+
+    private String sx2;
+
+    private String srcId;
+}

+ 99 - 0
vseaf4.4-calc/src/main/java/cn/com/victorysoft/business/calc/entity/WaterTubularStructure.java

@@ -0,0 +1,99 @@
+package cn.com.victorysoft.business.calc.entity;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @Author TY
+ * @Date: 2023/2/1 9:14
+ */
+@Data
+public class WaterTubularStructure {
+
+    /**
+     * 单位代码
+     */
+    private String dwdm;
+
+    /**
+     * 单元代码
+     */
+    private String dydm;
+
+    /**
+     * 井号
+     */
+    private String jh;
+
+    /**
+     * 完井日期
+     */
+    private Date wjrq;
+
+    /**
+     * 下一次作业日期
+     */
+    private Date nextZyrq;
+
+    /**
+     * 措施类别
+     */
+    private String cslb;
+
+    /**
+     * 在井时间
+     */
+    private BigDecimal zjsj;
+
+    /**
+     * 管柱有效期
+     */
+    private BigDecimal gzYxq;
+
+    /**
+     * 工艺类型
+     */
+    private String gylx;
+
+    /**
+     * 油管类型
+     */
+    private String yglx;
+
+    /**
+     * 分注级数
+     */
+    private String fzjs;
+
+    /**
+     * 分注段数
+     */
+    private String fzds;
+
+    /**
+     * 封隔器
+     */
+    private String fgq;
+
+    /**
+     * 测调配水器
+     */
+    private String cdPsq;
+
+    /**
+     * 锚定工具
+     */
+    private String mdgj;
+
+    /**
+     * 补偿工具
+     */
+    private String bcgj;
+
+    /**
+     * 洗井阀
+     */
+    private String xjf;
+}

+ 29 - 0
vseaf4.4-calc/src/main/java/cn/com/victorysoft/business/calc/service/WaterTubularStructureService.java

@@ -1,9 +1,15 @@
 package cn.com.victorysoft.business.calc.service;
 
 import cn.com.victorysoft.business.calc.dao.WaterTubularStructureDao;
+import cn.com.victorysoft.business.calc.entity.Fla55;
+import cn.com.victorysoft.business.calc.entity.WaterTubularStructure;
+import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
 
 /**
  * @Author TY
@@ -16,7 +22,30 @@ public class WaterTubularStructureService {
     @Autowired
     private WaterTubularStructureDao waterTubularStructureDao;
 
+    @Transactional
     public void waterTubularStructure() {
+        // 主数据同步
         waterTubularStructureDao.waterTubularStructure();
+
+        // 查询同步完的数据
+        List<WaterTubularStructure> waterTubularStructureList = waterTubularStructureDao.selectList();
+
+        //
+        for (WaterTubularStructure waterTubularStructure : waterTubularStructureList) {
+            List<String> tooLCodeList = waterTubularStructureDao.selectTooLCode(waterTubularStructure.getJh(), waterTubularStructure.getWjrq());
+            for (String tooLCode : tooLCodeList) {
+                // 查询类别
+                Fla55 fla55 = waterTubularStructureDao.selectTooL(tooLCode);
+                // 封隔器
+                if ("封隔器".equals(fla55.getDmmc())) {
+                    waterTubularStructure.setFgq(fla55.getDmmc());
+                }
+                // 锚定工具
+                if ("锚定工具".equals(fla55.getDmmc())) {
+                    waterTubularStructure.setMdgj(fla55.getDmmc());
+                }
+            }
+            waterTubularStructureDao.updateData(waterTubularStructure);
+        }
     }
 }

+ 42 - 0
vseaf4.4-calc/src/main/resources/mapper/WaterTubularStructureDao.xml

@@ -29,4 +29,46 @@
             INSERT(DWDM, DYDM, JH, WJRQ, NEXT_ZYRQ, CSLB, ZJSJ, GZ_YXQ, GYLX)
             VALUES(T2.EJDWDM, T2.DYDM, T2.JH, T2.WGRQ, NULL, T2.CSLB, T2.ZJSJ, T2.ZJSJ, 'GYLX1')
     </update>
+
+    <update id="updateData">
+        UPDATE WATER_TUBULAR_STRUCTURE
+            SET FGQ = #{fgq,jdbcType=VARCHAR},
+                CD_PSQ = #{cdPsq,jdbcType=VARCHAR},
+                MDGJ = #{mdgj,jdbcType=VARCHAR},
+                BCGJ = #{bcgj,jdbcType=VARCHAR},
+                XJF = #{xjf,jdbcType=VARCHAR}
+            WHERE
+                JH = #{jh,jdbcType=VARCHAR} AND WJRQ = #{wjrq,jdbcType=DATE}
+    </update>
+
+    <select id="selectList" resultType="cn.com.victorysoft.business.calc.entity.WaterTubularStructure">
+        SELECT * FROM WATER_TUBULAR_STRUCTURE
+    </select>
+
+    <select id="selectTooLCode" resultType="java.lang.String">
+        SELECT
+            DISTINCT GJDM
+        FROM
+            YS_DDH013
+        WHERE
+            (JH, KGRQ) IN (
+                SELECT
+                    JH, KGRQ
+                FROM
+                    YS_DDH01
+                WHERE
+                    1 = 1
+                <if test="wjrq != null"> AND WGRQ = #{wjrq}</if>
+                <if test="jh != null and jh != ''"> AND JH = #{jh}</if>
+            )
+    </select>
+
+    <select id="selectTooL" resultType="cn.com.victorysoft.business.calc.entity.Fla55">
+        SELECT
+            *
+        FROM
+            FLA55
+        WHERE
+            DM = #{tooLCode}
+    </select>
 </mapper>