From 06c8e98ca993dec47203bb4cfb7209692d13baca Mon Sep 17 00:00:00 2001 From: WS <1143478319@qq.com> Date: 星期四, 17 八月 2023 15:18:05 +0800 Subject: [PATCH] 提交通风作业信息同步 --- src/main/java/com/fzzy/async/fzzy40/entity/Fz40AreationData.java | 272 ++++++++++++++++++++++++++++++++++++++ src/main/java/com/fzzy/async/fzzy40/Fzzy40SyncService13.java | 8 src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1305.java | 109 +++++++++++++++ src/main/java/com/fzzy/async/fzzy40/repository/Fzzy40Sync1305Rep.java | 28 ++++ 4 files changed, 413 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/fzzy/async/fzzy40/Fzzy40SyncService13.java b/src/main/java/com/fzzy/async/fzzy40/Fzzy40SyncService13.java index bb1a3c3..3102e30 100644 --- a/src/main/java/com/fzzy/async/fzzy40/Fzzy40SyncService13.java +++ b/src/main/java/com/fzzy/async/fzzy40/Fzzy40SyncService13.java @@ -3,10 +3,7 @@ import com.fzzy.api.data.ApiParam; import com.fzzy.api.data.SyncProtocol; import com.fzzy.api.service.SyncService13; -import com.fzzy.async.fzzy40.impl.Fzzy40Sync1302; -import com.fzzy.async.fzzy40.impl.Fzzy40Sync1303; -import com.fzzy.async.fzzy40.impl.Fzzy40Sync1304; -import com.fzzy.async.fzzy40.impl.Fzzy40Sync1310; +import com.fzzy.async.fzzy40.impl.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -26,6 +23,8 @@ private Fzzy40Sync1303 fzzySync1303; @Autowired private Fzzy40Sync1304 fzzySync1304; + @Autowired + private Fzzy40Sync1305 fzzySync1305; @Autowired private Fzzy40Sync1310 fzzySync1310; @@ -50,6 +49,7 @@ fzzySync1310.syncData(param.getKqdm(), param.getDeptId(), param.getStart(), param.getEnd()); //閫氶浣滀笟淇℃伅鍚屾 TODO + fzzySync1305.syncData(param.getDeptId(), param.getStart(), param.getEnd()); //鐔忚捀浣滀笟淇℃伅鍚屾 TODO diff --git a/src/main/java/com/fzzy/async/fzzy40/entity/Fz40AreationData.java b/src/main/java/com/fzzy/async/fzzy40/entity/Fz40AreationData.java new file mode 100644 index 0000000..c432532 --- /dev/null +++ b/src/main/java/com/fzzy/async/fzzy40/entity/Fz40AreationData.java @@ -0,0 +1,272 @@ +package com.fzzy.async.fzzy40.entity; + +import com.bstek.dorado.annotation.PropertyDef; +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import java.io.Serializable; +import java.util.Date; + +/** + * 閫氶鏁版嵁 + * @author vince + * + */ +@Data +@Entity +@Table(name = "D_AREATION_DATA") +public class Fz40AreationData implements Serializable { + + private static final long serialVersionUID = 1L; + + + + @Id + @Column(name = "ID_", length = 41) + @PropertyDef(label = "涓婚敭") + private String id; + + @Column(name = "COMPANY_ID_", length = 10) + @PropertyDef(label = "缁勭粐缂栫爜") + private String companyId; + + @Column(name = "DEPT_ID_", length = 40) + @PropertyDef(label = "鎵�灞炲垎搴�") + private String deptId; + + @Column(name = "DEPOT_ID_", length = 50) + @PropertyDef(label = "鎿嶄綔浠撳簱") + private String depotId; + + @Column(name = "OBJECTIVE_", length = 100) + @PropertyDef(label = "閫氶鐩殑") + private String objective; + + @PropertyDef(label = "绮爢瀛旈殭搴�") + @Column(name = "ldkxd", precision = 10, scale = 3) + private double ldkxd; + + /** + * 1锛氳嚜鐒剁┖姘旈�氶 + * 2锛氬姞鐑┖姘旈�氶 + * 3锛氬喎鍗寸┖姘旈�氶 + * 4锛氬唴寰幆鎺ф俯 + * 5锛氱┖璋冩帶娓╅�氶 + * 6锛氱淮鎸侀�氶 + */ + @Column(name = "TYPE_", length = 10) + @PropertyDef(label = "閫氶绫诲瀷") + private String type; + /** + * 1锛氬湴妲� + * 2锛氬湴涓婄 + * 3锛氱Щ鍔ㄥ紡 + * 4锛氱寮� + * 5锛氬緞鍚� + * 6锛氬す搴� + * 9锛氬叾浠� + */ + @Column(name = "WIND_NET_TYPE_", length = 10) + @PropertyDef(label = "椋庣綉绫诲瀷") + private String windNetType; + + @PropertyDef(label = "椋庣綉璁剧疆鏂瑰紡") + @Column(name = "fwszfs", length = 64) + private String fwszfs; + + @PropertyDef(label = "涓婚閬撴埅闈㈢Н") + @Column(name = "zfdjmj", precision = 10, scale = 3) + private double zfdjmj; + + @PropertyDef(label = "鏀閬撴埅闈㈢Н") + @Column(name = "zhfdjmj", precision = 10, scale = 3) + private double zhfdjmj; + + @PropertyDef(label = "鏀閬撴�婚暱搴�") + @Column(name = "zfdzcd", precision = 20, scale = 3) + private double zfdzcd; + + @PropertyDef(label = "椋庣綉寮�瀛旂巼") + @Column(name = "fwkkl", precision = 10, scale = 3) + private double fwkkl; + + @PropertyDef(label = "绌烘皵閫斿緞姣�") + @Column(name = "kqtjb", precision = 10, scale = 3) + private double kqtjb; + + @PropertyDef(label = "閫氶鍙h缃釜鏁�") + @Column(name = "tfkszgs") + private Integer tfkszgs; + + @PropertyDef(label = "閫氶鏈哄瀷鍙�") + @Column(name = "tfjxh", length = 128) + private String tfjxh; + + @PropertyDef(label = "閫氶鏈哄彴鏁�") + @Column(name = "tfjts") + private Integer tfjts; + + @PropertyDef(label = "鍗曞彴椋庢満棰濆畾鍏ㄥ帇") + @Column(name = "dtfjedqy", precision = 10, scale = 3) + private double dtfjedqy; + + @PropertyDef(label = "鍗曞彴椋庢満棰濆畾椋庨噺") + @Column(name = "dtfjedfl", precision = 10, scale = 3) + private double dtfjedfl; + + @PropertyDef(label = "鍗曞彴椋庢満棰濆畾鍔熺巼") + @Column(name = "dtfjedgl", precision = 10, scale = 3) + private double dtfjedgl; + + /** + * 1锛氬帇鍏ュ紡閫氶 + * 2锛氬惛鍑哄紡閫氶 + * 3锛氬帇鍏ヤ笌鍚稿嚭鐩哥粨鍚堝紡閫氶 + * 4锛氱幆娴侀�氶 + * 9锛氬叾瀹� + */ + @Column(name = "AIR_SUPPLY_MODE_", length = 10) + @PropertyDef(label = "閫侀鏂瑰紡") + private String airSupplyMode; + + @PropertyDef(label = "鍗曞彴椋庢満瀹炴祴椋庨噺") + @Column(name = "dtfjscfl", precision = 10, scale = 3) + private double dtfjscfl; + + @PropertyDef(label = "鍗曞彴椋庢満杞村姛鐜�") + @Column(name = "dtfjzgl", precision = 10, scale = 3) + private double dtfjzgl; + + @PropertyDef(label = "鎬婚閲�") + @Column(name = "zfl", precision = 10, scale = 3) + private double zfl; + + @PropertyDef(label = "鍗曚綅閫氶閲�") + @Column(name = "dwtfl", precision = 10, scale = 3) + private double dwtfl; + + @PropertyDef(label = "瀹炴祴绯荤粺闃诲姏") + @Column(name = "scxtzl", precision = 10, scale = 3) + private double scxtzl; + + /** + * 鎬昏�楃數閲� 鍗冪摝 + */ + @Column(name = "TOTAL_ES_") + @PropertyDef(label = "鎬昏�楃數閲�") + private Double totalEs; + + @PropertyDef(label = "浣滀笟鏃舵皵娓�") + @Column(name = "zysqw", precision = 10, scale = 3) + private double zysqw; + + @PropertyDef(label = "浣滀笟鏃舵皵婀�") + @Column(name = "zysqs", precision = 10, scale = 3) + private double zysqs; + + @Column(name = "BEFORE_TEMP_AVG_") + @PropertyDef(label = "浣滀笟鍓嶅钩鍧囩伯娓�") + private Double beforeTempAvg; + + @Column(name = "AFTER_TEMP_AVG_") + @PropertyDef(label = "浣滀笟鍚庡钩鍧囩伯娓�") + private Double afterTempAvg; + + @PropertyDef(label = "闄嶆俯骞呭害") + @Column(name = "jwfd", precision = 10, scale = 3) + private double jwfd; + + @PropertyDef(label = "鍚ㄧ伯闄嶆俯鑳借��") + @Column(name = "dljwnh", precision = 10, scale = 3) + private double dljwnh; + + @PropertyDef(label = "澶辨按鐜�") + @Column(name = "ssl_", precision = 10, scale = 3) + private double ssl; + + @PropertyDef(label = "淇濇按鏁堟灉璇勪环缁撴灉") + @Column(name = "bsxgpjjg", length = 128) + private String bsxgpjjg; + + @PropertyDef(label = "閫氶闄嶆俯鍧囧寑鎬ц瘎浠穇鏁翠粨") + @Column(name = "tfjwjyxpjzc", length = 128) + private String tfjwjyxpjzc; + + @PropertyDef(label = "閫氶闄嶆俯鍧囧寑鎬ц瘎浠穇涓婂眰") + @Column(name = "tfjwjyxpjsc", length = 128) + private String tfjwjyxpjsc; + + @PropertyDef(label = "閫氶闄嶆俯鍧囧寑鎬ц瘎浠穇涓�(闂�)灞�") + @Column(name = "tfjwjyxpjzjc", length = 128) + private String tfjwjyxpjzjc; + + @PropertyDef(label = "閫氶闄嶆俯鍧囧寑鎬ц瘎浠穇涓嬪眰") + @Column(name = "tfjwjyxpjxc", length = 128) + private String tfjwjyxpjxc; + + @Column(name = "BEFORE_PER_WET_AVG_") + @PropertyDef(label = "浣滀笟鍓嶅钩鍧囨按鍒�") + private Double beforPerWetAvg; + + @Column(name = "AFTER_PER_WET_AVG_") + @PropertyDef(label = "浣滀笟鍚庡钩鍧囨按鍒�") + private Double afterPerWetAvg; + + @PropertyDef(label = "闄嶆按骞呭害") + @Column(name = "jsfd", precision = 10, scale = 3) + private double jsfd; + + @PropertyDef(label = "鍚ㄧ伯闄嶆按鑳借��") + @Column(name = "dljsnh", precision = 10, scale = 3) + private double dljsnh; + + @PropertyDef(label = "閫氶闄嶆按鍧囧寑鎬у垎鏋恄鏁翠粨") + @Column(name = "tfjsjyxfxzc", length = 128) + private String tfjsjyxfxzc; + + @PropertyDef(label = "閫氶闄嶆按鍧囧寑鎬у垎鏋恄涓婂眰") + @Column(name = "tfjsjyxfxsc", length = 128) + private String tfjsjyxfxsc; + + @PropertyDef(label = "閫氶闄嶆按鍧囧寑鎬у垎鏋恄涓�(闂�)灞�") + @Column(name = "tfjsjyxfxzjc", length = 128) + private String tfjsjyxfxzjc; + + @PropertyDef(label = "閫氶闄嶆按鍧囧寑鎬у垎鏋恄涓嬪眰") + @Column(name = "tfjsjyxfxxc", length = 128) + private String tfjsjyxfxxc; + + @Column(name = "CHARGE_USER_", length = 30) + @PropertyDef(label = "璐熻矗浜�", description = "閫氶浣滀笟璐熻矗浜�") + private String chargeUser; + @Column(name = "OPERATORS_", length = 30) + @PropertyDef(label = "浣滀笟浜哄憳", description = "閫氶浣滀笟浜�") + private String operators; + + @Column(name = "START_TIME_") + @PropertyDef(label = "閫氶浣滀笟鏃堕棿") + private Date startTime; + + @Column(name = "LONG_TIME_") + @PropertyDef(label = "閫氶鏃堕暱锛屽崟浣嶅皬鏃�") + private Double longTime; + + @Column(name = "UPDATE_TIME_") + @PropertyDef(label = "淇敼鏃堕棿", description = "鏈�鍚庝慨鏀规椂闂�") + private Date updateTime; + + @Column(name = "UPDATE_USER_", length = 30) + @PropertyDef(label = "淇敼浜�", description = "鏈�鍚庝慨鏀逛汉") + private String updateUser; + + @Column(name = "REMARK_", length = 200) + @PropertyDef(label = "澶囨敞淇℃伅") + private String remark; + + @Column(name = "czbz", length = 1) + @PropertyDef(label = "鎿嶄綔鏍囧織") + private String czbz; +} diff --git a/src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1305.java b/src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1305.java new file mode 100644 index 0000000..d20a61b --- /dev/null +++ b/src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1305.java @@ -0,0 +1,109 @@ +package com.fzzy.async.fzzy40.impl; + +import com.fzzy.api.Constant; +import com.fzzy.api.entity.Api1105; +import com.fzzy.api.entity.Api1304; +import com.fzzy.api.entity.Api1305; +import com.fzzy.api.entity.ApiLog; +import com.fzzy.api.service.ApiCommonService; +import com.fzzy.api.utils.ContextUtil; +import com.fzzy.api.view.repository.Api1304Rep; +import com.fzzy.api.view.repository.Api1305Rep; +import com.fzzy.api.view.repository.ApiLogRep; +import com.fzzy.async.fzzy40.entity.Fz40AreationData; +import com.fzzy.async.fzzy40.entity.Fz40Gas; +import com.fzzy.async.fzzy40.repository.Fzzy40Sync1304Rep; +import com.fzzy.async.fzzy40.repository.Fzzy40Sync1305Rep; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.List; + +/** + * 閫氶鏁版嵁鍚屾 + * + * @author chen + * @date 2022-09-08 09:51 + */ +@Slf4j +@Component +public class Fzzy40Sync1305 { + + @Autowired + private Fzzy40Sync1305Rep fzzySync1305Rep; + @Autowired + private ApiCommonService commonService; + @Autowired + private Api1305Rep api1305Rep; + + @Autowired + private ApiLogRep apiLogRep; + + /** + * 鍚屾骞跺皝瑁呬繚瀛樻皵閫氶鏁版嵁 + * + * @param deptId 绯荤粺瀵瑰簲搴撳尯缂栫爜 + * @param start 璧峰鏃堕棿 + * @param end 鎴鏃堕棿 + */ + public void syncData(String deptId, Date start, Date end) { + log.info("-------------1305鎺ュ彛鏁版嵁寮�濮嬪悓姝�------------------"); + //鍚屾鏁版嵁锛屽彧璁板綍澶辫触鐨勪俊鎭� + ApiLog apiLog = new ApiLog(); + apiLog.setType(ApiLog.TYPE_SYNC); + apiLog.setKqdm(deptId); + apiLog.setUploadTime(new Date()); + apiLog.setInteId(Constant.API_CODE_1305); + apiLog.setStatus(99); + apiLog.setId(ContextUtil.getUUID()); + try { + List<Fz40AreationData> list = fzzySync1305Rep.findByReceiveDate(start, end); + if (null == list || list.isEmpty()) { + return; + } + + Api1305 api1305; + Api1105 api1105; + for (Fz40AreationData fzAreationData : list) { + //鑾峰彇璐т綅淇℃伅 + api1105 = commonService.getApi1105Cache(fzAreationData.getDepotId()); + if (null == api1105) { + continue; + } + + api1305 = new Api1305(); + + BeanUtils.copyProperties(fzAreationData, api1305); + + api1305.setTfzydh(fzAreationData.getId()); + api1305.setTfrq(fzAreationData.getStartTime()); + api1305.setCfdm(fzAreationData.getDeptId()); + api1305.setTfmd(fzAreationData.getObjective()); + api1305.setTflx(fzAreationData.getType()); + api1305.setFdxs(fzAreationData.getWindNetType()); + api1305.setFdxs(fzAreationData.getWindNetType()); + api1305.setSffs(fzAreationData.getAirSupplyMode()); + api1305.setZhdl(fzAreationData.getTotalEs()); + api1305.setZyqpjlw(fzAreationData.getBeforeTempAvg()); + api1305.setJshpjlw(fzAreationData.getAfterTempAvg()); + api1305.setZyhpjsf(fzAreationData.getBeforPerWetAvg()); + api1305.setZyhpjsf(fzAreationData.getAfterPerWetAvg()); + api1305.setTfzyfzr(fzAreationData.getChargeUser()); + api1305.setTfzyry(fzAreationData.getOperators()); + api1305.setTfsc(fzAreationData.getLongTime()); + api1305.setZhgxsj(fzAreationData.getUpdateTime()); + + api1305Rep.save(api1305); + } + } catch (Exception e) { + log.error("---鍚屾澶辫触----{}", e); + apiLog.setResult("鍚屾澶辫触锛�" + e.getMessage()); + apiLogRep.save(apiLog); + } + } + + +} diff --git a/src/main/java/com/fzzy/async/fzzy40/repository/Fzzy40Sync1305Rep.java b/src/main/java/com/fzzy/async/fzzy40/repository/Fzzy40Sync1305Rep.java new file mode 100644 index 0000000..5934e8a --- /dev/null +++ b/src/main/java/com/fzzy/async/fzzy40/repository/Fzzy40Sync1305Rep.java @@ -0,0 +1,28 @@ +package com.fzzy.async.fzzy40.repository; + +import com.fzzy.async.fzzy40.entity.Fz40AreationData; +import com.fzzy.async.fzzy40.entity.Fz40Gas; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.Date; +import java.util.List; + +/** + * 鏌ヨ閫氶浣滀笟鏁版嵁 + * + * @author chen + * @date 2022-09-08 10:42 + */ +public interface Fzzy40Sync1305Rep extends JpaRepository<Fz40AreationData, String> { + + /** + * 鏍规嵁鏃堕棿娈垫煡璇㈤�氶鏁版嵁 + * @param start + * @param end + * @return + */ + @Query("from Fz40AreationData where startTime >=:start and startTime <:end order by startTime ") + List<Fz40AreationData> findByReceiveDate(@Param("start") Date start, @Param("end") Date end); +} -- Gitblit v1.9.3