67587286 by ja

no message

1 parent 9c9e1a2a
......@@ -4,11 +4,11 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>csair_dp_HDP</artifactId>
<artifactId>yry_dp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>csair_dp_HDP</name>
<name>yry_dp</name>
<description>Demo project for Spring Boot</description>
<parent>
......
......@@ -8,8 +8,6 @@ import java.util.Date;
public class HttpLog {
private Long id;
private String app_id;
private String url;
private String param;
......@@ -58,11 +56,4 @@ public class HttpLog {
this.create_at = create_at;
}
public String getApp_id() {
return app_id;
}
public void setApp_id(String app_id) {
this.app_id = app_id;
}
}
......
......@@ -7,6 +7,7 @@ import com.example.support.model.MessageEntity;
import com.example.utils.md5.MD5Utils;
import com.example.utils.mybatis.pageable.Pageable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.text.ParseException;
......@@ -24,19 +25,26 @@ public class HapiServiceImpl implements HapiService {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM");
private Integer source = 34;
@Value("${hpai.source}")
private Integer source;
private Integer channelId = 952;
@Value("${hpai.channelId}")
private Integer channelId;
private Integer managerId = 1001490786;
@Value("${hpai.managerId}")
private Integer managerId;
private String key = "HXJYUR";
@Value("${hpai.registermd5key}")
private String registermd5key;
private String pgkey = "HXJYRG";
@Value("${hpai.genereportmd5key}")
private String genereportmd5key;
private String reportType = "pdf";
@Value("${hpai.reportType}")
private String reportType;
private Integer downFlag = 1;
@Value("${hpai.downFlag}")
private Integer downFlag;
@Autowired
private HttpPostService httpPostService;
......@@ -44,7 +52,8 @@ public class HapiServiceImpl implements HapiService {
@Autowired
private MemberInfoMapper memberInfoMapper;
private static String HOST = "http://www.17jiankang.com";
@Value("${hpai.host}")
private String host;
private static String REGISTER_URL = "/hxgrm/hapi/v1/genedetection/geneuser/register";
......@@ -59,7 +68,7 @@ public class HapiServiceImpl implements HapiService {
Map<String,Object> paremMap = new HashMap<>();
paremMap.put("source",source);
paremMap.put("timestamp",timestamp);
String validate = MD5Utils.hash(source+barcode+timestamp+key);
String validate = MD5Utils.hash(source+barcode+timestamp+registermd5key);
// paremMap.put("validcode",validcode);
// paremMap.put("validkey",validkey);
paremMap.put("barcode",barcode);
......@@ -78,8 +87,10 @@ public class HapiServiceImpl implements HapiService {
paremMap.put("height",height);
paremMap.put("remarks",remarks);
paremMap.put("validate",validate);
String url = HOST + REGISTER_URL;
String url = host + REGISTER_URL;
System.out.println(url);
Map<String, Object> map = this.httpPostService.httpPost(url, paremMap);
System.out.println(map);
if(map.containsKey("ret") && map.get("ret").toString().equals("0") && map.containsKey("uuid")){
String memberNumber = map.get("uuid") != null ? map.get("uuid").toString() : "";
MemberInfo memberInfo = new MemberInfo();
......@@ -117,7 +128,7 @@ public class HapiServiceImpl implements HapiService {
Map<String,Object> paremMap = new HashMap<>();
paremMap.put("source",source);
paremMap.put("timestamp",timestamp);
String validate = MD5Utils.hash(source+barcode+timestamp+pgkey);
String validate = MD5Utils.hash(source+barcode+timestamp+genereportmd5key);
// paremMap.put("validcode",validcode);
// paremMap.put("validkey",validkey);
paremMap.put("barcode",barcode);
......@@ -126,7 +137,7 @@ public class HapiServiceImpl implements HapiService {
paremMap.put("validate",validate);
paremMap.put("reportType",reportType);
paremMap.put("downFlag",downFlag);
String url = HOST + GENEREPORT_GET_URL;
String url = host + GENEREPORT_GET_URL;
Map<String, Object> map = this.httpPostService.httpPost(url, paremMap);
if(map.containsKey("ret") && map.get("ret").toString().equals("0")){
String pdfurl = map.get("url") != null ? map.get("url").toString() : "";
......
......@@ -69,10 +69,9 @@ public class HttpPostServiceImpl implements HttpPostService {
try {
String postDataString = objectMapper.writeValueAsString(postData);
httpLog.setParam(postDataString);
httpLog.setApp_id(app_id);
// this.httpLogMapper.create(httpLog);
this.httpLogMapper.create(httpLog);
String responseEntity = post(url, postDataString, CONFIG);
// this.httpLogMapper.update(httpLog.getId(),responseEntity);
this.httpLogMapper.update(httpLog.getId(),responseEntity);
readValue = objectMapper.readValue(responseEntity, new TypeReference<Map<String, Object>>() {
});
} catch (JsonProcessingException e) {
......@@ -103,9 +102,9 @@ public class HttpPostServiceImpl implements HttpPostService {
try {
String postDataString = objectMapper.writeValueAsString(postData);
httpLog.setParam(postDataString);
// this.httpLogMapper.create(httpLog);
this.httpLogMapper.create(httpLog);
String responseEntity = post(url, postData, CONFIG);
// this.httpLogMapper.update(httpLog.getId(),responseEntity);
this.httpLogMapper.update(httpLog.getId(),responseEntity);
readValue = objectMapper.readValue(responseEntity, new TypeReference<Map<String, Object>>() {
});
} catch (JsonProcessingException e) {
......@@ -136,10 +135,9 @@ public class HttpPostServiceImpl implements HttpPostService {
try {
String postDataString = objectMapper.writeValueAsString(postData);
httpLog.setParam(postDataString);
httpLog.setApp_id(app_id);
// this.httpLogMapper.create(httpLog);
this.httpLogMapper.create(httpLog);
String responseEntity = postForm(url, postDataString, CONFIG);
// this.httpLogMapper.update(httpLog.getId(),responseEntity);
this.httpLogMapper.update(httpLog.getId(),responseEntity);
readValue = objectMapper.readValue(responseEntity, new TypeReference<Map<String, Object>>() {
});
} catch (JsonProcessingException e) {
......
......@@ -18,3 +18,13 @@ spring.datasource.jdbc-interceptors=ConnectionState;SlowQueryReport(threshold=0)
#mybatis
mybatis.mapperLocations=classpath*:mappers/*.xml
mybatis.configLocation=classpath:/mybatis-config.xml
hpai.host=http://www.17jiankang.com
hpai.source=34
hpai.channelId=952
hpai.managerId=1001490786
hpai.registermd5key=HXJYUR
hpai.genereportmd5key=HXJYRG
hpai.reportType=pdf
hpai.downFlag=1
......
......@@ -8,16 +8,13 @@
INSERT INTO t_http_log (
url,
param,
app_id,
create_at,
restful
)
VALUES (
#{url},
#{param},
#{app_id},
#{create_at},
#{restful}
......
......@@ -76,6 +76,7 @@
<if test="status != -1">
and is_genereport = #{status}
</if>
order by id desc
</select>
......