Browse Source

ice104 module

hfxc226 2 years ago
parent
commit
d0a8e51973
26 changed files with 1525 additions and 217 deletions
  1. 59 0
      platform-dao/src/main/java/com/platform/dao/vo/query/qykh/HotspotHelpVO.java
  2. 28 28
      platform-dao/src/main/java/com/platform/dao/vo/query/qykh/PlanVO.java
  3. 41 41
      platform-dao/src/main/java/com/platform/dao/vo/query/qykh/ProductVO.java
  4. 1 0
      platform-iec/pom.xml
  5. 13 1
      platform-iec/src/main/java/com/platform/iec/IecApplication.java
  6. 0 50
      platform-iec/src/main/java/com/platform/iec/listener/J60870Client.java
  7. 0 74
      platform-iec/src/main/java/com/platform/iec/listener/J60870ClientListener.java
  8. 0 19
      platform-iec/src/main/java/com/platform/iec/listener/Test.java
  9. 14 0
      platform-iec/src/main/java/com/platform/iec/master/Iec104TcpMasterClientTest.java
  10. 79 0
      platform-iec/src/main/java/com/platform/iec/master/MasterSysDataHandler.java
  11. 6 0
      platform-iec/src/main/java/com/ydl/iec/iec104/core/ScheduledTaskPool.java
  12. 20 1
      platform-iec/src/main/java/com/ydl/iec/util/MySqlUtil.java
  13. 69 0
      platform-rest/src/main/java/com/platform/rest/controller/qykh/QykhHotspotHelpController.java
  14. 70 0
      platform-rest/src/main/java/com/platform/rest/controller/qykh/QykhPlanController.java
  15. 70 0
      platform-rest/src/main/java/com/platform/rest/controller/qykh/QykhProductController.java
  16. 41 0
      platform-service/src/main/java/com/platform/service/qykh/QykhHotspotHelpService.java
  17. 41 0
      platform-service/src/main/java/com/platform/service/qykh/QykhPlanService.java
  18. 41 0
      platform-service/src/main/java/com/platform/service/qykh/QykhProductService.java
  19. 296 0
      platform-service/src/main/java/com/platform/service/qykh/impl/QykhHotspotHelpServiceImpl.java
  20. 3 0
      platform-service/src/main/java/com/platform/service/qykh/impl/QykhPlanDetailsServiceImpl.java
  21. 298 0
      platform-service/src/main/java/com/platform/service/qykh/impl/QykhPlanServiceImpl.java
  22. 3 0
      platform-service/src/main/java/com/platform/service/qykh/impl/QykhProductHelpServiceImpl.java
  23. 318 0
      platform-service/src/main/java/com/platform/service/qykh/impl/QykhProductServiceImpl.java
  24. 4 1
      platform-service/src/main/resources/application-serviceDev.yml
  25. 5 1
      platform-service/src/main/resources/application-serviceProd.yml
  26. 5 1
      platform-service/src/main/resources/application-serviceTest.yml

+ 59 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/qykh/HotspotHelpVO.java

@@ -0,0 +1,59 @@
+package com.platform.dao.vo.query.qykh;
+
+import com.platform.common.bean.BaseVO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * @Description 自定义报表VO结果类
+ * @Author xc
+ * @Date 2022-05-30 19:50:40
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class HotspotHelpVO extends BaseVO implements Serializable {
+
+    /**
+     *
+     */
+    private Integer id;
+    /**
+     * 详情标题
+     */
+    private String title;
+    /**
+     *
+     */
+    private String descr;
+    /**
+     *
+     */
+    private String shortdesc;
+    /**
+     * 对应的类别id
+     */
+    private Integer hid;
+    /**
+     *
+     */
+    private String keywords;
+    /**
+     *
+     */
+    private Integer ord;
+    /**
+     *
+     */
+    private String digest;
+    /**
+     *
+     */
+    private String time;
+
+
+}

+ 28 - 28
platform-dao/src/main/java/com/platform/dao/vo/query/qykh/PlanVO.java

@@ -6,6 +6,7 @@ import com.platform.common.bean.BaseDTO;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+
 import javax.validation.constraints.*;
 import java.io.Serializable;
 import java.time.LocalDateTime;
