Authored by mingdan.ge

cps消息

... ... @@ -4,6 +4,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
... ... @@ -19,7 +20,8 @@ public class SendMessageHelper {
static Map<Integer, String> keyMap = new HashMap<Integer, String>(){{
put(1,"AyIBF3VgCkk4V4s4NIuNmjcIe5IUeufmlMXv0oxcj74");//每日新产生佣金提醒
put(2,"9nUlr41s8vvOgKZ-xA5_VV_Gqs-868_KxdRzDziYTa4");//提现打款提醒
put(3,"6pqy58jRZ8v7VuJ2QzJOGIvelwm-M2l5H_5Sq8nYaOE");//可结算提醒
put(3,"IE7sO6J-r1iEd-G6dmuFaN64Qnk9lqJFmsBpO1YACWs");//可结算提醒
put(4,"QtoMH65mEHuDYMAtNKLSrIxQKqNNdDLDl_dMOY1cHhw");//申请成功提醒
}};
public <T> void sendMessage(int uid,int type,T value) {
... ... @@ -36,4 +38,18 @@ public class SendMessageHelper {
log.error("sendMessage error,e is {}.",e);
}
}
public void sendMessage(int uid, int type, int time, BigDecimal amount) {
log.info("sendMessage enter,uid is {},type is {},time is {},amount is {}.",uid,type,time,amount);
String key = keyMap.get(type);
if (key == null) {
log.info("sendMessage end,type error,uid is {},type is {},time is {},amount is {}.",uid,type,time,amount);
return;
}
try {
System.out.println(key);
} catch (Exception e) {
log.error("sendMessage error,e is {}.",e);
}
}
}
... ...
... ... @@ -639,6 +639,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
int result = unionShareUserMapper.insertSelective(unionShareUser);
if (result > 0) {
logger.info("relateUnionType,begin to send message,uid is {},unionType is {}", uid,unionDepartmentUrl.getUnionType());
//
sendMessageHelper.sendMessage(uid,1,unionShareUser.getCreateTime(),null);
//发送联盟用户申请成功短信
sendSmsService.smsSendByMobile(UNION_SHARE_USER_APPLY_PASS_SMS_CONTENT, Lists.newArrayList(mobile));
}
... ... @@ -1703,7 +1705,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
return;
}
logger.info("sendUidAoumtMessage,startTime is {},endTime is {},uids is {}.",startTime,endTime,uids);
uids.forEach(u->sendMessageHelper.sendMessage(u.getPromoteUid(),1,u));
int now = DateUtil.getCurrentTimeSecond();
uids.forEach(u->sendMessageHelper.sendMessage(u.getPromoteUid(),1,now,u.getAmount()));
}
/**
* 发送可结算佣金提醒
... ... @@ -1715,7 +1718,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
return;
}
logger.info("sendUidSettlementMessage,startTime is {},endTime is {},uids is {}.",startTime,endTime,uids);
uids.forEach(u->sendMessageHelper.sendMessage(u.getPromoteUid(),3,u));
int now = DateUtil.getCurrentTimeSecond();
uids.forEach(u->sendMessageHelper.sendMessage(u.getPromoteUid(),3,now,u.getAmount()));
}
//查询已结束等待发放奖励的普通额外返活动
... ... @@ -2471,7 +2475,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
unionShareOrdersMapper.updateStatusByCode(bo.getSettlementCode(), ShareOrdersStatusEnum.SETTLE.getCode(), ShareOrdersStatusEnum.HAS_SETTLE.getCode(), updateReq.getUpdateTime());
//todo 发送打款公众号消息
sendMessageHelper.sendMessage(bo.getPromoteUid(),2,bo);
sendMessageHelper.sendMessage(bo.getPromoteUid(),2,updateReq.getUpdateTime(),bo.getSettlementAmount());
//清缓存
clearShareOrderRedis(unionShareSettlement.getPromoteUid());
}
... ... @@ -2687,7 +2691,10 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
logger.info("addMessage.req is {}",record);
record.setCreateTime(DateUtils.getCurrentTimeSecond());
record.setUpdateTime(DateUtils.getCurrentTimeSecond());
//列表页有固定的分享id
if (record.getType() == 3 && record.getSomeKey() == null) {
record.setSomeKey(configReader.getInt(UNION_SHAREID, 0));
}
return unionShareMessageMapper.insert(record);
}
... ... @@ -2706,7 +2713,10 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
if(null == record || null == record.getId()) {
return 0;
}
//列表页有固定的分享id
if (record.getType() == 3 && record.getSomeKey() == null) {
record.setSomeKey(configReader.getInt(UNION_SHAREID, 0));
}
record.setUpdateTime(DateUtils.getCurrentTimeSecond());
return unionShareMessageMapper.updateByPrimaryKeySelective(record);
}
... ...
... ... @@ -131,10 +131,10 @@
</div>
<div class="row-input">
<div class="row-left">
标识
链接标识
</div>
<div class="row-right">
<input id="someKey" name="someKey" class="easyui-textbox" style="width:180px"><font color="gray">选择商品详情页或者拼团商品详情页时需填skn</font>
<input id="someKey" name="someKey" class="easyui-textbox" style="width:180px"><font color="gray">商品详情页、拼团商品详情页填skn,h5、咨询、拼团列表页填相应id</font>
</div>
</div>
<div class="row-input">
... ... @@ -243,15 +243,31 @@
}
requestObj.type = type;
if(type==1||type==6) {
var someKey = $("#someKey").val();
if (someKey == "") {
alert("此类型标识字段需填入skn");
var someKey = $("#someKey").val();
if(someKey == "") {
//消息类型:0-其他,1-商品详情页,2-h5,3-列表页,4-资讯,5-拼团列表,6-拼团商品详情页
if (type==1||type==6) {
alert("链接标识需填入skn");
$("#someKey").focus();
return;
}
if (type==2) {
alert("链接标识需填入h5的分享id");
$("#someKey").focus();
return;
}
if (type==4) {
alert("链接标识需填入资讯id");
$("#someKey").focus();
return;
}
if (type==5) {
alert("链接标识需填入拼团活动id");
$("#someKey").focus();
return;
}
requestObj.someKey = someKey;
}
requestObj.someKey = someKey;
var priority = $("#priority").val();
if (priority == "") {
... ...
... ... @@ -144,10 +144,10 @@ function getQueryString(url,name) {
</div>
<div class="row-input">
<div class="row-left">
标识
链接标识
</div>
<div class="row-right">
<input id="someKey" name="someKey" class="easyui-textbox" style="width:180px"><font color="gray">选择商品详情页或者拼团商品详情页时需填skn</font>
<input id="someKey" name="someKey" class="easyui-textbox" style="width:180px"><font color="gray">商品详情页、拼团商品详情页填skn,h5、咨询、拼团列表页填相应id</font>
</div>
</div>
<div class="row-input">
... ... @@ -284,15 +284,31 @@ function getQueryString(url,name) {
}
requestObj.type = type;
if(type==1||type==6) {
var someKey = $("#someKey").val();
if (someKey == "") {
alert("此类型标识字段需填入skn");
var someKey = $("#someKey").val();
if(someKey == "") {
//消息类型:0-其他,1-商品详情页,2-h5,3-列表页,4-资讯,5-拼团列表,6-拼团商品详情页
if (type==1||type==6) {
alert("链接标识需填入skn");
$("#someKey").focus();
return;
}
if (type==2) {
alert("链接标识需填入h5的分享id");
$("#someKey").focus();
return;
}
if (type==4) {
alert("链接标识需填入资讯id");
$("#someKey").focus();
return;
}
if (type==5) {
alert("链接标识需填入拼团活动id");
$("#someKey").focus();
return;
}
requestObj.someKey = someKey;
}
requestObj.someKey = someKey;
var priority = $("#priority").val();
if (priority == "") {
... ...
... ... @@ -103,7 +103,7 @@
align: "center",
formatter : function(value, rowData, rowIndex) {
var newData = JSON.stringify(rowData);
var imgstr="<a href='"+rowData.image+"'><img src='"+rowData.image+"' height='78px;' width='59px;' /></a>";
var imgstr="<a href='"+rowData.image+"'><img src='"+rowData.image+"' width='159px;' /></a>";
return imgstr;
}
}, {
... ... @@ -141,7 +141,7 @@
}
}
}, {
title: "标识",
title: "链接标识",
field: "someKey",
width: 80,
align: "center"
... ...