LIVE_YE il y a 2 ans
Parent
commit
1e3bb94418

BIN
boman-web-core/lib/commons-codec-1.11.jar


BIN
boman-web-core/lib/commons-logging-1.2.jar


BIN
boman-web-core/lib/fastjson-1.2.58.jar


BIN
boman-web-core/lib/httpclient-4.5.9.jar


BIN
boman-web-core/lib/httpcore-4.4.11.jar


BIN
boman-web-core/lib/wst-gateway-sdk-java-1.0.jar


+ 25 - 0
boman-web-core/pom.xml

@@ -11,8 +11,27 @@
 
     <artifactId>shujuju-web-core</artifactId>
 
+    <!-- 讯飞内部集成皖事通gateway,添加以下仓库和依赖即可 -->
+    <!-- 其他公司集成皖事通gateway,需要加载lib目录所有jar包,或者将wst-gateway-sdk-java-1.0.jar上传到私服 -->
+    <!--<repositories>
+        <repository>
+            <id>iflytek-nexus</id>
+            <name>iflytek-nexus</name>
+            <url>http://maven.iflytek.com:8081/nexus/content/repositories/public/</url>
+        </repository>
+        <repository>
+            <id>aliyun-nexus</id>
+            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
+        </repository>
+    </repositories>-->
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
     <dependencies>
 
+
         <!-- RSA+AES实现接口验签和参数加密   -->
         <!--RSA依赖-->
         <dependency>
@@ -196,6 +215,12 @@
             <version>1.2.17</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.iflytek.wst</groupId>
+            <artifactId>wst-gateway-sdk-java</artifactId>
+            <version>1.0</version>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 13 - 0
boman-web-core/src/main/java/com/boman/web/core/domain/vo/AccountingDataVo.java

@@ -218,6 +218,11 @@ public class AccountingDataVo extends BaseEntity {
     private String villageXjd;
     private String nowXjd;
 
+
+    private String token;
+
+
+
     public String getNowXjd() {
         return nowXjd;
     }
@@ -619,4 +624,12 @@ public class AccountingDataVo extends BaseEntity {
     public String getHjh() {
         return hjh;
     }
+
+    public String getToken() {
+        return token;
+    }
+
+    public void setToken(String token) {
+        this.token = token;
+    }
 }

+ 3 - 3
boman-web-core/src/main/java/com/boman/web/core/service/TaskService.java

@@ -686,14 +686,14 @@ public class TaskService {
         }
     }
 