@@ -20,49 +21,48 @@ import java.time.LocalDate;
 @Data
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
-public class PlanVO extends BaseVO implements Serializable{
+public class PlanVO extends BaseVO implements Serializable {
 
     /**
      * 主键id
      */
-        private Integer id;
-        /**
+    private Integer id;
+    /**
      * 方案类别名称
      */
-        private String planname;
-        /**
+    private String planname;
+    /**
      * 类别说明
      */
-        private String plandes;
-        /**
-     * 
+    private String plandes;
+    /**
+     *
      */
-        private String shortdesc;
-        /**
-     * 
+    private String shortdesc;
+    /**
+     *
      */
-        private Integer pid;
-        /**
-     * 
+    private Integer pid;
+    /**
+     *
      */
-        private Integer level;
-        /**
-     * 
+    private Integer level;
+    /**
+     *
      */
-        private String purl;
-        /**
-     * 
+    private String purl;
+    /**
+     *
      */
-        private String bannerurl;
-        /**
-     * 
+    private String bannerurl;
+    /**
+     *
      */
-        private Integer seoid;
-        /**
-     * 
+    private Integer seoid;
+    /**
+     *
      */
-        private Integer ord;
-    
+    private Integer ord;
 
 
 }

+ 41 - 41
platform-dao/src/main/java/com/platform/dao/vo/query/qykh/ProductVO.java

@@ -6,6 +6,7 @@ import com.platform.common.bean.BaseDTO;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+
 import javax.validation.constraints.*;
 import java.io.Serializable;
 import java.time.LocalDateTime;
@@ -20,65 +21,64 @@ import java.time.LocalDate;
 @Data
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
-public class ProductVO extends BaseVO implements Serializable{
+public class ProductVO extends BaseVO implements Serializable {
 
     /**
-     * 
+     *
      */
-        private Integer id;
-        /**
-     * 
+    private Integer id;
+    /**
+     *
      */
-        private Integer level;
-        /**
-     * 
+    private Integer level;
+    /**
+     *
      */
-        private Integer pid;
-        /**
+    private Integer pid;
+    /**
      * 产品名称
      */
-        private String pname;
-        /**
-     * 产品说明
+    private String pname;
+    /**
+     * 产品说明:富文本
      */
-        private String desrc;
-        /**
-     * 
+    private String desrc;
+    /**
+     *
      */
-        private String shortdesc;
-        /**
+    private String shortdesc;
+    /**
      * 产品图片路径
      */
-        private String purl;
-        /**
-     * 
+    private String purl;
+    /**
+     *
      */
-        private String bannerurl;
-        /**
-     * 
+    private String bannerurl;
+    /**
+     *
      */
-        private Integer ord;
-        /**
-     * 
+    private Integer ord;
+    /**
+     *
      */
-        private String oname;
-        /**
-     * 
+    private String oname;
+    /**
+     *
      */
-        private Integer seoid;
-        /**
-     * 
+    private Integer seoid;
+    /**
+     *
      */
-        private Integer iszt;
-        /**
-     * 
+    private Integer iszt;
+    /**
+     *
      */
-        private String zturl;
-        /**
-     * 
+    private String zturl;
+    /**
+     *
      */
-        private Integer iszhutui;
-    
+    private Integer iszhutui;
 
 
 }

+ 1 - 0
platform-iec/pom.xml

@@ -13,6 +13,7 @@
     <name>platform-iec</name>
 
     <properties>
+        <skipTests>true</skipTests>
         <maven.compiler.source>8</maven.compiler.source>
         <maven.compiler.target>8</maven.compiler.target>
         <mysql-connector.version>5.1.35</mysql-connector.version>

+ 13 - 1
platform-iec/src/main/java/com/platform/iec/IecApplication.java

@@ -1,8 +1,13 @@
 package com.platform.iec;
 
+import com.platform.iec.master.MasterSysDataHandler;
+import com.ydl.iec.iec104.config.Iec104Config;
+import com.ydl.iec.iec104.server.Iec104MasterFactory;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.core.annotation.Order;
 
 import java.util.TimeZone;
 
@@ -13,6 +18,8 @@ import java.util.TimeZone;
  * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
  */
 @SpringBootApplication
+@Order(1)
+@Slf4j
 public class IecApplication implements CommandLineRunner {
     public static void main(String[] args) {
         TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
@@ -21,6 +28,11 @@ public class IecApplication implements CommandLineRunner {
 
     @Override
     public void run(String... args) throws Exception {
-        Thread.currentThread().join();
+        log.info("启动主服务,监听iec……………………………………");
+        Iec104Config iec104Config  = new Iec104Config();
+        iec104Config.setFrameAmountMax((short) 1);
+        iec104Config.setTerminnalAddress((short) 1);
+        Iec104MasterFactory.createTcpClientMaster("127.0.0.1", 2404).setDataHandler(new MasterSysDataHandler()).setConfig(iec104Config).run();
+        Thread.sleep(1000000);
     }
 }

+ 0 - 50
platform-iec/src/main/java/com/platform/iec/listener/J60870Client.java

@@ -1,50 +0,0 @@
-package com.platform.iec.listener;
-
-import org.openmuc.j60870.ClientConnectionBuilder;
-import org.openmuc.j60870.Connection;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.io.IOException;
-import java.net.InetAddress;
-
-@Component
-public class J60870Client implements Runnable {
-    //监听类,后面代码会给出
-    private J60870ClientListener listener;
-    //连接类
-    private Connection connection;
-    //连接参数,可以配置的参数有好多,比如t0,t1,t2等等
-    private ClientConnectionBuilder clientConnectionBuilder;
-
-    //Runnable的run方法重写
-    @Override
-    public void run() {
-        try {
-            //获取server端、从站的ip地址对象,这里使用本地ip
-            InetAddress address = InetAddress.getByName("127.0.0.1");
-            //创建连接参数对象
-            clientConnectionBuilder = new ClientConnectionBuilder(address);
-            //设置socket的连接超时时间
-            clientConnectionBuilder.setConnectionTimeout(60000);
-            //主站与从站连接
-            connection = clientConnectionBuilder.build();
-            //配置数据回调类
-            listener = new J60870ClientListener();
-            connection.startDataTransfer(listener);
-            System.out.println("监听中:");
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    //关闭连接
-    public void disconnect() {
-        try {
-            this.connection.close();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-}

+ 0 - 74
platform-iec/src/main/java/com/platform/iec/listener/J60870ClientListener.java

@@ -1,74 +0,0 @@
-package com.platform.iec.listener;
-
-import lombok.extern.slf4j.Slf4j;
-import org.openmuc.j60870.ASdu;
-import org.openmuc.j60870.ConnectionEventListener;
-import org.openmuc.j60870.ie.InformationObject;
-import org.openmuc.j60870.internal.HexUtils;
-
-import java.io.IOException;
-
-@Slf4j
-public class J60870ClientListener implements ConnectionEventListener {
-
-    @Override
-    public void newASdu(ASdu aSdu) {
-        //打印数据,效果见下图
-        log.info("接受从站数据:" + aSdu.toString());
-        log.info("持续监听中:");
-
-        // 数据类型
-        if (aSdu.getInformationObjects() != null) {
-            InformationObject[] var2 = aSdu.getInformationObjects();
-            int length = var2.length;
-            for (int i = 0; i < length; ++i) {
-                InformationObject informationObject = var2[i];
-                handler(informationObject);
-            }
-        } else {
-            log.info("\nPrivate Information:\n");
-            log.info(HexUtils.bytesToHex(aSdu.getPrivateInformation()));
-        }
-    }
-
-    private void handler(InformationObject informationObject) {
-      /*  ASduType aSduType = aSdu.getTypeIdentification();
-        switch (aSduType) {
-            case M_SP_NA_1:*/
-        handlerMeasure(informationObject);
-   /*             break;
-            case M_SP_TA_1:
-                handlerDegree(informationObject);
-                break;
-        }*/
-    }
-
-    @Override
-    public void connectionClosed(IOException e) {
-        e.printStackTrace();
-    }
-
-    @Override
-    public void dataTransferStateChanged(boolean b) {
-
-    }
-
-
-    /**
-     * 处理遥测数据
-     *
-     * @param informationObject
-     */
-    private void handlerMeasure(InformationObject informationObject) {
-        MySqlUtil.updateRemoteMeasureByPositionNum(informationObject.getInformationObjectAddress(), informationObject.toString());
-    }
-
-    /**
-     * 处理电度数据
-     *
-     * @param informationObject
-     */
-    private void handlerDegree(InformationObject informationObject) {
-        MySqlUtil.addRemoteDegreeByPositionNum(informationObject.getInformationObjectAddress(), informationObject.toString(), null);
-    }
-}

+ 0 - 19
platform-iec/src/main/java/com/platform/iec/listener/Test.java

@@ -1,19 +0,0 @@
-package com.platform.iec.listener;
-
-
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-
-@Component
-public class Test {
-
-    @PostConstruct
-    public  void init()  {
-        System.out.println("启动监听:");
-        J60870Client client = null;
-        client = new J60870Client();
-        Thread thread = new Thread(client);
-        thread.start();
-    }
-}

+ 14 - 0
platform-iec/src/main/java/com/platform/iec/master/Iec104TcpMasterClientTest.java

@@ -0,0 +1,14 @@
+package com.platform.iec.master;
+
+
+import com.ydl.iec.iec104.config.Iec104Config;
+import com.ydl.iec.iec104.server.Iec104MasterFactory;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+
+public class Iec104TcpMasterClientTest {
+
+}

+ 79 - 0
platform-iec/src/main/java/com/platform/iec/master/MasterSysDataHandler.java

@@ -0,0 +1,79 @@
+package com.platform.iec.master;
+
+import com.ydl.iec.iec104.common.BasicInstruction104;
+import com.ydl.iec.iec104.core.CachedThreadPool;
+import com.ydl.iec.iec104.message.MessageDetail;
+import com.ydl.iec.iec104.message.MessageInfo;
+import com.ydl.iec.iec104.server.handler.ChannelHandler;
+import com.ydl.iec.iec104.server.handler.DataHandler;
+import com.ydl.iec.util.ByteUtil;
+import com.ydl.iec.util.Iec104Util;
+import lombok.extern.slf4j.Slf4j;
+
+
+@Slf4j
+public class MasterSysDataHandler implements DataHandler {
+
+	@Override
+	public void handlerAdded(ChannelHandler ctx) throws Exception {
+		Runnable runnable = () -> {
+			try {
+				Thread.sleep(5000L);
+			} catch (InterruptedException e) {
+				e.printStackTrace();
+			}
+			System.err.println("___________________________");
+			ctx.writeAndFlush(BasicInstruction104.getGeneralCallRuleDetail104());
+		};
+		CachedThreadPool.getCachedThreadPool().execute(runnable);
+//		ctx.writeAndFlush(BasicInstruction104.getEndGeneralCallRuleDetail104());
+	}
+
+	@Override
+	public void channelRead(ChannelHandler ctx, MessageDetail ruleDetail104) throws Exception {
+		log.info("启动字符:" + ruleDetail104.getStart());
+		log.info("字节长度:" + ruleDetail104.getApuuLength());
+		byte[] control  = ruleDetail104.getControl();
+		log.info("控制域:Accept" + Iec104Util.getAccept(control));
+		log.info("控制域:getSend" + Iec104Util.getSend(control));
+		log.info("类型标识:" + ruleDetail104.getTypeIdentifier().getValue());
+		log.info("可变结构限定词:" + ruleDetail104.isContinuous());
+		log.info("数据长度:" + ruleDetail104.getMeasgLength());
+		log.info("传输原因:" + ruleDetail104.getTransferReason());
+		log.info("终端地址:" + ruleDetail104.getTerminalAddress());
+		log.info("消息地址:" + ruleDetail104.getMessageAddress());
+		log.info("消息结构:" + ruleDetail104.getMessages());
+		log.info("是否有消息元素:" + ruleDetail104.isMessage());
+		log.info("判断是否有限定词:" + ruleDetail104.getQualifiersType());
+		log.info("判断是否有时标:" + ruleDetail104.isTimeScaleExit());
+		log.info("判断消息是否连续:" + ruleDetail104.isContinuous());
+		if(ruleDetail104.getMeasgLength()>0){
+			for (int i = 0; i<ruleDetail104.getMeasgLength();i++) {
+				MessageInfo messageInfo = ruleDetail104.getMessages().get(i);
+				log.info(i + "-消息地址:" + messageInfo.getMessageAddress());
+				log.info(i + "-数据:" + ByteUtil.byteArrayToHexString(messageInfo.getMessageInfos()));
+			}
+		}
+	/*	try {
+			log.info("是否有消息元素:" + ruleDetail104.getQualifiersType().getValue());
+		}catch (Exception e){
+			e.printStackTrace();
+		}*/
+		if(ruleDetail104.getQualifiersType() != null){
+			log.info("限定词:" + ruleDetail104.getQualifiersType().getValue());
+		}else{
+			log.info("限定词: 无");
+		}
+		log.info("时标:" + ruleDetail104.getTimeScale());
+		log.info("限定词:" + ruleDetail104.getHexString());
+
+		System.out.println(ruleDetail104);
+		System.err.print("收到消息");
+	}
+
+	public static void main(String[] args) {
+		byte[] bytes = {1};
+		String strContent = ByteUtil.byteArrayToHexString(bytes);
+		System.out.println(strContent);
+	}
+}

+ 6 - 0
platform-iec/src/main/java/com/ydl/iec/iec104/core/ScheduledTaskPool.java

@@ -40,6 +40,10 @@ public class ScheduledTaskPool {
 	 * 发送测试指令线程的状态
 	 */
 	private Boolean sendTestStatus = false;
+	/**
+	 * 发送测试指令线程的状态-累计数量,超过十次没响应后,需要重启监听
+	 */
+	private int sendTestNum = 0;
 	/**
 	 * 发送总召唤指令状态
 	 */
@@ -115,6 +119,7 @@ public class ScheduledTaskPool {
 							try {
 								LOGGER.info("发送测试链路指令");
 								ctx.channel().writeAndFlush(BasicInstruction104.TESTFR);
+								sendTestNum++;
 								Thread.sleep(5000);
 							} catch (Exception e) {
 								e.printStackTrace();
@@ -135,6 +140,7 @@ public class ScheduledTaskPool {
 	public void stopSendTestFrame() {
 		if (sendTestThread != null) {
 			sendTestStatus = false;
+			sendTestNum = 0;
 		}
 	}
 

+ 20 - 1
platform-iec/src/main/java/com/platform/iec/listener/MySqlUtil.java → platform-iec/src/main/java/com/ydl/iec/util/MySqlUtil.java

@@ -1,4 +1,4 @@
-package com.platform.iec.listener;
+package com.ydl.iec.util;
 
 import com.platform.common.exception.BusinessException;
 import com.platform.common.exception.DeniedException;
@@ -6,6 +6,7 @@ import com.platform.common.util.DateUtils;
 import com.platform.common.util.IdGeneratorUtils;
 import com.platform.common.util.StringUtils;
 import lombok.extern.slf4j.Slf4j;
+import org.openmuc.j60870.ie.InformationObject;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
@@ -115,4 +116,22 @@ public class MySqlUtil {
             }
         }
     }
+
+    /**
+     * 处理遥测数据
+     *
+     * @param informationObject
+     */
+    public static void handlerMeasure(InformationObject informationObject) {
+        MySqlUtil.updateRemoteMeasureByPositionNum(informationObject.getInformationObjectAddress(), informationObject.toString());
+    }
+
+    /**
+     * 处理电度数据
+     *
+     * @param informationObject
+     */
+    public static void handlerDegree(InformationObject informationObject) {
+        MySqlUtil.addRemoteDegreeByPositionNum(informationObject.getInformationObjectAddress(), informationObject.toString(), null);
+    }
 }

+ 69 - 0
platform-rest/src/main/java/com/platform/rest/controller/qykh/QykhHotspotHelpController.java

@@ -0,0 +1,69 @@
+package com.platform.rest.controller.qykh;
+
+import com.platform.common.util.R;
+import com.platform.common.validation.group.AddGroup;
+import com.platform.common.validation.group.UpdateGroup;
+import com.platform.dao.vo.query.qykh.HotspotHelpVO;
+import com.platform.rest.log.annotation.SysLog;
+import com.platform.service.qykh.QykhHotspotHelpService;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/qykh/hotspot/helps")
+public class QykhHotspotHelpController {
+    private final QykhHotspotHelpService qykhPlanDetailsService;
+    /**
+     * 通过id查询单条记录
+     *
+     * @param id 主键
+     * @return R
+     */
+    @GetMapping("/{id}")
+    public R getById(@PathVariable("id") Integer id) {
+        return new R(qykhPlanDetailsService.selectSingle(id));
+    }
+
+    /**
+     * 新增记录
+     *
+     * @param sbTypeDTO 设备类别DTO
+     * @return R
+     */
+    @SysLog("新增")
+    @PostMapping
+    @PreAuthorize("@pms.hasPermission('hotspot-helps-add')")
+    public R save(@Validated({AddGroup.class}) @RequestBody HotspotHelpVO sbTypeDTO) {
+        return new R<>(qykhPlanDetailsService.insertSingle(sbTypeDTO));
+    }
+    
+    /**
+     * 获取分页
+     *
+     * @param pageNum 当前页码
+     * @param pageSize 每页条数
+     * @return R
+     */
+    @GetMapping("/page")
+    public R query(HotspotHelpVO dto, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+        return new R(qykhPlanDetailsService.selectPage(pageNum,pageSize,dto));
+    }
+
+    /**
+     * 修改某条记录
+     * @param infoAdapterVO 电子保函表DTO
+     * @return R
+     */
+    @SysLog("修改")
+    @PutMapping("/{id}")
+    @PreAuthorize("@pms.hasPermission('hotspot-helps-edit')")
+    public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody HotspotHelpVO infoAdapterVO) {
+        qykhPlanDetailsService.modModel(infoAdapterVO);
+        return new R();
+    }
+
+
+}

+ 70 - 0
platform-rest/src/main/java/com/platform/rest/controller/qykh/QykhPlanController.java

@@ -0,0 +1,70 @@
+package com.platform.rest.controller.qykh;
+
+import com.platform.common.util.R;
+import com.platform.common.validation.group.AddGroup;
+import com.platform.common.validation.group.UpdateGroup;
+import com.platform.dao.vo.query.qykh.PlanVO;
+import com.platform.rest.log.annotation.SysLog;
+import com.platform.service.qykh.QykhPlanDetailsService;
+import com.platform.service.qykh.QykhPlanService;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/qykh/plans")
+public class QykhPlanController {
+    private final QykhPlanService qykhPlanDetailsService;
+    /**
+     * 通过id查询单条记录
+     *
+     * @param id 主键
+     * @return R
+     */
+    @GetMapping("/{id}")
+    public R getById(@PathVariable("id") Integer id) {
+        return new R(qykhPlanDetailsService.selectSingle(id));
+    }
+
+    /**
+     * 新增记录
+     *
+     * @param sbTypeDTO 设备类别DTO
+     * @return R
+     */
+    @SysLog("新增")
+    @PostMapping
+    @PreAuthorize("@pms.hasPermission('plans-add')")
+    public R save(@Validated({AddGroup.class}) @RequestBody PlanVO sbTypeDTO) {
+        return new R<>(qykhPlanDetailsService.insertSingle(sbTypeDTO));
+    }
+    
+    /**
+     * 获取分页
+     *
+     * @param pageNum 当前页码
+     * @param pageSize 每页条数
+     * @return R
+     */
+    @GetMapping("/page")
+    public R query(PlanVO dto, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+        return new R(qykhPlanDetailsService.selectPage(pageNum,pageSize,dto));
+    }
+
+    /**
+     * 修改某条记录
+     * @param infoAdapterVO 电子保函表DTO
+     * @return R
+     */
+    @SysLog("修改")
+    @PutMapping("/{id}")
+    @PreAuthorize("@pms.hasPermission('plans-edit')")
+    public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody PlanVO infoAdapterVO) {
+        qykhPlanDetailsService.modModel(infoAdapterVO);
+        return new R();
+    }
+
+
+}

+ 70 - 0
platform-rest/src/main/java/com/platform/rest/controller/qykh/QykhProductController.java

@@ -0,0 +1,70 @@
+package com.platform.rest.controller.qykh;
+
+import com.platform.common.util.R;
+import com.platform.common.validation.group.AddGroup;
+import com.platform.common.validation.group.UpdateGroup;
+import com.platform.dao.vo.query.qykh.ProductVO;
+import com.platform.rest.log.annotation.SysLog;
+import com.platform.service.qykh.QykhPlanDetailsService;
+import com.platform.service.qykh.QykhProductService;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/qykh/products")
+public class QykhProductController {
+    private final QykhProductService qykhPlanDetailsService;
+    /**
+     * 通过id查询单条记录
+     *
+     * @param id 主键
+     * @return R
+     */
+    @GetMapping("/{id}")
+    public R getById(@PathVariable("id") Integer id) {
+        return new R(qykhPlanDetailsService.selectSingle(id));
+    }
+
+    /**
+     * 新增记录
+     *
+     * @param sbTypeDTO 设备类别DTO
+     * @return R
+     */
+    @SysLog("新增")
+    @PostMapping
+    @PreAuthorize("@pms.hasPermission('products-add')")
+    public R save(@Validated({AddGroup.class}) @RequestBody ProductVO sbTypeDTO) {
+        return new R<>(qykhPlanDetailsService.insertSingle(sbTypeDTO));
+    }
+    
+    /**
+     * 获取分页
+     *
+     * @param pageNum 当前页码
+     * @param pageSize 每页条数
+     * @return R
+     */
+    @GetMapping("/page")
+    public R query(ProductVO dto, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+        return new R(qykhPlanDetailsService.selectPage(pageNum,pageSize,dto));
+    }
+
+    /**
+     * 修改某条记录
+     * @param infoAdapterVO 电子保函表DTO
+     * @return R
+     */
+    @SysLog("修改")
+    @PutMapping("/{id}")
+    @PreAuthorize("@pms.hasPermission('products-edit')")
+    public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody ProductVO infoAdapterVO) {
+        qykhPlanDetailsService.modModel(infoAdapterVO);
+        return new R();
+    }
+
+
+}

+ 41 - 0
platform-service/src/main/java/com/platform/service/qykh/QykhHotspotHelpService.java

@@ -0,0 +1,41 @@
+package com.platform.service.qykh;
+
+import com.platform.dao.bean.MyVOPage;
+import com.platform.dao.vo.query.qykh.HotspotHelpVO;
+
+public interface QykhHotspotHelpService {
+
+    /**
+     * 单个数据插入
+     * @param vo
+     */
+    String insertSingle(HotspotHelpVO vo);
+
+    /**
+     * 单个数据查询
+     *
+     * @param id
+     */
+    HotspotHelpVO selectSingle(Integer id);
+
+    /**
+     * 更新
+     *
+     * @param vo
+     */
+    void modModel(HotspotHelpVO vo);
+
+    /**
+     * 分页查询
+     * @param pageNum
+     * @param pageSize
+     * @param HotspotVO 查询对象
+     */
+    MyVOPage<HotspotHelpVO> selectPage(int pageNum, int pageSize, HotspotHelpVO HotspotVO );
+
+    /**
+     * 统一手动插入
+     * @param sql
+     */
+    void centerInsertBatch(String sql);
+}

+ 41 - 0
platform-service/src/main/java/com/platform/service/qykh/QykhPlanService.java

@@ -0,0 +1,41 @@
+package com.platform.service.qykh;
+
+import com.platform.dao.bean.MyVOPage;
+import com.platform.dao.vo.query.qykh.PlanVO;
+
+public interface QykhPlanService {
+
+    /**
+     * 单个数据插入
+     * @param vo
+     */
+    String insertSingle(PlanVO vo);
+
+    /**
+     * 单个数据查询
+     *
+     * @param id
+     */
+    PlanVO selectSingle(Integer id);
+
+    /**
+     * 更新
+     *
+     * @param vo
+     */
+    void modModel(PlanVO vo);
+
+    /**
+     * 分页查询
+     * @param pageNum
+     * @param pageSize
+     * @param PlanVO 查询对象
+     */
+    MyVOPage<PlanVO> selectPage(int pageNum, int pageSize, PlanVO PlanVO );
+
+    /**
+     * 统一手动插入
+     * @param sql
+     */
+    void centerInsertBatch(String sql);
+}

+ 41 - 0
platform-service/src/main/java/com/platform/service/qykh/QykhProductService.java

@@ -0,0 +1,41 @@
+package com.platform.service.qykh;
+
+import com.platform.dao.bean.MyVOPage;
+import com.platform.dao.vo.query.qykh.ProductVO;
+
+public interface QykhProductService {
+
+    /**
+     * 单个数据插入
+     * @param vo
+     */
+    String insertSingle(ProductVO vo);
+
+    /**
+     * 单个数据查询
+     *
+     * @param id
+     */
+    ProductVO selectSingle(Integer id);
+
+    /**
+     * 更新
+     *
+     * @param vo
+     */
+    void modModel(ProductVO vo);
+
+    /**
+     * 分页查询
+     * @param pageNum
+     * @param pageSize
+     * @param ProductVO 查询对象
+     */
+    MyVOPage<ProductVO> selectPage(int pageNum, int pageSize, ProductVO ProductVO );
+
+    /**
+     * 统一手动插入
+     * @param sql
+     */
+    void centerInsertBatch(String sql);
+}

+ 296 - 0
platform-service/src/main/java/com/platform/service/qykh/impl/QykhHotspotHelpServiceImpl.java

@@ -0,0 +1,296 @@
+package com.platform.service.qykh.impl;
+
+import com.github.pagehelper.Page;
+import com.platform.common.exception.BusinessException;
+import com.platform.common.exception.DeniedException;
+import com.platform.common.util.DateUtils;
+import com.platform.common.util.StringUtils;
+import com.platform.dao.bean.MyVOPage;
+import com.platform.dao.vo.query.qykh.HotspotHelpVO;
+import com.platform.service.qykh.QykhHotspotHelpService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service("qykhHotspotHelpService")
+@Slf4j
+public class QykhHotspotHelpServiceImpl implements QykhHotspotHelpService {
+    @Resource
+    private DataSource qykhDataSource;
+
+    @Value("${qykh.hotspot_help}")
+    private String info_table_name;
+
+    @Override
+    public MyVOPage<HotspotHelpVO> selectPage(int pageNum, int pageSize, HotspotHelpVO guaranteeInfoDTO) {
+        MyVOPage<HotspotHelpVO> myVOPage = new MyVOPage<>();
+        myVOPage.setPageNum(pageNum);
+        myVOPage.setPageSize(pageSize);
+        Connection conn = null;
+        Statement stmt = null;
+        ResultSet rs = null;
+        StringBuffer querySql = new StringBuffer("select " +
+                "id," +
+                "title," +
+                "descr," +
+                "shortdesc," +
+                "hid," +
+                "keywords," +
+                "ord," +
+                "digest," +
+                "time ");
+        StringBuffer countSql = new StringBuffer("select count(*) ");
+        StringBuffer sql = new StringBuffer(" from " + info_table_name + " where 1 = 1 ");
+        if (StringUtils.isNotBlank(guaranteeInfoDTO.getTitle())) {
+            sql.append("and title like '%" + guaranteeInfoDTO.getTitle() + "%' ");
+        }
+        sql.append(" order by time desc ");
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            // 获取总条数
+            rs = stmt.executeQuery(countSql.append(sql).toString());
+            rs.next();
+            long total = rs.getLong(1);
+            Page page = new Page(pageNum, pageSize);
+            page.setTotal(total);
+            myVOPage.setPages(page.getPages());
+            myVOPage.setTotal(total);
+            if (total < 1) {
+                myVOPage.setRows(new ArrayList<HotspotHelpVO>());
+                return myVOPage;
+            }
+            int startNum = (pageNum - 1) * pageSize;
+            sql.append("limit " + startNum + "," + pageSize);
+            rs = stmt.executeQuery(querySql.append(sql).toString());
+            // 封装数据
+            myVOPage.setRows(packageInfo(rs));
+            rs.close();
+            stmt.close();
+            conn.close();
+            return myVOPage;
+        } catch (SQLException e1) {
+            e1.printStackTrace();
+            throw new DeniedException("获取乾元数据库连接失败" + e1.getCause().getMessage());
+        } finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                }
+                if (stmt != null) {
+                    stmt.close();
+                }
+                if (conn != null) {
+                    conn.close();
+                }
+            } catch (Exception e) {
+
+            }
+        }
+    }
+
+    @Override
+    public void modModel(HotspotHelpVO vo) {
+        Connection conn = null;
+        Statement stmt = null;
+        if(StringUtils.isBlank(vo.getTitle()) || StringUtils.isBlank(vo.getDescr())){
+            return;
+        }
+        StringBuffer updateSql = new StringBuffer("update " + info_table_name + " set " +
+                "title='" + vo.getTitle() +
+                "',descr='" + vo.getDescr() +
+         /*       "',shortdesc='" + vo.getShortdesc() +
+                "',planid='" + vo.getPlanid() +
+                "',orderid='" + vo.getOrderid() +
+                "',digest='" + vo.getDigest() +
+                "',keywords='" + vo.getKeywords() +
+                "',seoid='" + vo.getSeoid() +
+                "',time='" + vo.getTime() +*/
+                "' where id=" + vo.getId() + "");
+        log.info("更新数据:" + updateSql);
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            // 获取总条数
+            int result = stmt.executeUpdate(updateSql.toString());
+            if (result != 1) {
+                throw new BusinessException("");
+            }
+            stmt.close();
+            conn.close();
+        } catch (SQLException e1) {
+            e1.printStackTrace();
+            throw new DeniedException("获取乾元数据库连接失败" + e1.getCause().getMessage());
+        } finally {
+            try {
+                if (stmt != null) {
+                    stmt.close();
+                }
+                if (conn != null) {
+                    conn.close();
+                }
+            } catch (Exception e) {
+
+            }
+        }
+    }
+
+    private List<HotspotHelpVO> packageInfo(ResultSet rs) throws SQLException {
+        List<HotspotHelpVO> list = new ArrayList<>();
+        while (rs.next()) {
+            HotspotHelpVO vo = new HotspotHelpVO();
+            vo.setId(rs.getInt(1));
+            vo.setTitle(rs.getString(2));
+            vo.setDescr(rs.getString(3));
+            vo.setShortdesc(rs.getString(4));
+            vo.setHid(rs.getInt(5));
+            vo.setKeywords(rs.getString(6));
+            vo.setOrd(rs.getInt(7));
+            vo.setDigest(rs.getString(8));
+            vo.setTime(rs.getString(9));
+            list.add(vo);
+        }
+        return list;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String insertSingle(HotspotHelpVO vo) {
+        try {
+            if (vo != null) {
+                if (vo.getTime() == null) {
+                    vo.setTime(DateUtils.dateToString(LocalDateTime.now(), DateUtils.PATTERN_YMD_HMS));
+                }
+                StringBuffer sql = new StringBuffer();
+                sql.append("insert into " + info_table_name +
+                        " (title,descr,shortdesc,hid,keywords,ord,digest,time) values ");
+                sql.append("('");
+                sql.append("'" + vo.getTitle() + "',");
+                sql.append("'" + vo.getDescr() + "',");
+                sql.append("'" + vo.getShortdesc() + "',");
+                sql.append("'" + vo.getShortdesc() + "',");
+                sql.append("'" + vo.getHid() + "',");
+                sql.append("'" + vo.getKeywords() + "',");
+                sql.append("'" + vo.getOrd() + "',");
+                sql.append("'" + vo.getDigest() + "',");
+                sql.append("'" + vo.getTime() + "',");
+                sql.append(")");
+                log.info("----------" + sql.toString());
+                centerInsertBatch(sql.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            //throw new DeniedException("单个宿州交易中心失败,请联系技术处理");
+        }
+        return "推送成功";
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void centerInsertBatch(String sql) {
+        Connection conn = null;
+        Statement stmt = null;
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            stmt.executeUpdate(sql);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                stmt.close();
+                conn.close();
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+        }
+    }
+
+    @Override
+    public HotspotHelpVO selectSingle(Integer id) {
+        try {
+            HotspotHelpVO vo = new HotspotHelpVO();
+            StringBuffer sql = new StringBuffer();
+            sql.append("select " +
+                    "id," +
+                    "title," +
+                    "descr," +
+                    "shortdesc," +
+                    "hid," +
+                    "keywords," +
+                    "ord," +
+                    "digest," +
+                    "time " +
+                    "from "
+                    + info_table_name + " where id = " + id + "");
+            ResultSet rs = null;
+            Connection conn = null;
+            Statement stmt = null;
+            try {
+                conn = qykhDataSource.getConnection();
+                stmt = conn.createStatement();
+                rs = stmt.executeQuery(sql.toString());
+                rs.next();
+                vo.setId(rs.getInt(1));
+                vo.setTitle(rs.getString(2));
+                vo.setDescr(rs.getString(3));
+                vo.setShortdesc(rs.getString(4));
+                vo.setHid(rs.getInt(5));
+                vo.setKeywords(rs.getString(6));
+                vo.setOrd(rs.getInt(7));
+                vo.setDigest(rs.getString(8));
+                vo.setTime(rs.getString(9));
+                return vo;
+            } catch (Exception e) {
+                log.info(e.getCause().getMessage());
+                e.printStackTrace();
+                //throw new DeniedException("交易中心插入报错"+e.getCause().getMessage());
+            } finally {
+                try {
+                    rs.close();
+                    stmt.close();
+                    conn.close();
+                } catch (Exception e1) {
+                    e1.printStackTrace();
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public ResultSet queryQykh(String sql) {
+        Connection conn = null;
+        Statement stmt = null;
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            return stmt.executeQuery(sql);
+        } catch (Exception e) {
+            log.info(e.getCause().getMessage());
+            e.printStackTrace();
+            //throw new DeniedException("交易中心插入报错"+e.getCause().getMessage());
+        } finally {
+            try {
+                stmt.close();
+                conn.close();
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+        }
+        return null;
+    }
+}

+ 3 - 0
platform-service/src/main/java/com/platform/service/qykh/impl/QykhPlanDetailsServiceImpl.java

@@ -101,6 +101,9 @@ public class QykhPlanDetailsServiceImpl implements QykhPlanDetailsService {
     public void modModel(PlandetailsVO vo) {
         Connection conn = null;
         Statement stmt = null;
+        if(StringUtils.isBlank(vo.getPlantitle()) || StringUtils.isBlank(vo.getPlancontext())){
+            return;
+        }
         StringBuffer updateSql = new StringBuffer("update " + info_table_name + " set " +
                 "plantitle='" + vo.getPlantitle() +
                 "',plancontext='" + vo.getPlancontext() +

+ 298 - 0
platform-service/src/main/java/com/platform/service/qykh/impl/QykhPlanServiceImpl.java

@@ -0,0 +1,298 @@
+package com.platform.service.qykh.impl;
+
+import com.github.pagehelper.Page;
+import com.platform.common.exception.BusinessException;
+import com.platform.common.exception.DeniedException;
+import com.platform.common.util.DateUtils;
+import com.platform.common.util.StringUtils;
+import com.platform.dao.bean.MyVOPage;
+import com.platform.dao.vo.query.qykh.PlanVO;
+import com.platform.service.qykh.QykhPlanDetailsService;
+import com.platform.service.qykh.QykhPlanService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service("qykhPlanService")
+@Slf4j
+public class QykhPlanServiceImpl implements QykhPlanService {
+    @Resource
+    private DataSource qykhDataSource;
+
+    @Value("${qykh.plan}")
+    private String info_table_name;
+
+    @Override
+    public MyVOPage<PlanVO> selectPage(int pageNum, int pageSize, PlanVO guaranteeInfoDTO) {
+        MyVOPage<PlanVO> myVOPage = new MyVOPage<>();
+        myVOPage.setPageNum(pageNum);
+        myVOPage.setPageSize(pageSize);
+        Connection conn = null;
+        Statement stmt = null;
+        ResultSet rs = null;
+        StringBuffer querySql = new StringBuffer("select " +
+                "id," +
+                "planname," +
+                "plandes," +
+                "shortdesc," +
+                "pid," +
+                "level," +
+                "purl," +
+                "bannerurl," +
+                "seoid, " +
+                "ord ");
+        StringBuffer countSql = new StringBuffer("select count(*) ");
+        StringBuffer sql = new StringBuffer(" from " + info_table_name + " where 1 = 1 ");
+        if (StringUtils.isNotBlank(guaranteeInfoDTO.getPlanname())) {
+            sql.append("and planname like '%" + guaranteeInfoDTO.getPlanname() + "%' ");
+        }
+        sql.append(" order by ord ");
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            // 获取总条数
+            rs = stmt.executeQuery(countSql.append(sql).toString());
+            rs.next();
+            long total = rs.getLong(1);
+            Page page = new Page(pageNum, pageSize);
+            page.setTotal(total);
+            myVOPage.setPages(page.getPages());
+            myVOPage.setTotal(total);
+            if (total < 1) {
+                myVOPage.setRows(new ArrayList<PlanVO>());
+                return myVOPage;
+            }
+            int startNum = (pageNum - 1) * pageSize;
+            sql.append("limit " + startNum + "," + pageSize);
+            rs = stmt.executeQuery(querySql.append(sql).toString());
+            // 封装数据
+            myVOPage.setRows(packageInfo(rs));
+            rs.close();
+            stmt.close();
+            conn.close();
+            return myVOPage;
+        } catch (SQLException e1) {
+            e1.printStackTrace();
+            throw new DeniedException("获取乾元数据库连接失败" + e1.getCause().getMessage());
+        } finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                }
+                if (stmt != null) {
+                    stmt.close();
+                }
+                if (conn != null) {
+                    conn.close();
+                }
+            } catch (Exception e) {
+
+            }
+        }
+    }
+
+    @Override
+    public void modModel(PlanVO vo) {
+        Connection conn = null;
+        Statement stmt = null;
+        if(StringUtils.isBlank(vo.getPlanname()) || StringUtils.isBlank(vo.getPlandes())){
+            return;
+        }
+        StringBuffer updateSql = new StringBuffer("update " + info_table_name + " set " +
+                "planname='" + vo.getPlanname() +
+                "',plandes='" + vo.getPlandes() +
+         /*       "',shortdesc='" + vo.getShortdesc() +
+                "',planid='" + vo.getPlanid() +
+                "',orderid='" + vo.getOrderid() +
+                "',digest='" + vo.getDigest() +
+                "',keywords='" + vo.getKeywords() +
+                "',seoid='" + vo.getSeoid() +
+                "',time='" + vo.getTime() +*/
+                "' where id=" + vo.getId() + "");
+        log.info("更新数据:" + updateSql);
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            // 获取总条数
+            int result = stmt.executeUpdate(updateSql.toString());
+            if (result != 1) {
+                throw new BusinessException("");
+            }
+            stmt.close();
+            conn.close();
+        } catch (SQLException e1) {
+            e1.printStackTrace();
+            throw new DeniedException("获取乾元数据库连接失败" + e1.getCause().getMessage());
+        } finally {
+            try {
+                if (stmt != null) {
+                    stmt.close();
+                }
+                if (conn != null) {
+                    conn.close();
+                }
+            } catch (Exception e) {
+
+            }
+        }
+    }
+
+    private List<PlanVO> packageInfo(ResultSet rs) throws SQLException {
+        List<PlanVO> list = new ArrayList<>();
+        while (rs.next()) {
+            PlanVO vo = new PlanVO();
+            vo.setId(rs.getInt(1));
+            vo.setPlanname(rs.getString(2));
+            vo.setPlandes(rs.getString(3));
+            vo.setShortdesc(rs.getString(4));
+            vo.setPid(rs.getInt(5));
+            vo.setLevel(rs.getInt(6));
+            vo.setPurl(rs.getString(7));
+            vo.setBannerurl(rs.getString(8));
+            vo.setSeoid(rs.getInt(9));
+            vo.setOrd(rs.getInt(10));
+            list.add(vo);
+        }
+        return list;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String insertSingle(PlanVO vo) {
+        try {
+            if (vo != null) {
+                StringBuffer sql = new StringBuffer();
+                sql.append("insert into " + info_table_name +
+                        " (planname,plandes,shortdesc,pid,level,purl,bannerurl,seoid,ord) values ");
+                sql.append("('");
+                sql.append("'" + vo.getPlanname() + "',");
+                sql.append("'" + vo.getPlandes() + "',");
+                sql.append("'" + vo.getShortdesc() + "',");
+                sql.append("'" + vo.getPid() + "',");
+                sql.append("'" + vo.getLevel() + "',");
+                sql.append("'" + vo.getPurl() + "',");
+                sql.append("'" + vo.getBannerurl() + "',");
+                sql.append("'" + vo.getSeoid() + "',");
+                sql.append("'" + vo.getOrd() + "',");
+                sql.append(")");
+                log.info("----------" + sql.toString());
+                centerInsertBatch(sql.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            //throw new DeniedException("单个宿州交易中心失败,请联系技术处理");
+        }
+        return "推送成功";
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void centerInsertBatch(String sql) {
+        Connection conn = null;
+        Statement stmt = null;
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            stmt.executeUpdate(sql);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                stmt.close();
+                conn.close();
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+        }
+    }
+
+    @Override
+    public PlanVO selectSingle(Integer id) {
+        try {
+            PlanVO vo = new PlanVO();
+            StringBuffer sql = new StringBuffer();
+            sql.append("select " +
+                    "id," +
+                    "planname," +
+                    "plandes," +
+                    "shortdesc," +
+                    "pid," +
+                    "level," +
+                    "purl," +
+                    "bannerurl," +
+                    "seoid, " +
+                    "ord " +
+                    "from "
+                    + info_table_name + " where id = " + id + "");
+            ResultSet rs = null;
+            Connection conn = null;
+            Statement stmt = null;
+            try {
+                conn = qykhDataSource.getConnection();
+                stmt = conn.createStatement();
+                rs = stmt.executeQuery(sql.toString());
+                rs.next();
+                vo.setId(rs.getInt(1));
+                vo.setPlanname(rs.getString(2));
+                vo.setPlandes(rs.getString(3));
+                vo.setShortdesc(rs.getString(4));
+                vo.setPid(rs.getInt(5));
+                vo.setLevel(rs.getInt(6));
+                vo.setPurl(rs.getString(7));
+                vo.setBannerurl(rs.getString(8));
+                vo.setSeoid(rs.getInt(9));
+                vo.setOrd(rs.getInt(10));
+                return vo;
+            } catch (Exception e) {
+                log.info(e.getCause().getMessage());
+                e.printStackTrace();
+                //throw new DeniedException("交易中心插入报错"+e.getCause().getMessage());
+            } finally {
+                try {
+                    rs.close();
+                    stmt.close();
+                    conn.close();
+                } catch (Exception e1) {
+                    e1.printStackTrace();
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public ResultSet queryQykh(String sql) {
+        Connection conn = null;
+        Statement stmt = null;
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            return stmt.executeQuery(sql);
+        } catch (Exception e) {
+            log.info(e.getCause().getMessage());
+            e.printStackTrace();
+            //throw new DeniedException("交易中心插入报错"+e.getCause().getMessage());
+        } finally {
+            try {
+                stmt.close();
+                conn.close();
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+        }
+        return null;
+    }
+}

+ 3 - 0
platform-service/src/main/java/com/platform/service/qykh/impl/QykhProductHelpServiceImpl.java

@@ -107,6 +107,9 @@ public class QykhProductHelpServiceImpl implements QykhProductHelpService {
     public void modModel(ProductHelpVO vo) {
         Connection conn = null;
         Statement stmt = null;
+        if(StringUtils.isBlank(vo.getTitle()) || StringUtils.isBlank(vo.getDescr())){
+            return;
+        }
         StringBuffer updateSql = new StringBuffer("update " + info_table_name + " set " +
                 "title='" + vo.getTitle() +
                 "',descr='" + vo.getDescr() +/*

+ 318 - 0
platform-service/src/main/java/com/platform/service/qykh/impl/QykhProductServiceImpl.java

@@ -0,0 +1,318 @@
+package com.platform.service.qykh.impl;
+
+import com.github.pagehelper.Page;
+import com.platform.common.exception.BusinessException;
+import com.platform.common.exception.DeniedException;
+import com.platform.common.util.DateUtils;
+import com.platform.common.util.StringUtils;
+import com.platform.dao.bean.MyVOPage;
+import com.platform.dao.vo.query.qykh.ProductVO;
+import com.platform.service.qykh.QykhPlanDetailsService;
+import com.platform.service.qykh.QykhProductService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service("qykhProductService")
+@Slf4j
+public class QykhProductServiceImpl implements QykhProductService {
+    @Resource
+    private DataSource qykhDataSource;
+
+    @Value("${qykh.product}")
+    private String info_table_name;
+
+    @Override
+    public MyVOPage<ProductVO> selectPage(int pageNum, int pageSize, ProductVO guaranteeInfoDTO) {
+        MyVOPage<ProductVO> myVOPage = new MyVOPage<>();
+        myVOPage.setPageNum(pageNum);
+        myVOPage.setPageSize(pageSize);
+        Connection conn = null;
+        Statement stmt = null;
+        ResultSet rs = null;
+        StringBuffer querySql = new StringBuffer("select " +
+                "id," +
+                "level," +
+                "pid," +
+                "pname," +
+                "desrc," +
+                "shortdesc," +
+                "purl," +
+                "bannerurl," +
+                "ord, " +
+                "oname," +
+                "seoid," +
+                "iszt," +
+                "zturl, " +
+                "iszhutui ");
+        StringBuffer countSql = new StringBuffer("select count(*) ");
+        StringBuffer sql = new StringBuffer(" from " + info_table_name + " where 1 = 1 ");
+        if (StringUtils.isNotBlank(guaranteeInfoDTO.getPname())) {
+            sql.append("and pname like '%" + guaranteeInfoDTO.getPname() + "%' ");
+        }
+        sql.append(" order by ord ");
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            // 获取总条数
+            rs = stmt.executeQuery(countSql.append(sql).toString());
+            rs.next();
+            long total = rs.getLong(1);
+            Page page = new Page(pageNum, pageSize);
+            page.setTotal(total);
+            myVOPage.setPages(page.getPages());
+            myVOPage.setTotal(total);
+            if (total < 1) {
+                myVOPage.setRows(new ArrayList<ProductVO>());
+                return myVOPage;
+            }
+            int startNum = (pageNum - 1) * pageSize;
+            sql.append("limit " + startNum + "," + pageSize);
+            rs = stmt.executeQuery(querySql.append(sql).toString());
+            // 封装数据
+            myVOPage.setRows(packageInfo(rs));
+            rs.close();
+            stmt.close();
+            conn.close();
+            return myVOPage;
+        } catch (SQLException e1) {
+            e1.printStackTrace();
+            throw new DeniedException("获取乾元数据库连接失败" + e1.getCause().getMessage());
+        } finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                }
+                if (stmt != null) {
+                    stmt.close();
+                }
+                if (conn != null) {
+                    conn.close();
+                }
+            } catch (Exception e) {
+
+            }
+        }
+    }
+
+    @Override
+    public void modModel(ProductVO vo) {
+        Connection conn = null;
+        Statement stmt = null;
+        if(StringUtils.isBlank(vo.getPname()) || StringUtils.isBlank(vo.getDesrc())){
+            return;
+        }
+        StringBuffer updateSql = new StringBuffer("update " + info_table_name + " set " +
+                "pname='" + vo.getPname() +
+                "',desrc='" + vo.getDesrc() +
+         /*       "',shortdesc='" + vo.getShortdesc() +
+                "',planid='" + vo.getPlanid() +
+                "',orderid='" + vo.getOrderid() +
+                "',digest='" + vo.getDigest() +
+                "',keywords='" + vo.getKeywords() +
+                "',seoid='" + vo.getSeoid() +
+                "',time='" + vo.getTime() +*/
+                "' where id=" + vo.getId() + "");
+        log.info("更新数据:" + updateSql);
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            // 获取总条数
+            int result = stmt.executeUpdate(updateSql.toString());
+            if (result != 1) {
+                throw new BusinessException("");
+            }
+            stmt.close();
+            conn.close();
+        } catch (SQLException e1) {
+            e1.printStackTrace();
+            throw new DeniedException("获取乾元数据库连接失败" + e1.getCause().getMessage());
+        } finally {
+            try {
+                if (stmt != null) {
+                    stmt.close();
+                }
+                if (conn != null) {
+                    conn.close();
+                }
+            } catch (Exception e) {
+
+            }
+        }
+    }
+
+    private List<ProductVO> packageInfo(ResultSet rs) throws SQLException {
+        List<ProductVO> list = new ArrayList<>();
+        while (rs.next()) {
+            ProductVO vo = new ProductVO();
+            vo.setId(rs.getInt(1));
+            vo.setLevel(rs.getInt(2));
+            vo.setPid(rs.getInt(3));
+            vo.setPname(rs.getString(4));
+            vo.setDesrc(rs.getString(5));
+            vo.setShortdesc(rs.getString(6));
+            vo.setPurl(rs.getString(7));
+            vo.setBannerurl(rs.getString(8));
+            vo.setOrd(rs.getInt(9));
+            vo.setOname(rs.getString(10));
+            vo.setSeoid(rs.getInt(11));
+            vo.setIszt(rs.getInt(12));
+            vo.setZturl(rs.getString(13));
+            vo.setIszhutui(rs.getInt(14));
+            list.add(vo);
+        }
+        return list;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String insertSingle(ProductVO vo) {
+        try {
+            if (vo != null) {
+                StringBuffer sql = new StringBuffer();
+                sql.append("insert into " + info_table_name +
+                        " (level,pid,pname,desrc,shortdesc,purl,bannerurl,ord,oname,seoid,iszt,zturl,iszhutui) values ");
+                sql.append("('");
+                sql.append("'" + vo.getLevel() + "',");
+                sql.append("'" + vo.getPid() + "',");
+                sql.append("'" + vo.getPname() + "',");
+                sql.append("'" + vo.getDesrc() + "',");
+                sql.append("'" + vo.getShortdesc() + "',");
+                sql.append("'" + vo.getPurl() + "',");
+                sql.append("'" + vo.getBannerurl() + "',");
+                sql.append("'" + vo.getOrd() + "',");
+                sql.append("'" + vo.getOname() + "',");
+                sql.append("'" + vo.getSeoid() + "',");
+                sql.append("'" + vo.getIszt() + "',");
+                sql.append("'" + vo.getZturl() + "',");
+                sql.append("'" + vo.getIszhutui() + "',");
+                sql.append(")");
+                log.info("----------" + sql.toString());
+                centerInsertBatch(sql.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            //throw new DeniedException("单个宿州交易中心失败,请联系技术处理");
+        }
+        return "推送成功";
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void centerInsertBatch(String sql) {
+        Connection conn = null;
+        Statement stmt = null;
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            stmt.executeUpdate(sql);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                stmt.close();
+                conn.close();
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+        }
+    }
+
+    @Override
+    public ProductVO selectSingle(Integer id) {
+        try {
+            ProductVO vo = new ProductVO();
+            StringBuffer sql = new StringBuffer();
+            sql.append("select " +
+                    "id," +
+                    "level," +
+                    "pid," +
+                    "pname," +
+                    "desrc," +
+                    "shortdesc," +
+                    "purl," +
+                    "bannerurl," +
+                    "ord, " +
+                    "oname," +
+                    "seoid," +
+                    "iszt," +
+                    "zturl, " +
+                    "iszhutui " +
+                    "from "
+                    + info_table_name + " where id = " + id + "");
+            ResultSet rs = null;
+            Connection conn = null;
+            Statement stmt = null;
+            try {
+                conn = qykhDataSource.getConnection();
+                stmt = conn.createStatement();
+                rs = stmt.executeQuery(sql.toString());
+                rs.next();
+                vo.setId(rs.getInt(1));
+                vo.setLevel(rs.getInt(2));
+                vo.setPid(rs.getInt(3));
+                vo.setPname(rs.getString(4));
+                vo.setDesrc(rs.getString(5));
+                vo.setShortdesc(rs.getString(6));
+                vo.setPurl(rs.getString(7));
+                vo.setBannerurl(rs.getString(8));
+                vo.setOrd(rs.getInt(9));
+                vo.setOname(rs.getString(10));
+                vo.setSeoid(rs.getInt(11));
+                vo.setIszt(rs.getInt(12));
+                vo.setZturl(rs.getString(13));
+                vo.setIszhutui(rs.getInt(14));
+                return vo;
+            } catch (Exception e) {
+                log.info(e.getCause().getMessage());
+                e.printStackTrace();
+                //throw new DeniedException("交易中心插入报错"+e.getCause().getMessage());
+            } finally {
+                try {
+                    rs.close();
+                    stmt.close();
+                    conn.close();
+                } catch (Exception e1) {
+                    e1.printStackTrace();
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public ResultSet queryQykh(String sql) {
+        Connection conn = null;
+        Statement stmt = null;
+        try {
+            conn = qykhDataSource.getConnection();
+            stmt = conn.createStatement();
+            return stmt.executeQuery(sql);
+        } catch (Exception e) {
+            log.info(e.getCause().getMessage());
+            e.printStackTrace();
+            //throw new DeniedException("交易中心插入报错"+e.getCause().getMessage());
+        } finally {
+            try {
+                stmt.close();
+                conn.close();
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+        }
+        return null;
+    }
+}

+ 4 - 1
platform-service/src/main/resources/application-serviceDev.yml

@@ -1,3 +1,6 @@
 qykh:
   plandetails: qykh_plandetails
-  product_help: qykh_product_help
+  product_help: qykh_product_help
+  product: qykh_product
+  plan: qykh_plan
+  hotspot_help: qykh_hotspot_help

+ 5 - 1
platform-service/src/main/resources/application-serviceProd.yml

@@ -1,2 +1,6 @@
 qykh:
-  plandetails: qykh_plandetails
+  plandetails: qykh_plandetails
+  product_help: qykh_product_help
+  product: qykh_product
+  plan: qykh_plan
+  hotspot_help: qykh_hotspot_help

+ 5 - 1
platform-service/src/main/resources/application-serviceTest.yml

@@ -1,2 +1,6 @@
 qykh:
-  plandetails: qykh_plandetails
+  plandetails: qykh_plandetails
+  product_help: qykh_product_help
+  product: qykh_product
+  plan: qykh_plan
+  hotspot_help: qykh_hotspot_help