Commit bbebdd34 authored by 赵建伟's avatar 赵建伟

update codes

parent 397a87f4
...@@ -27,7 +27,7 @@ $JAR_DIR/ctr-estimate-1.0-SNAPSHOT.jar \ ...@@ -27,7 +27,7 @@ $JAR_DIR/ctr-estimate-1.0-SNAPSHOT.jar \
--retryInteral 3000 \ --retryInteral 3000 \
--checkpointPath 'hdfs://bj-gmei-hdfs/user/data/flink/ctr-estimate-tag/checkpoint' \ --checkpointPath 'hdfs://bj-gmei-hdfs/user/data/flink/ctr-estimate-tag/checkpoint' \
--parallelism 6 \ --parallelism 6 \
--startTime '2020-04-04 11:56:00' \ --startTime '2020-04-04 12:23:00' \
>> /data/log/ctr-estimate/ctr-estimate-tag.out 2>&1 & >> /data/log/ctr-estimate/ctr-estimate-tag.out 2>&1 &
tail -f /data/log/ctr-estimate/ctr-estimate-tag.out tail -f /data/log/ctr-estimate/ctr-estimate-tag.out
......
...@@ -11,13 +11,13 @@ public class CtrEstimateTagEtl { ...@@ -11,13 +11,13 @@ public class CtrEstimateTagEtl {
private String estimateType; private String estimateType;
private Integer count; private Integer count;
private String cardContentType; private String cardContentType;
private String cardId; private Long cardId;
private String partitionDate; private String partitionDate;
private String lastUpdateTime; private String lastUpdateTime;
private String type; private String type;
private String keyWord; private String keyWord;
public CtrEstimateTagEtl(String deviceId, String cardContentType, String cardId, String estimateType, Integer count, String partitionDate, String lastUpdateTime,String type,String keyWord) { public CtrEstimateTagEtl(String deviceId, String cardContentType, Long cardId, String estimateType, Integer count, String partitionDate, String lastUpdateTime,String type,String keyWord) {
this.deviceId = deviceId; this.deviceId = deviceId;
this.cardContentType = cardContentType; this.cardContentType = cardContentType;
this.cardId = cardId; this.cardId = cardId;
...@@ -48,11 +48,11 @@ public class CtrEstimateTagEtl { ...@@ -48,11 +48,11 @@ public class CtrEstimateTagEtl {
this.cardContentType = cardContentType; this.cardContentType = cardContentType;
} }
public String getCardId() { public Long getCardId() {
return cardId; return cardId;
} }
public void setCardId(String cardId) { public void setCardId(Long cardId) {
this.cardId = cardId; this.cardId = cardId;
} }
......
...@@ -82,7 +82,14 @@ public class CtrEstimateTagOperator implements BaseOperator{ ...@@ -82,7 +82,14 @@ public class CtrEstimateTagOperator implements BaseOperator{
} }
if (StringUtils.isNotBlank(clId)) { if (StringUtils.isNotBlank(clId)) {
String cardContentType = paramsObject.getString("card_content_type"); String cardContentType = paramsObject.getString("card_content_type");
String cardId = paramsObject.getString("card_id"); String cardIdStr = paramsObject.getString("card_id");
Long cardId = 0L;
try{
cardId = Long.valueOf(cardIdStr);
}catch (Exception e){
e.printStackTrace();
return false;
}
if (null != cardContentType && null != cardId) { if (null != cardContentType && null != cardId) {
if ("service".equals(cardContentType) || "diary".equals(cardContentType) || if ("service".equals(cardContentType) || "diary".equals(cardContentType) ||
"tractate".equals(cardContentType) || "answer".equals(cardContentType)) { "tractate".equals(cardContentType) || "answer".equals(cardContentType)) {
...@@ -121,7 +128,8 @@ public class CtrEstimateTagOperator implements BaseOperator{ ...@@ -121,7 +128,8 @@ public class CtrEstimateTagOperator implements BaseOperator{
} }
if (StringUtils.isNotBlank(clId)) { if (StringUtils.isNotBlank(clId)) {
String cardContentType = paramsObject.getString("card_content_type"); String cardContentType = paramsObject.getString("card_content_type");
String cardId = paramsObject.getString("card_id"); String cardIdStr = paramsObject.getString("card_id");
Long cardId = Long.valueOf(cardIdStr);
ctrEstimateTagEtl.setDeviceId(deviceId); ctrEstimateTagEtl.setDeviceId(deviceId);
if (null != cardContentType && null != cardId) { if (null != cardContentType && null != cardId) {
ctrEstimateTagEtl.setCardId(cardId); ctrEstimateTagEtl.setCardId(cardId);
......
...@@ -70,21 +70,21 @@ public class TidbMysqlAsyncSource extends RichAsyncFunction<CtrEstimateTagEtl, D ...@@ -70,21 +70,21 @@ public class TidbMysqlAsyncSource extends RichAsyncFunction<CtrEstimateTagEtl, D
if("commodity".equals(type) || "content".equals(type)){ if("commodity".equals(type) || "content".equals(type)){
String sql = null; String sql = null;
String cardContentType = ctrEstimateTagEtl.getCardContentType(); String cardContentType = ctrEstimateTagEtl.getCardContentType();
String cardId = ctrEstimateTagEtl.getCardId(); Long cardId = ctrEstimateTagEtl.getCardId();
if("commodity".equals(type) && "service".equals(cardContentType)){ if("commodity".equals(type) && "service".equals(cardContentType)){
sql = String.format("select first_demands,first_positions,first_solutions,second_demands,second_positions,second_solutions,project_tags " + sql = String.format("select first_demands,first_positions,first_solutions,second_demands,second_positions,second_solutions,project_tags " +
"from strategy_service_tagv3_info where service_id = '%s'",cardId); "from strategy_service_tagv3_info where service_id = '%d'",cardId);
} }
if("content".equals(type)){ if("content".equals(type)){
if("diary".equals(cardContentType)){ if("diary".equals(cardContentType)){
sql = String.format("select first_demands,first_positions,first_solutions,second_demands,second_positions,second_solutions,project_tags " + sql = String.format("select first_demands,first_positions,first_solutions,second_demands,second_positions,second_solutions,project_tags " +
"from strategy_content_tagv3_info where content_id = '%s'",cardId); "from strategy_content_tagv3_info where content_id = '%d'",cardId);
}else if("tractate".equals(cardContentType)){ }else if("tractate".equals(cardContentType)){
sql = String.format("select first_demands,first_positions,first_solutions,second_demands,second_positions,second_solutions,project_tags " + sql = String.format("select first_demands,first_positions,first_solutions,second_demands,second_positions,second_solutions,project_tags " +
"from strategy_tractate_tagv3_info where content_id = '%s'",cardId); "from strategy_tractate_tagv3_info where content_id = '%d'",cardId);
}else if("answer".equals(cardContentType)){ }else if("answer".equals(cardContentType)){
sql = String.format("select first_demands,first_positions,first_solutions,second_demands,second_positions,second_solutions,project_tags " + sql = String.format("select first_demands,first_positions,first_solutions,second_demands,second_positions,second_solutions,project_tags " +
"from strategy_answer_tagv3_info where content_id = '%s'",cardId); "from strategy_answer_tagv3_info where content_id = '%d'",cardId);
} }
} }
if(StringUtils.isNotBlank(sql)){ if(StringUtils.isNotBlank(sql)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment