| | |
| | | import org.springframework.data.repository.query.Param; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface Api1102Rep extends JpaRepository<Api1102, String> { |
| | | |
| | |
| | | @Query("update Api1102 set czbz=:czbz where kqdm=:id ") |
| | | int updateStatus(@Param("id") String id, @Param("czbz") String czbz); |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢ææççæ§ç¹ä½ä¿¡æ¯ |
| | | * @param kqdm |
| | | * @return |
| | | */ |
| | | @Query("from Api1102 where kqdm=:kqdm ") |
| | | List<Api1102> findPushData(@Param("kqdm") String kqdm); |
| | | } |
| | |
| | | import org.springframework.data.jpa.repository.Query; |
| | | import org.springframework.data.repository.query.Param; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface Api1103Rep extends JpaRepository<Api1103, String> { |
| | |
| | | @Modifying |
| | | @Query("update Api1103 set czbz=:czbz where cfdm =:id ") |
| | | int updateStatus(@Param("id") String id, @Param("czbz") String czbz); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææççæ§ç¹ä½ä¿¡æ¯ |
| | | * @param kqdm |
| | | * @return |
| | | */ |
| | | @Query("from Api1103 where kqdm=:kqdm ") |
| | | List<Api1103> findPushData(@Param("kqdm") String kqdm); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.async.fzzy35.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; |
| | | |
| | | /** |
| | | * 建çç©ï¼å
æ¬ä»æ¿åå
¶ä»æ¿å |
| | | * <p> |
| | | * ä»åºçæé´ä½¿ç¨çæ¯ï¼Depotç±»ï¼ä¸ä¸ªä»æ¿å»ºçå¯è½å
å«å¤ä¸ªæé´ã |
| | | * <p> |
| | | * å½åå®ä¹å¯¹è±¡ä»
ä»
ç¨äºå»ºçç©çæ°æ®é
ç½® |
| | | */ |
| | | @Data |
| | | @Entity |
| | | @Table(name = "D_BUILDING") |
| | | public class Building implements Serializable { |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Id |
| | | @Column(name = "ID_", length = 50) |
| | | @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 = "NAME_", length = 50) |
| | | @PropertyDef(label = "建çåç§°") |
| | | private String name; |
| | | |
| | | @Column(name = "STORAGE_") |
| | | @PropertyDef(label = "设计å¨é", description = "åä½ï¼KG") |
| | | private Double storage; |
| | | |
| | | @Column(name = "USER_DATE_") |
| | | @PropertyDef(label = "ä½¿ç¨æ¥æ") |
| | | private Date userDate; |
| | | |
| | | @Column(name = "HEIGHT_", precision = 16, scale = 2) |
| | | @PropertyDef(label = "仿¿é«åº¦", description = "åä½ï¼ç±³") |
| | | private Double height; |
| | | |
| | | @Column(name = "LENGTH_", precision = 16, scale = 2) |
| | | @PropertyDef(label = "仿¿é¿åº¦", description = "åä½ï¼ç±³") |
| | | private Double length; |
| | | |
| | | @Column(name = "WIDTH_", precision = 16, scale = 2) |
| | | @PropertyDef(label = "仿¿å®½åº¦", description = "åä½ï¼ç±³") |
| | | private Double width; |
| | | |
| | | @Column(name = "DIAMETER_", precision = 16, scale = 2) |
| | | @PropertyDef(label = "çä»ç´å¾", description = "åä½ï¼ç±³") |
| | | private Double diameter; |
| | | |
| | | @Column(name = "VOLUME_", precision = 16, scale = 2) |
| | | @PropertyDef(label = "çä»ä½ç§¯", description = "åä½ï¼ç«æ¹ç±³") |
| | | private Double volume; |
| | | |
| | | @Column(name = "DOOR_NUM_") |
| | | @PropertyDef(label = "ä»é¨æ°") |
| | | private Integer doorNum; |
| | | |
| | | @Column(name = "GROUND_", length = 20) |
| | | @PropertyDef(label = "å°é¢ç»æ") |
| | | private String ground; |
| | | |
| | | @Column(name = "WALL_", length = 20) |
| | | @PropertyDef(label = "å¢ä½ç»æ") |
| | | private String wall; |
| | | |
| | | @Column(name = "ROOF_", length = 20) |
| | | @PropertyDef(label = "å±é¡¶ç»æ") |
| | | private String roof; |
| | | |
| | | @Column(name = "ROOF_TRUSS_", length = 20) |
| | | @PropertyDef(label = "屿¶ç»æ") |
| | | private String roofTruss; |
| | | |
| | | @Column(name = "CREATE_DATE_") |
| | | @PropertyDef(label = "å»ºé æ¥æ") |
| | | private Date createDate; |
| | | |
| | | @Column(name = "LON_", precision = 16, scale = 4) |
| | | @PropertyDef(label = "ç»åº¦") |
| | | private Double lon; |
| | | |
| | | @Column(name = "LAT_", precision = 16, scale = 4) |
| | | @PropertyDef(label = "纬度") |
| | | private Double lat; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.async.fzzy35.entity; |
| | | |
| | | import com.bstek.dorado.annotation.PropertyDef; |
| | | import lombok.Data; |
| | | import javax.persistence.*; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @since 2013-1-22 |
| | | * @author Jacky.gao |
| | | */ |
| | | @Data |
| | | @Entity |
| | | @Table(name = "BDF2_DEPT") |
| | | public class DefaultDept implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -7669420244144806105L; |
| | | |
| | | // ----------ä¸å¡å
Œ
±å段-------// |
| | | @Id |
| | | @Column(name = "ID_", length = 60) |
| | | private String id; |
| | | |
| | | @Column(name = "COMPANY_ID_", length = 60) |
| | | private String companyId; |
| | | |
| | | @Column(name = "PARENT_ID_", length = 60) |
| | | private String parentId; |
| | | |
| | | @Column(name = "CREATE_DATE_") |
| | | @PropertyDef(label = "å»ºææ¶é´") |
| | | private Date createDate; |
| | | |
| | | @Column(name = "NAME_", length = 60) |
| | | private String name; |
| | | |
| | | @Column(name = "DESC_", length = 1000) |
| | | private String desc; |
| | | |
| | | @Column(name = "TYPE_", length = 10) |
| | | @PropertyDef(label = "ç±»å", description = "ç»ç»,åºç¹") |
| | | private String type; |
| | | |
| | | @Column(name = "CODE_", length = 60) |
| | | @PropertyDef(label = "ç¼ç ", description = "ç¨äºä¸æ¥çç»ç»ç¼ç ") |
| | | private String code; |
| | | |
| | | @PropertyDef(label = "æå¨ç") |
| | | @Column(name = "PROVINCE_", length = 30) |
| | | private String province; |
| | | |
| | | @PropertyDef(label = "æå¨åå¸") |
| | | @Column(name = "CITY_", length = 30) |
| | | private String city; |
| | | |
| | | @PropertyDef(label = "æå¨åºå¿") |
| | | @Column(name = "COUNTRY_", length = 30) |
| | | private String country; |
| | | |
| | | @Column(name = "LON_") |
| | | @PropertyDef(label = "ç»åº¦") |
| | | private Double lon; |
| | | |
| | | @Column(name = "LAT_") |
| | | @PropertyDef(label = "纬度") |
| | | private Double lat; |
| | | |
| | | @Column(name = "POST_CODE_", length = 10) |
| | | @PropertyDef(label = "é®ç¼") |
| | | private String postCode; |
| | | |
| | | @Column(name = "BUILDING_NUM_") |
| | | @PropertyDef(label = "仿¿æ°") |
| | | private Integer buildingNum; |
| | | |
| | | @Column(name = "OIL_NUM_") |
| | | @PropertyDef(label = "æ²¹ç½æ°") |
| | | private Integer oilNum; |
| | | |
| | | @PropertyDef(label = "å°å") |
| | | @Column(name = "ADDRESS_", length = 200) |
| | | private String address; |
| | | |
| | | @PropertyDef(label = "è系人") |
| | | @Column(name = "CONTACT_", length = 50) |
| | | private String contact; |
| | | |
| | | @PropertyDef(label = "èç³»çµè¯") |
| | | @Column(name = "PHONE_", length = 20) |
| | | private String phone; |
| | | |
| | | @Column(name = "FAX_", length = 20) |
| | | @PropertyDef(label = "ä¼ ç") |
| | | private String fax; |
| | | |
| | | // ----------åä½å段-------// |
| | | @Column(name = "COMPANY_TYPE_", length = 10) |
| | | @PropertyDef(label = "åä½ç±»å", description = "1-ç²®é£ä»å¨ä¼ä¸;2-ç²®é£è´éä¼ä¸;3-ç²®é£å å·¥ä¼ä¸;4-ç²®é£è®¾å¤å¶é ä¼ä¸;9-å
¶ä»ç²®é£ä¼ä¸") |
| | | private String companyType; |
| | | |
| | | @Column(name = "NATURE_", length = 10) |
| | | @PropertyDef(label = "ä¼ä¸æ§è´¨", description = "1-åºæä¼ä¸;2-æ°è¥ä¼ä¸;3-äºä¸åä½;9-å
¶ä»å
èµä¼ä¸;10-港澳å°åæèµä¼ä¸;11-å¤åæèµä¼ä¸;") |
| | | private String nature; |
| | | |
| | | @Column(name = "LEGAL_PERSON_", length = 30) |
| | | @PropertyDef(label = "æ³äºº") |
| | | private String legalPerson; |
| | | |
| | | @Column(name = "DEPT_NUM_") |
| | | @PropertyDef(label = "åºåºæ°") |
| | | private Integer deptNum; |
| | | |
| | | @Column(name = "REGISTER_CODE_", length = 30) |
| | | @PropertyDef(label = "å·¥åç»è®°æ³¨åå·") |
| | | private String registerCode; |
| | | |
| | | @Column(name = "CREDIT_CODE_", length = 20) |
| | | @PropertyDef(label = "ä¿¡ç¨ç¼ç ") |
| | | private String creditCode; |
| | | |
| | | // ----------åºåºå段-------// |
| | | @Column(name = "DEPOT_NUM_") |
| | | @PropertyDef(label = "å»é´æ°") |
| | | private Integer depotNum; |
| | | |
| | | @Column(name = "STORAGE_") |
| | | @PropertyDef(label = "åºç¹è®¾è®¡å¨é", description = "åä½ï¼å¨") |
| | | private Double storage; |
| | | |
| | | @Column(name = "OIL_STORAGE_") |
| | | @PropertyDef(label = "åºç¹è®¾è®¡ç½å®¹", description = "åä½ï¼å¨") |
| | | private Double oilStorage; |
| | | |
| | | @Column(name = "AREA_") |
| | | @PropertyDef(label = "åºç¹è®¾è®¡é¢ç§¯", description = "åä½ï¼ã¡") |
| | | private Double area; |
| | | |
| | | @Column(name = "ACTING_RESERVE_", length = 1) |
| | | @PropertyDef(label = "æ¯å¦ä»£å¨", description = "1-æ¯; 0-å¦") |
| | | private String actingReserve = "0"; |
| | | |
| | | @Column(name = "PROPERTY_RIGHT_", length = 2) |
| | | @PropertyDef(label = "åºåºäº§æ", description = "1-èªæ; 2-ç§èµï¼9-å
¶ä»") |
| | | private String propertyRight = "1"; |
| | | |
| | | @Column(name = "VAL_", length = 1) |
| | | @PropertyDef(label = "æ¯å¦å¯ç¨") |
| | | private String val; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.async.fzzy35.impl; |
| | | |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.entity.Api1101; |
| | | import com.fzzy.api.entity.ApiLog; |
| | | import com.fzzy.api.utils.ContextUtil; |
| | | import com.fzzy.api.view.repository.Api1101Rep; |
| | | import com.fzzy.api.view.repository.ApiLogRep; |
| | | import com.fzzy.async.fzzy35.entity.DefaultDept; |
| | | import com.fzzy.async.fzzy35.repository.Fzzy35Sync1101Rep; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åä½ä¿¡æ¯ |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class Fzzy35Sync1101 { |
| | | |
| | | @Autowired |
| | | private Fzzy35Sync1101Rep fzzy35Sync1101Rep; |
| | | @Autowired |
| | | private Api1101Rep api1101Rep; |
| | | @Autowired |
| | | private ApiLogRep apiLogRep; |
| | | |
| | | /** |
| | | * 忥åä½ä¿¡æ¯ |
| | | * |
| | | * @param deptId |
| | | * @param start |
| | | * @param end |
| | | */ |
| | | public void syncData(String kqdm, String deptId, Date start, Date end) { |
| | | |
| | | log.info("-------------1111æ¥å£æ°æ®å¼å§åæ¥------------------"); |
| | | |
| | | //åæ¥æ°æ®ï¼åªè®°å½å¤±è´¥çä¿¡æ¯ |
| | | ApiLog apiLog = new ApiLog(); |
| | | apiLog.setType(ApiLog.TYPE_SYNC); |
| | | apiLog.setKqdm(deptId); |
| | | apiLog.setUploadTime(new Date()); |
| | | apiLog.setInteId(Constant.API_CODE_1111); |
| | | apiLog.setStatus(99); |
| | | apiLog.setId(ContextUtil.getUUID()); |
| | | try { |
| | | List<DefaultDept> list = fzzy35Sync1101Rep.listDept(deptId.substring(0, 4)); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.info("-------------没æè·åå°åä½ä¿¡æ¯------------------"); |
| | | return; |
| | | } |
| | | Api1101 apiData; |
| | | for (DefaultDept sysData : list) { |
| | | |
| | | //TODO |
| | | // apiData = new Api1101(); |
| | | // |
| | | // api1101Rep.save(apiData); |
| | | // log.info("1111---åæ¥æ°æ®ï¼{}", apiData.toString()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("---æä»¶åæ¥æ§è¡å¤±è´¥----{}", e); |
| | | apiLog.setResult("忥æä»¶ä¿¡æ¯å¤±è´¥ï¼" + e.getMessage()); |
| | | apiLogRep.save(apiLog); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.async.fzzy35.impl; |
| | | |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.entity.Api1102; |
| | | import com.fzzy.api.entity.ApiLog; |
| | | import com.fzzy.api.utils.ContextUtil; |
| | | import com.fzzy.api.view.repository.Api1102Rep; |
| | | import com.fzzy.api.view.repository.ApiLogRep; |
| | | import com.fzzy.async.fzzy35.entity.DefaultDept; |
| | | import com.fzzy.async.fzzy35.repository.Fzzy35Sync1101Rep; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åºåºä¿¡æ¯ |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class Fzzy35Sync1102 { |
| | | |
| | | @Autowired |
| | | private Fzzy35Sync1101Rep fzzy35Sync1101Rep; |
| | | @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("-------------1102æ¥å£æ°æ®å¼å§åæ¥------------------"); |
| | | |
| | | //åæ¥æ°æ®ï¼åªè®°å½å¤±è´¥çä¿¡æ¯ |
| | | ApiLog apiLog = new ApiLog(); |
| | | apiLog.setType(ApiLog.TYPE_SYNC); |
| | | apiLog.setKqdm(deptId); |
| | | apiLog.setUploadTime(new Date()); |
| | | apiLog.setInteId(Constant.API_CODE_1111); |
| | | apiLog.setStatus(99); |
| | | apiLog.setId(ContextUtil.getUUID()); |
| | | try { |
| | | List<DefaultDept> list = fzzy35Sync1101Rep.listDept(deptId); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.info("-------------没æè·åå°åºåºä¿¡æ¯------------------"); |
| | | return; |
| | | } |
| | | Api1102 apiData; |
| | | for (DefaultDept sysData : list) { |
| | | |
| | | //TODO |
| | | // apiData = new Api1101(); |
| | | // |
| | | // api1102Rep.save(apiData); |
| | | // log.info("1111---åæ¥æ°æ®ï¼{}", apiData.toString()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("---åºåºåæ¥æ§è¡å¤±è´¥----{}", e); |
| | | apiLog.setResult("忥åºåºä¿¡æ¯å¤±è´¥ï¼" + e.getMessage()); |
| | | apiLogRep.save(apiLog); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.async.fzzy35.impl; |
| | | |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.entity.Api1101; |
| | | import com.fzzy.api.entity.ApiLog; |
| | | import com.fzzy.api.utils.ContextUtil; |
| | | import com.fzzy.api.view.repository.ApiLogRep; |
| | | import com.fzzy.async.fzzy35.entity.Building; |
| | | import com.fzzy.async.fzzy35.repository.Fzzy35Sync1103Rep; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 仿¿ä¿¡æ¯ |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class Fzzy35Sync1103 { |
| | | |
| | | @Autowired |
| | | private Fzzy35Sync1103Rep fzzy35Sync1103Rep; |
| | | @Autowired |
| | | private ApiLogRep apiLogRep; |
| | | |
| | | /** |
| | | * 忥åä½ä¿¡æ¯ |
| | | * |
| | | * @param deptId |
| | | * @param start |
| | | * @param end |
| | | */ |
| | | public void syncData(String kqdm, String deptId, Date start, Date end) { |
| | | |
| | | log.info("-------------1103æ¥å£æ°æ®å¼å§åæ¥------------------"); |
| | | |
| | | //åæ¥æ°æ®ï¼åªè®°å½å¤±è´¥çä¿¡æ¯ |
| | | ApiLog apiLog = new ApiLog(); |
| | | apiLog.setType(ApiLog.TYPE_SYNC); |
| | | apiLog.setKqdm(deptId); |
| | | apiLog.setUploadTime(new Date()); |
| | | apiLog.setInteId(Constant.API_CODE_1111); |
| | | apiLog.setStatus(99); |
| | | apiLog.setId(ContextUtil.getUUID()); |
| | | try { |
| | | List<Building> list = fzzy35Sync1103Rep.listBuilding(deptId); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | log.info("-------------没æè·åå°åä½ä¿¡æ¯------------------"); |
| | | return; |
| | | } |
| | | Api1101 apiData; |
| | | for (Building sysData : list) { |
| | | |
| | | //TODO |
| | | // apiData = new Api1101(); |
| | | // |
| | | // api1103Rep.save(apiData); |
| | | // log.info("1111---åæ¥æ°æ®ï¼{}", apiData.toString()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("---仿¿åæ¥æ§è¡å¤±è´¥----{}", e); |
| | | apiLog.setResult("忥仿¿ä¿¡æ¯å¤±è´¥ï¼" + e.getMessage()); |
| | | apiLogRep.save(apiLog); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.async.fzzy35.repository; |
| | | |
| | | import com.fzzy.async.fzzy35.entity.DefaultDept; |
| | | import com.fzzy.async.fzzy35.entity.MContract; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | import org.springframework.data.repository.query.Param; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åºç¡ä¿¡æ¯-åä½ååºåºä¿¡æ¯ |
| | | */ |
| | | public interface Fzzy35Sync1101Rep extends JpaRepository<MContract, String> { |
| | | |
| | | /** |
| | | * è·åå使åºåºä¿¡æ¯ |
| | | * |
| | | * @return |
| | | */ |
| | | @Query("from DefaultDept where id=:id ") |
| | | List<DefaultDept> listDept(@Param("id") String id); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.async.fzzy35.repository; |
| | | |
| | | import com.fzzy.async.fzzy35.entity.MContract; |
| | | 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 Fzzy35Sync1102Rep extends JpaRepository<MContract, String> { |
| | | |
| | | /** |
| | | * æ ¹æ®ä¿¡æ¯è·åååä¿¡æ¯ |
| | | * |
| | | * @param start |
| | | * @param end |
| | | * @return |
| | | */ |
| | | @Query("from MContract where deptId=:deptId and createTime >=:start and createTime <:end order by createTime ") |
| | | List<MContract> listContract(@Param("deptId") String deptId, @Param("start") Date start, @Param("end") Date end); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.async.fzzy35.repository; |
| | | |
| | | import com.fzzy.async.fzzy35.entity.Building; |
| | | import com.fzzy.async.fzzy35.entity.MContract; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | import org.springframework.data.repository.query.Param; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åºç¡ä¿¡æ¯-仿¿ä¿¡æ¯ |
| | | */ |
| | | public interface Fzzy35Sync1103Rep extends JpaRepository<MContract, String> { |
| | | |
| | | /** |
| | | * è·å仿¿ä¿¡æ¯ |
| | | * |
| | | * @return |
| | | */ |
| | | @Query("from Building where deptId=:deptId ") |
| | | List<Building> listBuilding(@Param("deptId") String deptId); |
| | | } |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.Table; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | |
| | | import com.fzzy.api.data.ApiParam; |
| | | import com.fzzy.api.dto.ResponseDto; |
| | | import com.fzzy.api.entity.Api1101; |
| | | import com.fzzy.api.entity.Api1102; |
| | | import com.fzzy.api.entity.Api1111; |
| | | import com.fzzy.api.service.ApiRemoteService; |
| | | import com.fzzy.api.view.repository.Api1101Rep; |
| | | import com.fzzy.api.view.repository.Api1102Rep; |
| | | import com.fzzy.api.view.repository.Api1111Rep; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | private Api1101Rep api1101Rep; |
| | | @Autowired |
| | | private Api1102Rep api1102Rep; |
| | | @Autowired |
| | | private Api1111Rep api1111Rep; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | param.setInteCategory(Constant.API_CATEGORY_11); |
| | | param.setInteId(Constant.API_CODE_1111); |
| | | param.setInteId(Constant.API_CODE_1101); |
| | | |
| | | ResponseDto responseDto; |
| | | for (Api1101 data : items) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 1101 åºåºä¿¡æ¯ |
| | | */ |
| | | public void pushData1102(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | |
| | | List<Api1102> items = api1102Rep.findPushData(param.getKqdm()); |
| | | if (null == items || items.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | param.setInteCategory(Constant.API_CATEGORY_11); |
| | | param.setInteId(Constant.API_CODE_1102); |
| | | |
| | | ResponseDto responseDto; |
| | | for (Api1102 data : items) { |
| | | param.setBizId(data.getBizId()); |
| | | responseDto = apiRemoteService.pushData(param, data); |
| | | |
| | | if (responseDto.getSuccess() == 0) { |
| | | if (Constant.CZBZ_I.equals(data.getCzbz())) { |
| | | api1102Rep.updateStatus(data.getDwdm(), Constant.CZBZ_U); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 1111 åºåºå¾è§é¢çæ§è®¾å¤ç¹ä½æ 注 |
| | | */ |
| | | public void pushData1111(ApiRemoteService apiRemoteService, ApiParam param) { |
| | |
| | | package com.fzzy.push.shjdjw2023; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.TypeReference; |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.api.utils.AESUtils; |
| | | import com.fzzy.api.utils.MyMD5Util; |
| | | import com.fzzy.api.utils.SnowflakeIdWorker; |
| | | import com.fzzy.push.gd2022.dto.GD2022AuthToken; |
| | | import com.fzzy.push.gd2022.dto.GD2022ResponseDto; |
| | | import com.fzzy.push.shjdjw2023.dto.ShjdjwRespDto; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import org.apache.commons.lang.StringUtils; |
| | | import java.io.*; |
| | | import java.lang.reflect.Type; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 䏿µ·åå®çºªå§ç管平å°-ä¸ä¼ æ°æ®æå¡ç±» |
| | |
| | | * @throws Exception |
| | | */ |
| | | @SuppressWarnings("resource") |
| | | public static GD2022ResponseDto postPushData(String url, String data , ApiConfs apiConfs) throws Exception { |
| | | public static ShjdjwRespDto postPushData(String url, String data , ApiConfs apiConfs) throws Exception { |
| | | log.info("---------æ¥å£è¯·æ±å°åï¼" +url+ "----------åæ°ï¼" + data +"---------"); |
| | | BufferedReader in = null; |
| | | URL urls = new URL(url); |
| | | HttpURLConnection connection = null; |
| | | OutputStream outputStream = null; |
| | | String rs = ""; |
| | | GD2022ResponseDto responseDto; |
| | | ShjdjwRespDto responseDto = null; |
| | | try { |
| | | String md = AESUtils.encryptByEcb(data, apiConfs.getPublicKey()); |
| | | String md = AESUtils.encrypt(data, apiConfs.getPublicKey()); |
| | | log.info("---------æ¥å£è¯·æ±å°åï¼" +url+ "----------坿忰ï¼" + md +"---------"); |
| | | connection = (HttpURLConnection) urls.openConnection(); |
| | | connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); |
| | |
| | | System.out.println("åçå¼å¸¸"); |
| | | log.error(e.getMessage(),e); |
| | | rs = null; |
| | | return new GD2022ResponseDto(99,e.getMessage()); |
| | | return new ShjdjwRespDto(99,e.getMessage()); |
| | | } |
| | | log.info("---------æ¥å£è¿åï¼" + rs +"---------"); |
| | | responseDto = JSON.parseObject(rs,GD2022ResponseDto.class); |
| | | if(responseDto == null ) return new GD2022ResponseDto(99,"æ¥å£è¯·æ±åçæªç¥é误"); |
| | | if(StringUtils.isNotEmpty(rs)){ |
| | | rs = rs.replaceAll("\"", ""); |
| | | log.info("---------æ¥å£è¿åï¼ç§æï¼" + rs +"---------"); |
| | | rs = AESUtils.decrypt(rs, apiConfs.getPublicKey()); |
| | | log.info("---------æ¥å£è¿åï¼è§£æåï¼" + rs +"---------"); |
| | | responseDto = JSON.parseObject(rs, ShjdjwRespDto.class); |
| | | } |
| | | |
| | | if(responseDto == null ) return new ShjdjwRespDto(99,"æ¥å£è¯·æ±åçæªç¥é误"); |
| | | return responseDto; |
| | | } finally { |
| | | try { |
| | |
| | | package com.fzzy.push.shjdjw2023; |
| | | |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.data.ApiParam; |
| | | import com.fzzy.api.data.PushProtocol; |
| | | import com.fzzy.api.dto.ResponseDto; |
| | | import com.fzzy.api.entity.Api1101; |
| | | import com.fzzy.api.entity.Api1109; |
| | | import com.fzzy.api.service.ApiRemoteService; |
| | | import com.fzzy.api.service.PushService11; |
| | | import com.fzzy.api.view.repository.Api1101Rep; |
| | | import com.fzzy.push.impl.ComPushService11; |
| | | 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.List; |
| | | |
| | | /** |
| | | * 䏿µ·åå®çºªå§ç管平å°-åºç¡æ°æ®ä¸ä¼ |
| | |
| | | |
| | | @Autowired |
| | | private ComPushService11 pushService; |
| | | @Autowired |
| | | private Api1101Rep api1101Rep; |
| | | |
| | | @Override |
| | | public String getProtocol() { |
| | |
| | | public void pushData(ApiParam param) { |
| | | log.info("------->>>>åºç¡ä¿¡æ¯ æ¥å£æ¨¡å䏿¥å¼å§"); |
| | | |
| | | //åä½ä¿¡æ¯ |
| | | this.pushData(param); |
| | | //è·ååºåºä¿¡æ¯ï¼æ¨é为åä½ä¿¡æ¯ |
| | | pushService.pushData1102(apiRemoteService, param); |
| | | |
| | | log.info("------->>>>åºç¡ä¿¡æ¯ æ¥å£æ¨¡å䏿¥ç»æ"); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 1101 åä½ä¿¡æ¯ |
| | | */ |
| | | private void pushData1101(ApiParam param) { |
| | | List<Api1101> items = api1101Rep.findPushData(param.getKqdm()); |
| | | if (null == items || items.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | param.setInteCategory(Constant.API_CATEGORY_11); |
| | | param.setInteId(Constant.API_CODE_1111); |
| | | |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, items); |
| | | if (responseDto.getSuccess() == 0) { |
| | | for (Api1101 data : items) { |
| | | if (Constant.CZBZ_I.equals(data.getCzbz())) { |
| | | api1101Rep.updateStatus(data.getDwdm(), Constant.CZBZ_U); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import com.fzzy.api.data.ApiParam; |
| | | import com.fzzy.api.data.PushProtocol; |
| | | import com.fzzy.api.dto.ResponseDto; |
| | | import com.fzzy.api.entity.Api1101; |
| | | import com.fzzy.api.entity.Api1103; |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.api.entity.ApiLog; |
| | | import com.fzzy.api.service.ApiCommonService; |
| | | import com.fzzy.api.service.ApiRemoteService; |
| | | import com.fzzy.api.utils.ContextUtil; |
| | | import com.fzzy.api.utils.RedisUtil; |
| | | import com.fzzy.api.view.repository.Api1101Rep; |
| | | import com.fzzy.api.view.repository.Api1103Rep; |
| | | import com.fzzy.api.view.repository.ApiLogRep; |
| | | import com.fzzy.push.gd2022.dto.*; |
| | | import com.fzzy.push.shjdjw2023.dto.ShjdjwApi1101; |
| | | import com.fzzy.push.shjdjw2023.dto.ShjdjwReqDto; |
| | | import com.fzzy.push.shjdjw2023.dto.ShjdjwRespDto; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private ApiCommonService apiCommonService; |
| | | |
| | | @Autowired |
| | | private ApiLogRep apiLogRep; |
| | | @Autowired |
| | | private Api1101Rep api1101Rep; |
| | | @Autowired |
| | | private Api1103Rep api1103Rep; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | GD2022ResponseDto responseDto = Shjdjw2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, jsonData, conf); |
| | | ShjdjwRespDto responseDto = Shjdjw2023HttpClientUtil.postPushData(conf.getApiUrl(), jsonData, conf); |
| | | responseDto.setBizId(bizId); |
| | | apiLog.setStatus(responseDto.getCode() == 200 ? 0 : responseDto.getCode()); |
| | | apiLog.setResult(responseDto.getMsg()); |
| | | apiLog.setStatus(responseDto.getCode() == 1 ? 0 : responseDto.getCode()); |
| | | apiLog.setResult(responseDto.getDescription()); |
| | | apiLogRep.save(apiLog); |
| | | ResponseDto resd = new ResponseDto(); |
| | | resd.setSuccess(responseDto.getCode() == 200 ? 0 : responseDto.getCode()); |
| | | resd.setMsg(responseDto.getMsg()); |
| | | resd.setSuccess(responseDto.getCode() == 1 ? 0 : responseDto.getCode()); |
| | | resd.setMsg(responseDto.getDescription()); |
| | | //updateGD2022AuthToken(responseDto,conf, token); |
| | | return resd; |
| | | } catch (Exception e) { |
| | |
| | | private String getJsonData(String inteId, Object data, String interfaceId) { |
| | | ShjdjwReqDto<Object> dto = new ShjdjwReqDto<>(); |
| | | dto.setId(getDataId(interfaceId)); |
| | | List<Object> list = new ArrayList<>(); |
| | | //转æ¢å°è£
|
| | | if (Constant.API_CODE_1101.equals(inteId)) { |
| | | dto.setData(data); |
| | | if (Constant.API_CODE_1102.equals(inteId)) { |
| | | ShjdjwApi1101 shjdjwApi1101 = new ShjdjwApi1101(); |
| | | BeanUtils.copyProperties(data, shjdjwApi1101); |
| | | //æ¥è¯¢åä½ä¿¡æ¯ |
| | | List<Api1101> listApi1101 = api1101Rep.findPushData(shjdjwApi1101.getKqdm()); |
| | | Api1101 api1101 = null; |
| | | if(null != listApi1101 && listApi1101.size() > 0){ |
| | | api1101 = listApi1101.get(0); |
| | | } |
| | | if(null != api1101){ |
| | | shjdjwApi1101.setDwmc(api1101.getDwmc()); |
| | | shjdjwApi1101.setKqs(api1101.getKqs()); |
| | | } |
| | | //æ¥è¯¢ä»æ¿ä¿¡æ¯ |
| | | List<Api1103> listApi1103 = api1103Rep.findPushData(shjdjwApi1101.getKqdm()); |
| | | if(null != listApi1103 && listApi1103.size() > 0){ |
| | | for(int i = 0; i < listApi1103.size(); i++){ |
| | | if(i == 0){ |
| | | shjdjwApi1101.setCfmc(listApi1103.get(i).getCfmc()); |
| | | }else { |
| | | shjdjwApi1101.setCfmc(shjdjwApi1101.getCfmc() + "#" + listApi1103.get(i).getCfmc()); |
| | | } |
| | | } |
| | | } |
| | | //åä½ä¿¡æ¯å°è£
|
| | | list.add(shjdjwApi1101); |
| | | } else if (Constant.API_CODE_1202.equals(inteId)) { |
| | | |
| | | |
| | | dto.setData(data); |
| | | list.add(data); |
| | | } else { |
| | | dto.setData(data); |
| | | list.add(data); |
| | | } |
| | | |
| | | dto.setData(list); |
| | | return JSON.toJSONString(dto); |
| | | } |
| | | |
| | |
| | | */ |
| | | private String getDataId(String inteId) { |
| | | switch (inteId) { |
| | | case "1101": |
| | | case "1102": |
| | | //å使¥å£ç¼ç |
| | | return ShjdjwApiCodeConstant.API_CODE_LS1101; |
| | | case "1202": |
| | | return ShjdjwApiCodeConstant.API_CODE_LS1302; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.push.shjdjw2023.dto; |
| | | |
| | | import com.alibaba.fastjson.annotation.JSONField; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import com.bstek.dorado.annotation.PropertyDef; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author czt |
| | | * @date 2023/5/9 19:27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class ShjdjwApi1101 implements Serializable { |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @PropertyDef(label = "åä½åç§°") |
| | | private String dwmc; |
| | | |
| | | @PropertyDef(label = "åºåºæ°") |
| | | private Integer kqs; |
| | | |
| | | @JSONField(serialize = false) |
| | | @PropertyDef(label = "åºåºä»£ç " ) |
| | | private String kqdm; |
| | | |
| | | @PropertyDef(label = "åºåºåç§°" ) |
| | | private String kqmc; |
| | | |
| | | @PropertyDef(label = "仿¿æ°" ) |
| | | private Integer cfs; |
| | | |
| | | @PropertyDef(label = "仿¿åç§°", description = "å¤ä¸ªç¨#éå¼") |
| | | private String cfmc; |
| | | |
| | | @PropertyDef(label = "æä½æ å¿" ) |
| | | private String czbz; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.push.shjdjw2023.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * æ¥å£è¿å |
| | | * @author czt |
| | | * @date 2023/5/9 19:27 |
| | | */ |
| | | @Data |
| | | public class ShjdjwRespDto<T> implements Serializable { |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = -6714158228489303453L; |
| | | |
| | | |
| | | |
| | | private int code ; |
| | | |
| | | private String description; |
| | | |
| | | private String bizId; |
| | | |
| | | private T data; |
| | | |
| | | public ShjdjwRespDto() { |
| | | } |
| | | |
| | | public ShjdjwRespDto(int code, String description) { |
| | | this.code = code; |
| | | this.description = description; |
| | | } |
| | | public ShjdjwRespDto(int code, String description, String bizId) { |
| | | this.code = code; |
| | | this.description = description; |
| | | this.bizId = bizId; |
| | | } |
| | | } |