src/main/java/com/fzzy/async/fzzy40/Fzzy40SyncService12.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/fzzy/async/fzzy40/entity/Fz40DepotStore.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1208.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/fzzy/async/fzzy40/repository/Fzzy40Sync1208Rep.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/fzzy/async/fzzy40/Fzzy40SyncService12.java
@@ -3,10 +3,8 @@ import com.fzzy.api.data.ApiParam; import com.fzzy.api.data.SyncProtocol; import com.fzzy.api.service.SyncService12; import com.fzzy.async.fzzy40.impl.Fzzy40Sync1201; import com.fzzy.async.fzzy40.impl.Fzzy40Sync1202; import com.fzzy.async.fzzy40.impl.Fzzy40Sync1205; import com.fzzy.async.fzzy40.impl.Fzzy40Sync1212; import com.fzzy.async.fzzy35.impl.Fzzy35Sync1208; import com.fzzy.async.fzzy40.impl.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Date; @@ -27,6 +25,8 @@ private Fzzy40Sync1205 fzzySync1205; @Autowired private Fzzy40Sync1212 fzzySync1212; @Autowired private Fzzy40Sync1208 fzzySync1208; @Override public String getProtocol() { @@ -68,7 +68,7 @@ //ç²®é£åºå忥 TODO fzzySync1208.syncData(kqdm, deptId, start, end); //ç²®é£æ§è´¨è½¬åä¿¡æ¯åæ¥ TODO src/main/java/com/fzzy/async/fzzy40/entity/Fz40DepotStore.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,170 @@ package com.fzzy.async.fzzy40.entity; import com.bstek.dorado.annotation.PropertyDef; import com.fzzy.async.fzzy30.entity.Depot; 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; /** * @Desc: ç²®é£åºå管çï¼æ ¹æ®å½æ æ ç»æè¦æ±å建 * @author: Andy * @update-time: 2022/11/17 */ @Data @Entity @Table(name = "D_DEPOT_STORE") public class Fz40DepotStore implements Serializable { /** * */ private static final long serialVersionUID = -5548540780391804729L; @Id @Column(name = "ID_", length = 40) 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 = "COUNTRY_", length = 10) @PropertyDef(label = "å½å«") private String country; @Column(name = "STORE_TYPE_", length = 6) @PropertyDef(label = "å¨ç²®æ¹å¼", description = "1:æ£è£ å¨ç²® 2:å è£ å¨ç²® 3:å´å æ£å 9:å ¶ä»") private String storeType; @Column(name = "MANAGE_TYPE_", length = 6) @PropertyDef(label = "ç®¡çæ¹å¼", description = "01 ç´å¨02 代å¨03 ç§ä»04 å§æ") private String manageType; @Column(name = "FOOD_TYPE_", length = 10) @PropertyDef(label = "ç²®é£æ§è´¨") private String foodType; @Column(name = "FOOD_VARIETY_", length = 10) @PropertyDef(label = "ç²®é£åç§") private String foodVariety; @Column(name = "FOOD_LEVEL_", length = 10) @PropertyDef(label = "ç²®é£ç级") private String foodLevel; @Column(name = "FOOD_LOCATION_ID_", length = 50) @PropertyDef(label = "ç²®é£äº§å°") private String foodLocationId; @Column(name = "FOOD_LOCATION_", length = 50) @PropertyDef(label = "ç²®é£äº§å°") private String foodLocation; @Column(name = "FOOD_YEAR_", length = 10) @PropertyDef(label = "æ¶è´§å¹´åº¦") private String foodYear; @Column(name = "DEPOT_STATUS_", length = 10) @PropertyDef(label = "ä»åºç¶æ", description = "1=空ä»ã2=å ¥åºä¸ã3=满ä»ã4=åºåºä¸ã9=å ¶ä»") private String depotStatus; @Column(name = "STORE_DATE_") @PropertyDef(label = "å ¥åºæ¶é´", description = "å ¥åºæ¶é´ï¼ç¬¬ä¸è½¦ç²®é£å ¥ä»æ¶é´,æ ¼å¼ï¼yyyy-MM-dd HH:mm:ss") private Date storeDate; @Column(name = "FULL_DATE_") @PropertyDef(label = "å°ä»æ¥æ", description = "å½è´§ä½ï¼æ²¹ç½ï¼ç¶æä¸ºå°ä»æ¶ï¼æ¤é¡¹ä¸ºå¿ 填项") private Date fullDate; @Column(name = "OUT_DATE_") @PropertyDef(label = "åºä»æ¶é´", description = "åºåºæ¶é´ï¼æåä¸è½¦ç²®é£åºä»å®ææ¶é´,æ ¼å¼ï¼yyyy-MM-dd HH:mm:ss") private Date outDate; @Column(name = "STORAGE_REAL_") @PropertyDef(label = "å®é å¨é", description = "åä½ï¼KG") private Double storageReal; @Column(name = "STORE_SETTLE__") @PropertyDef(label = "计价æ°é", description = "åä½ï¼KG") private Double storageSettle; @Column(name = "GRAIN_HEIGHT_") @PropertyDef(label = "è£ ç²®çº¿é«", description = "åä½ï¼ç±³") private Double grainHeight; @Column(name = "GRAIN_VOLUME_") @PropertyDef(label = "è£ ç²®ä½ç§¯", description = "åä½ï¼ç«æ¹ç±³") private Double grainVolume; @Column(name = "REMARK_", length = 250) @PropertyDef(label = "夿³¨", description = "夿³¨ä¿¡æ¯") private String remark; @Column(name = "UPDATE_USER_", length = 50) @PropertyDef(label = "ä¿®æ¹äºº") private String updateUser; @Column(name = "UPDATE_DATE_") @PropertyDef(label = "ä¿®æ¹æ¶é´") private Date updateDate; @Column(name = "CREATE_DATE_") private Date createDate; public Fz40DepotStore() { } public Fz40DepotStore(String id, String companyId, String deptId, String depotId, String storeType, String foodType, String foodVariety, String foodLevel, String foodLocation, String depotStatus, String foodYear, Date storeDate, Double storageReal, Date fullDate, Date outDate, Double grainHeight, Double grainVolume, String remark, String updateUser, Date updateDate, Date createDate) { this.id = id; this.companyId = companyId; this.deptId = deptId; this.depotId = depotId; this.storeType = storeType; this.foodType = foodType; this.foodVariety = foodVariety; this.foodLevel = foodLevel; this.foodLocation = foodLocation; this.depotStatus = depotStatus; this.foodYear = foodYear; this.storeDate = storeDate; this.storageReal = storageReal; this.fullDate = fullDate; this.outDate = outDate; this.grainHeight = grainHeight; this.grainVolume = grainVolume; this.remark = remark; this.updateUser = updateUser; this.updateDate = updateDate; } public Fz40DepotStore(Depot depot, String depotStatus) { this.companyId = depot.getCompanyId(); this.deptId = depot.getDeptId(); this.depotId = depot.getId(); this.storeType = depot.getStoreType(); this.foodType = depot.getFoodType(); this.foodVariety = depot.getFoodVariety(); this.foodLevel = depot.getFoodLevel(); this.foodLocation = depot.getFoodLocation(); this.depotStatus = depotStatus; this.foodYear = depot.getFoodYear(); this.storageReal = depot.getStorageReal(); this.storeDate = new Date(); this.updateDate = new Date(); } } src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1208.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,161 @@ package com.fzzy.async.fzzy40.impl; import com.fzzy.api.Constant; import com.fzzy.api.entity.Api1102; import com.fzzy.api.entity.Api1105; import com.fzzy.api.entity.Api1208; import com.fzzy.api.entity.ApiLog; import com.fzzy.api.service.ApiCommonService; import com.fzzy.api.service.ApiTriggerService; import com.fzzy.api.utils.ContextUtil; import com.fzzy.api.view.repository.Api1102Rep; import com.fzzy.api.view.repository.Api1208Rep; import com.fzzy.api.view.repository.ApiLogRep; import com.fzzy.async.fzzy40.entity.Fz40DepotStore; import com.fzzy.async.fzzy40.repository.Fzzy40Sync1208Rep; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.time.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Date; import java.util.List; /** * ç²®é£åºå */ @Slf4j @Component public class Fzzy40Sync1208 { @Autowired private Fzzy40Sync1208Rep fzzySync1208Rep; @Autowired private ApiTriggerService apiTriggerService; @Autowired private Api1208Rep api1208Rep; @Autowired private ApiCommonService commonService; @Autowired private Api1102Rep api1102Rep; @Autowired private ApiLogRep apiLogRep; /** * åæ¥ç²®é£åºå * * @param deptId * @param start * @param end */ public void syncData(String kqdm, String deptId, Date start, Date end) { log.info("-------------1208æ¥å£æ°æ®å¼å§åæ¥------------------"); //åæ¥æ°æ®ï¼åªè®°å½å¤±è´¥çä¿¡æ¯ ApiLog apiLog = new ApiLog(); apiLog.setType(ApiLog.TYPE_SYNC); apiLog.setKqdm(deptId); apiLog.setUploadTime(new Date()); apiLog.setInteId(Constant.API_CODE_1208); apiLog.setStatus(99); apiLog.setId(ContextUtil.getUUID()); try { List<Fz40DepotStore> list = fzzySync1208Rep.listDepot(deptId, start, end); if (null == list || list.isEmpty()) { log.info("-------------没æè·åå°ç²®é£åºåä¿¡æ¯------------------"); return; } //æ ¹æ®åºåºä»£ç è·ååä½ä»£ç Api1102 api1102 = api1102Rep.findById(kqdm).get(); Api1208 apiData; Api1105 api1105; for (Fz40DepotStore fz40DepotStore : list) { //è·åè´§ä½ä¿¡æ¯ api1105 = commonService.getApi1105Cache(fz40DepotStore.getDepotId()); if (null == api1105) { continue; } apiData = new Api1208(); apiData.setHwdm(api1105.getHwdm()); //ç²®é£åç§ String mappingCode = apiTriggerService.getMappingCode(Constant.TRIGGER_P_LSPZ, fz40DepotStore.getFoodVariety()); apiData.setLspzdm(mappingCode); //ç²®é£æ§è´¨ mappingCode = apiTriggerService.getMappingCode(Constant.TRIGGER_P_LSXZ, fz40DepotStore.getFoodType()); apiData.setLsxzdm(mappingCode); //ç²®é£ç级 mappingCode = apiTriggerService.getMappingCode(Constant.TRIGGER_P_LSDJ, fz40DepotStore.getFoodLevel()); apiData.setLsdjdm(mappingCode); apiData.setShnd(fz40DepotStore.getFoodYear()); //产å°ä»£ç String cd = commonService.getFoodLocationIdFromCache(fz40DepotStore.getFoodLocation()); apiData.setCd(cd); apiData.setBgy(api1105.getBgy()); //ç²®æå½å±åä½ apiData.setLqgsdwdm(api1102.getDwdm()); //ç²®æè¡æ¿åºå代ç apiData.setLqxzqhdm(api1102.getDwdm().substring(2, 8)); //ç®¡çæ¹å¼-é»è®¤ç´å¨ apiData.setGlfs("01"); //æ¶å¨å°ç¹-é»è®¤åºå apiData.setScdd("1"); //å¨ç²®æ¹å¼ apiData.setClfs(fz40DepotStore.getStoreType()); //è´§ä½ç¶æ mappingCode = apiTriggerService.getMappingCode(Constant.TRIGGER_P_HWZT, fz40DepotStore.getDepotStatus()); apiData.setHwzt(mappingCode); if(null == fz40DepotStore.getStoreDate()){ fz40DepotStore.setStoreDate(new Date()); } //å ¥ä»æ¶é´ apiData.setRcsj(fz40DepotStore.getStoreDate()); //å°ä»æ¥æ if("3".equals(apiData.getHwzt())){ apiData.setFcrq(DateUtils.addDays(fz40DepotStore.getStoreDate(), 10)); } //åºä»å®ææ¶é´ if("1".equals(apiData.getHwzt())){ apiData.setCcwcsj(DateUtils.addDays(fz40DepotStore.getStoreDate(), 5)); } //å½å« apiData.setGb("156"); apiData.setSjsl(fz40DepotStore.getStorageReal()); apiData.setJjsl(fz40DepotStore.getStorageReal()); apiData.setSjzlxg(6); apiData.setLdtj(10000); apiData.setZhgxsj(new Date()); //ä¸å¡idãåºåºç¼ç ã忥æ¶é´ apiData.setBizId(fz40DepotStore.getId()); apiData.setKqdm(kqdm); apiData.setSyncTime(new Date()); //åºåæ¯æ¬¡æ°å¢ apiData.setCzbz(Constant.CZBZ_I); apiData.setId(ContextUtil.getCurTimeMillis()); //ä¿åæ°æ® api1208Rep.save(apiData); } } catch (Exception e) { log.error("---åæ¥å¤±è´¥----{}", e); apiLog.setResult("åæ¥å¤±è´¥ï¼" + e.getMessage()); apiLogRep.save(apiLog); } } } src/main/java/com/fzzy/async/fzzy40/repository/Fzzy40Sync1208Rep.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,23 @@ package com.fzzy.async.fzzy40.repository; import com.fzzy.async.fzzy40.entity.Fz40DepotStore; 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; /** * ç²®é£è´é-ç²®é£åºå */ public interface Fzzy40Sync1208Rep extends JpaRepository<Fz40DepotStore, String> { /** * æ ¹æ®ä¿¡æ¯è·åä»åºä¿¡æ¯ * * @return */ @Query("from Fz40DepotStore where deptId=:deptId and createDate >=:start and createDate <:end order by createDate ") List<Fz40DepotStore> listDepot(@Param("deptId") String deptId, @Param("start") Date start, @Param("end") Date end); }