-    @Scheduled(cron = "0 0/10 * * * ? ")
+    @Scheduled(cron = "0 0/20 * * * ? ")
     public void thirdNucleicAcid() {
         String startTime = redisService.getCacheObject("startTime");
         if (StringUtils.isEmpty(startTime)) {
             startTime = "2022-05-14 00:00:00";
         }
-        //开始时间往后推10分钟
-        String endTime = DateUtils.plusSeconds(startTime, 10);
+        //开始时间往后推20分钟
+        String endTime = DateUtils.plusSeconds(startTime, 20);
 
         accountingDataService.thirdNucleicAcid(startTime, endTime);
 

+ 31 - 4
boman-web-core/src/main/java/com/boman/web/core/service/accounting/AccountingDataServiceImpl.java

@@ -5,6 +5,7 @@ package com.boman.web.core.service.accounting;
  */
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.boman.common.core.exception.BaseException;
 import com.boman.common.core.utils.DateUtils;
 import com.boman.common.core.utils.StringUtils;
@@ -24,7 +25,10 @@ import com.boman.web.core.mapper.TSampling514Mapper;
 import com.boman.web.core.service.TaskService;
 import com.boman.web.core.utils.AuthUtils;
 import com.boman.web.core.utils.CzrkUtils;
+import com.boman.web.core.wst.WstRestClient;
 import com.github.pagehelper.PageHelper;
+import com.iflytek.wst.gateway.sdk.constant.SdkConstant;
+import com.iflytek.wst.gateway.sdk.model.ApiResponse;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.ibatis.session.SqlSessionFactory;
 import org.springframework.stereotype.Service;
@@ -171,16 +175,39 @@ public class AccountingDataServiceImpl implements IAccountingDataService {
      */
     @Override
     public AjaxResult wanShiTongList(AccountingDataVo accountingData) {
-        String zjhm = accountingData.getZjhm();
-        if (StringUtils.isEmpty(zjhm)){
-            return AjaxResult.error("身份证号码未提交");
+
+        //通过token获取信息
+        ApiResponse response = WstRestClient.getInstance().getUserInfoByToken(accountingData.getToken());
+
+        int code = response.getCode();
+        if(code!=200 || response.getBody() == null){
+            return AjaxResult.error("参数错误");
         }
+
+        String ResultBody = new String(response.getBody(), SdkConstant.CLOUDAPI_ENCODING);
+        Map maps = (Map)JSON.parse(ResultBody);
+        JSONObject data = (JSONObject)maps.get("data");
+        String idCard = (String) data.get("perUserVo.credentNo");
+        if (StringUtils.isEmpty(idCard)){
+            return AjaxResult.error("参数错误");
+        }
+        accountingData.setZjhm(idCard);
+        //获取当前时间
+        Date data1 = DateUtils.getNowDate();
+        String endTime = DateUtils.formatString(data1);
+        //当前时间往前推20天
+        String startTime = DateUtils.minusDayOfDate(20);
+        Map<String, Object> params = new HashMap<>();
+        params.put("startTime",startTime);
+        params.put("endTime",endTime);
+        accountingData.setParams(params);
+
         List<AccountingDataVo> accountingDataVos = accountingDataMapper.selectWanShiTongList(accountingData);
         return AjaxResult.success(accountingDataVos);
     }
     /***
      * 对外万事通开放接口
-     * 根据身份证号去查询核酸检测详情
+     * 根据身份证号和检测时间去查询核酸检测详情
      */
     @Override
     public AjaxResult wanShiTongInfo(AccountingDataVo accountingData) {

+ 19 - 0
boman-web-core/src/main/java/com/boman/web/core/wst/ApiPath.java

@@ -0,0 +1,19 @@
+package com.boman.web.core.wst;
+
+/**
+ * @author ycli7
+ * @since 2019/7/16 20:37
+ */
+public class ApiPath {
+    //消息通知
+	public static final String SAVE_MESSAGE_PUSH = "/msgPush/saveMsgPush";
+
+    //获取行政区划接口
+    public static final String GET_AREA_LIST = "/common/getAreaList";
+
+    //根据token获取用户信息
+    public static final String GET_LOGIN_USER = "/user/getLoginUser";
+
+    //登录
+    public static final String LOGIN_BY_USERNAME_AND_PWD = "/user/loginByUsernameAndPwd";
+}

+ 44 - 0
boman-web-core/src/main/java/com/boman/web/core/wst/ExampleUnitTest.java

@@ -0,0 +1,44 @@
+package com.boman.web.core.wst;
+
+
+import com.iflytek.wst.gateway.sdk.constant.SdkConstant;
+import com.iflytek.wst.gateway.sdk.model.ApiResponse;
+
+import java.io.IOException;
+
+public class ExampleUnitTest {
+
+    public static void main(String[] args) {
+        ExampleUnitTest unitTest = new ExampleUnitTest();
+        unitTest.pageBmfwForQueryList();
+
+    }
+
+
+    /**
+     * 根据token获取用户信息
+     *
+     * @return
+     */
+    public void pageBmfwForQueryList() {
+        ApiResponse response = WstRestClient.getInstance().getUserInfoByToken("0957577c496442c3b7c92cbaff061c35");
+        try {
+            System.out.println(getResultString(response));
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    private static String getResultString(ApiResponse response) throws IOException {
+        StringBuilder result = new StringBuilder();
+        result.append("Response from backend server").append(SdkConstant.CLOUDAPI_LF).append(SdkConstant.CLOUDAPI_LF);
+        result.append("ResultCode:").append(SdkConstant.CLOUDAPI_LF).append(response.getCode()).append(SdkConstant.CLOUDAPI_LF).append(SdkConstant.CLOUDAPI_LF);
+        if (response.getCode() != 200) {
+            result.append("Error description:").append(response.getHeaders().get("X-Ca-Error-Message")).append(SdkConstant.CLOUDAPI_LF).append(SdkConstant.CLOUDAPI_LF);
+        }
+        result.append("ResultBody:").append(SdkConstant.CLOUDAPI_LF).append(response.getBody() == null ? "null" : new String(response.getBody(), SdkConstant.CLOUDAPI_ENCODING));
+
+        return result.toString();
+    }
+
+}

+ 110 - 0
boman-web-core/src/main/java/com/boman/web/core/wst/WstRestClient.java

@@ -0,0 +1,110 @@
+package com.boman.web.core.wst;
+
+import com.iflytek.wst.gateway.sdk.client.ApacheHttpClient;
+import com.iflytek.wst.gateway.sdk.enums.HttpMethod;
+import com.iflytek.wst.gateway.sdk.enums.ParamPosition;
+import com.iflytek.wst.gateway.sdk.enums.Scheme;
+import com.iflytek.wst.gateway.sdk.model.ApiRequest;
+import com.iflytek.wst.gateway.sdk.model.ApiResponse;
+import com.iflytek.wst.gateway.sdk.model.HttpClientBuilderParams;
+import org.springframework.beans.factory.annotation.Value;
+
+import javax.net.ssl.*;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.security.cert.X509Certificate;
+
+public class WstRestClient extends ApacheHttpClient {
+    // 单例模式
+    private static WstRestClient instance = new WstRestClient();
+    public static WstRestClient getInstance() {
+        return instance;
+    }
+
+    // TODO 下面的参数,需要改为从配置文件读取
+    // 测试环境
+    @Value("${wst.appKey}")
+    private String appKey = "8a4ff1954caf4cab82c18f5886e7834e"; //根据实际情况填写
+    @Value("${wst.appSecret}")
+    private String appSecret = "e102667914bb407cb8aa79b82c0b8a0c"; //根据实际情况填写
+    private Scheme scheme = Scheme.HTTP;
+    private String host = "61.190.70.197:8800";
+    private String contextPath = "/wst-gateway";
+
+    // 生产环境
+    /*private String appKey = "8a4ff1954caf4cab82c18f5886e7834e"; //根据实际情况填写
+    private String appSecret = "e102667914bb407cb8aa79b82c0b8a0c"; //根据实际情况填写
+    private Scheme scheme = Scheme.HTTPS;
+    private String host = "www.ahzwfw.gov.cn";
+    private String contextPath = "/wst-gateway";*/
+
+
+    private WstRestClient() {
+        // HTTP Client init
+        HttpClientBuilderParams httpClientBuilderParams = new HttpClientBuilderParams();
+        httpClientBuilderParams.setAppKey(appKey);
+        httpClientBuilderParams.setAppSecret(appSecret);
+        httpClientBuilderParams.setScheme(scheme);
+        httpClientBuilderParams.setHost(host);
+        httpClientBuilderParams.setContextPath(contextPath);
+
+        // HTTPS客户端需要单独设置,禁用证书校验
+        if (scheme == Scheme.HTTPS) {
+            //HTTPS Client init
+            /**
+             * HTTPS request use DO_NOT_VERIFY mode only for demo
+             * Suggest verify for security
+             */
+            X509TrustManager xtm = new X509TrustManager() {
+                @Override
+                public void checkClientTrusted(X509Certificate[] chain, String authType) {
+                }
+
+                @Override
+                public void checkServerTrusted(X509Certificate[] chain, String authType) {
+                }
+
+                @Override
+                public X509Certificate[] getAcceptedIssuers() {
+                    X509Certificate[] x509Certificates = new X509Certificate[0];
+                    return x509Certificates;
+                }
+            };
+
+            SSLContext sslContext = null;
+            try {
+                sslContext = SSLContext.getInstance("SSL");
+                sslContext.init(null, new TrustManager[]{xtm}, new SecureRandom());
+
+            } catch (NoSuchAlgorithmException e) {
+                throw new RuntimeException(e);
+            } catch (KeyManagementException e) {
+                throw new RuntimeException(e);
+            }
+            HostnameVerifier DO_NOT_VERIFY = new HostnameVerifier() {
+                @Override
+                public boolean verify(String hostname, SSLSession session) {
+                    return true;
+                }
+            };
+
+            httpClientBuilderParams.setSslSocketFactory(sslContext.getSocketFactory());
+            httpClientBuilderParams.setX509TrustManager(xtm);
+            httpClientBuilderParams.setHostnameVerifier(DO_NOT_VERIFY);
+        }
+
+        super.init(httpClientBuilderParams);
+    }
+
+
+
+    public ApiResponse getUserInfoByToken(String token){
+        ApiRequest request = new ApiRequest(HttpMethod.GET, "/user/getUserInfoByToken");
+        request.addParam("token", token, ParamPosition.QUERY, true);
+        request.addParam("serviceId", "服务id 可以不填", ParamPosition.QUERY, true);
+        request.addParam("roleCode", "", ParamPosition.QUERY, true);
+        return sendSyncRequest(request);
+    }
+
+}

+ 36 - 6
boman-web-core/src/main/resources/mapper/AccountingDateMapper.xml

@@ -537,16 +537,46 @@
               GROUP BY zjhm) a;
     </select>
     <select id="selectWanShiTongList" resultMap="AccountingDataResult">
-        select id, jcjg,jcdd, cjsj, jcsj from accounting_data
-        <where> is_del = 'N'
-        <if test="zjhm != null  and zjhm != ''">and zjhm = #{zjhm}</if>
-        <if test=" params.startTime != null  and params.startTime != ''">and cjsj bewteen #{params.startTime} and #{params.endTime}</if>
+        SELECT
+        sfzhm as zjhm
+        ,xm as xm
+        ,sjhm as lxdh
+        ,cjsj as cjsj
+        ,jgcjss as jcsj
+        ,jcdd as  jcdd
+        ,jcjg as jcjg
+        ,sjly as cjdd
+        FROM
+        ods_qss_hsjcxx_all
+        <where> 1=1
+        <if test="zjhm != null  and zjhm != ''">and sfzhm = #{zjhm}</if>
+            <if test="params.startTime != null  and params.startTime != '' and params.startTime != 'null'">and
+                DATE_FORMAT(cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
+            </if>
+            <if test="params.endTime != null  and params.endTime != ''  and params.endTime != 'null'">and
+                DATE_FORMAT(cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
+            </if>
         </where>
+        order by cjsj desc
     </select>
 
     <select id="selectWanShiTongInfo" resultMap="AccountingDataResult">
-
-        select xm,zjhm,
+        SELECT
+            sfzhm as zjhm
+             ,xm as xm
+             ,sjhm as lxdh
+             ,cjsj as cjsj
+             ,jgcjss as jcsj
+             ,jcdd as  jcdd
+             ,jcjg as jcjg
+             ,sjly as cjdd
+        FROM
+            ods_qss_hsjcxx_all
+        WHERE
+            1 = 1
+          AND cjsj like concat(#{cjsj}, '%')
+          AND sfzhm = #{zjhm}
+        limit 1
     </select>
 
 </mapper>