101captain
2022-04-01 8423db877f03c01fa73b2d40fd01f7a9a65ac2b2
党建bug修改
2个文件已修改
6个文件已添加
292 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/PartyBuildingApi.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/pom.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/Highlist.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/Middlelist.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ReturnData.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/CodDataService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/CodDataServiceImpl.java 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/util/JsoupUtil.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/PartyBuildingApi.java
@@ -276,4 +276,17 @@
        }
        return pbCheckUnitFeign.queryByList(comPbCheckUnit);
    }
    @OperLog(operModul = "党员管理", operType = 1)
    @ApiOperation(value = "新增党员")
    @PostMapping("addpartybuildingmember")
    public R addPartyBuildingMember(@RequestBody PartyBuildingMemberVO partyBuildingMemberVO) {
        Long communityId = this.getCommunityId();
        partyBuildingMemberVO.setCommunityId(communityId);
        R r = partyBuildingService.addPartyBuildingMember(partyBuildingMemberVO);
        if (R.isOk(r)) {
            R r1 = userService.updateUserIsPartymember(partyBuildingMemberVO.getIdCard());
        }
        return r;
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/pom.xml
@@ -55,6 +55,12 @@
            <groupId>com.netflix.hystrix</groupId>
            <artifactId>hystrix-javanica</artifactId>
        </dependency>
        <!--jsoup爬虫爬取网页 -->
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.13.1</version>
        </dependency>
        <dependency>
            <groupId>com.baomidou</groupId>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/Highlist.java
New file
@@ -0,0 +1,18 @@
package com.panzhihua.service_community.model.dos;
import lombok.Data;
import java.util.List;
/**
 * @author zzj
 */
@Data
public class Highlist {
    private String type;
    private String province;
    private String city;
    private String county;
    private String area_name;
    private List<String> communitys;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/Middlelist.java
New file
@@ -0,0 +1,18 @@
package com.panzhihua.service_community.model.dos;
import lombok.Data;
import java.util.List;
/**
 * @author zzj
 */
@Data
public class Middlelist {
    private String type;
    private String province;
    private String city;
    private String county;
    private String area_name;
    private List<String> communitys;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ReturnData.java
New file
@@ -0,0 +1,17 @@
package com.panzhihua.service_community.model.dos;
import lombok.Data;
import java.util.List;
/**
 * @author zzj
 */
@Data
public class ReturnData {
    private String end_update_time;
    private int hcount;
    private int mcount;
    private List<Highlist> highlist;
    private List<Middlelist> middlelist;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/CodDataService.java
New file
@@ -0,0 +1,12 @@
package com.panzhihua.service_community.service;
/**
 * 国务院防疫数据服务层
 * @author zzj
 */
public interface CodDataService {
    /**
     * 获取风险区数据
     */
    public void getCodData();
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/CodDataServiceImpl.java
New file
@@ -0,0 +1,107 @@
package com.panzhihua.service_community.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_community.model.dos.Highlist;
import com.panzhihua.service_community.model.dos.Middlelist;
import com.panzhihua.service_community.model.dos.ReturnData;
import com.panzhihua.service_community.service.CodDataService;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @title: BigScreenStatisticsServiceImpl
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 国务院防疫数据服务实现类
 * @author: zzj
 * @date: 2022/4/1 9:56
 */
@Service
public class CodDataServiceImpl implements CodDataService {
    @Override
    public void getCodData() {
        //获取时间戳
        long timestamp = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"));
        String url = "http://103.66.32.242:8005/zwfwMovePortal/interface/interfaceJson";
        //以下常量值都是从网页源代码上获取到的------start
        final String STATE_COUNCIL_SIGNATURE_KEY = "fTN2pfuisxTavbTuYVSsNJHetwq5bJvCQkjjtiLM2dCratiA";
        final String STATE_COUNCIL_X_WIF_NONCE = "QkjjtiLM2dCratiA";
        final String STATE_COUNCIL_X_WIF_PAASID = "smt-application";
        //国务院疫情防控查询 appId
        final String STATE_COUNCIL_APP_ID = "NcApplication";
        //国务院疫情防控查询 PASSID
        final String STATE_COUNCIL_PASSID = "zdww";
        //国务院疫情防控查询 秘钥
        final String STATE_COUNCIL_NONCE = "123456789abcdefg";
        //国务院疫情防控查询 token
        final String STATE_COUNCIL_TOEKN = "23y0ufFl5YxIyGrI8hWRUZmKkvtSjLQA";
        //国务院疫情防控查询 key
        final String STATE_COUNCIL_KEY = "3C502C97ABDA40D0A60FBEE50FAAD1DA";
        //以下常量值都是从网页源代码上获取到的------end
        HttpHeaders requestHeaders = new HttpHeaders();
        Map<String,Object> body = new HashMap<>(10);
        //计算签名要用的字符串
        String signatureStr = String.format("%d%s%d",timestamp, STATE_COUNCIL_SIGNATURE_KEY,timestamp);
        //计算签名
        String signature = getSHA256StrJava(signatureStr).toUpperCase();
        //请求头参数封装
        requestHeaders.add( "x-wif-nonce",STATE_COUNCIL_X_WIF_NONCE);
        requestHeaders.add( "x-wif-paasid",STATE_COUNCIL_X_WIF_PAASID);
        requestHeaders.add( "x-wif-signature",signature);
        requestHeaders.add( "x-wif-timestamp",String.valueOf(timestamp));
        //body参数封装
        body.put("appId",STATE_COUNCIL_APP_ID);
        body.put("paasHeader",STATE_COUNCIL_PASSID);
        body.put("timestampHeader",timestamp);
        body.put("nonceHeader",STATE_COUNCIL_NONCE);
        //请求参数
        signatureStr = String.format("%d%s%s%d",timestamp,STATE_COUNCIL_TOEKN,STATE_COUNCIL_NONCE,timestamp);
        String signatureHeader = getSHA256StrJava(signatureStr).toUpperCase();
        body.put("signatureHeader",signatureHeader);
        body.put("key",STATE_COUNCIL_KEY);
        HttpEntity<String> httpEntity = new HttpEntity(body, requestHeaders);
        ResponseEntity<String> response = new RestTemplate().exchange(url, HttpMethod.POST,httpEntity,String.class);
        R r=JSONObject.parseObject(response.getBody(),R.class);
        ReturnData returnData=JSONObject.parseObject(JSONObject.toJSONString(r.getData()), ReturnData.class);
        List<Highlist> highlist=returnData.getHighlist();
        List<Middlelist> middlelist=returnData.getMiddlelist();
    }
    public static String getSHA256StrJava(String str) {
        MessageDigest messageDigest;
        String encodeStr = "";
        try {
            messageDigest = MessageDigest.getInstance("SHA-256");
            messageDigest.update(str.getBytes(StandardCharsets.UTF_8));
            byte[] bytes = messageDigest.digest();
            StringBuffer stringBuffer = new StringBuffer();
            String temp = null;
            for (int i = 0; i < bytes.length; i++) {
                temp = Integer.toHexString(bytes[i] & 0xFF);
                if (temp.length() == 1) {
                    //1得到一位的进行补0操作
                    stringBuffer.append("0");
                }
                stringBuffer.append(temp);
            }
            encodeStr = stringBuffer.toString();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return encodeStr;
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/util/JsoupUtil.java
New file
@@ -0,0 +1,101 @@
package com.panzhihua.service_community.util;
import com.alibaba.fastjson.JSONObject;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @author zzj
 */
@Component
public class JsoupUtil {
    public static String getSHA256StrJava(String str) {
        MessageDigest messageDigest;
        String encodeStr = "";
        try {
            messageDigest = MessageDigest.getInstance("SHA-256");
            messageDigest.update(str.getBytes(StandardCharsets.UTF_8));
            byte[] bytes = messageDigest.digest();
            StringBuffer stringBuffer = new StringBuffer();
            String temp = null;
            for (int i = 0; i < bytes.length; i++) {
                temp = Integer.toHexString(bytes[i] & 0xFF);
                if (temp.length() == 1) {
                    //1得到一位的进行补0操作
                    stringBuffer.append("0");
                }
                stringBuffer.append(temp);
            }
            encodeStr = stringBuffer.toString();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return encodeStr;
    }
    public  void test() {
        //获取时间戳
        long timestamp = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"));
        String url = "http://103.66.32.242:8005/zwfwMovePortal/interface/interfaceJson";
        //以下常量值都是从网页源代码上获取到的------start
        final String STATE_COUNCIL_SIGNATURE_KEY = "fTN2pfuisxTavbTuYVSsNJHetwq5bJvCQkjjtiLM2dCratiA";
        final String STATE_COUNCIL_X_WIF_NONCE = "QkjjtiLM2dCratiA";
        final String STATE_COUNCIL_X_WIF_PAASID = "smt-application";
        //国务院疫情防控查询 appId
        final String STATE_COUNCIL_APP_ID = "NcApplication";
        //国务院疫情防控查询 PASSID
        final String STATE_COUNCIL_PASSID = "zdww";
        //国务院疫情防控查询 秘钥
        final String STATE_COUNCIL_NONCE = "123456789abcdefg";
        //国务院疫情防控查询 token
        final String STATE_COUNCIL_TOEKN = "23y0ufFl5YxIyGrI8hWRUZmKkvtSjLQA";
        //国务院疫情防控查询 key
        final String STATE_COUNCIL_KEY = "3C502C97ABDA40D0A60FBEE50FAAD1DA";
        //以下常量值都是从网页源代码上获取到的------end
        HttpHeaders requestHeaders = new HttpHeaders();
        Map<String,Object> body = new HashMap<>(10);
        //计算签名要用的字符串
        String signatureStr = String.format("%d%s%d",timestamp, STATE_COUNCIL_SIGNATURE_KEY,timestamp);
        //计算签名
        String signature = getSHA256StrJava(signatureStr).toUpperCase();
        //请求头参数封装
        requestHeaders.add( "x-wif-nonce",STATE_COUNCIL_X_WIF_NONCE);
        requestHeaders.add( "x-wif-paasid",STATE_COUNCIL_X_WIF_PAASID);
        requestHeaders.add( "x-wif-signature",signature);
        requestHeaders.add( "x-wif-timestamp",String.valueOf(timestamp));
        //body参数封装
        body.put("appId",STATE_COUNCIL_APP_ID);
        body.put("paasHeader",STATE_COUNCIL_PASSID);
        body.put("timestampHeader",timestamp);
        body.put("nonceHeader",STATE_COUNCIL_NONCE);
        //请求参数
        signatureStr = String.format("%d%s%s%d",timestamp,STATE_COUNCIL_TOEKN,STATE_COUNCIL_NONCE,timestamp);
        String signatureHeader = getSHA256StrJava(signatureStr).toUpperCase();
        body.put("signatureHeader",signatureHeader);
        body.put("key",STATE_COUNCIL_KEY);
        HttpEntity<String> httpEntity = new HttpEntity(body, requestHeaders);
        ResponseEntity<String> response = new RestTemplate().exchange(url, HttpMethod.POST,httpEntity,String.class);
        System.out.println(JSONObject.toJSONString(JSONObject.parseObject(response.getBody()),true));
    }
}