Authored by mingdan.ge

cps消息

@@ -4,6 +4,7 @@ import org.slf4j.Logger; @@ -4,6 +4,7 @@ import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory; 4 import org.slf4j.LoggerFactory;
5 import org.springframework.stereotype.Component; 5 import org.springframework.stereotype.Component;
6 6
  7 +import java.math.BigDecimal;
7 import java.util.HashMap; 8 import java.util.HashMap;
8 import java.util.Map; 9 import java.util.Map;
9 10
@@ -19,7 +20,8 @@ public class SendMessageHelper { @@ -19,7 +20,8 @@ public class SendMessageHelper {
19 static Map<Integer, String> keyMap = new HashMap<Integer, String>(){{ 20 static Map<Integer, String> keyMap = new HashMap<Integer, String>(){{
20 put(1,"AyIBF3VgCkk4V4s4NIuNmjcIe5IUeufmlMXv0oxcj74");//每日新产生佣金提醒 21 put(1,"AyIBF3VgCkk4V4s4NIuNmjcIe5IUeufmlMXv0oxcj74");//每日新产生佣金提醒
21 put(2,"9nUlr41s8vvOgKZ-xA5_VV_Gqs-868_KxdRzDziYTa4");//提现打款提醒 22 put(2,"9nUlr41s8vvOgKZ-xA5_VV_Gqs-868_KxdRzDziYTa4");//提现打款提醒
22 - put(3,"6pqy58jRZ8v7VuJ2QzJOGIvelwm-M2l5H_5Sq8nYaOE");//可结算提醒 23 + put(3,"IE7sO6J-r1iEd-G6dmuFaN64Qnk9lqJFmsBpO1YACWs");//可结算提醒
  24 + put(4,"QtoMH65mEHuDYMAtNKLSrIxQKqNNdDLDl_dMOY1cHhw");//申请成功提醒
23 }}; 25 }};
24 26
25 public <T> void sendMessage(int uid,int type,T value) { 27 public <T> void sendMessage(int uid,int type,T value) {
@@ -36,4 +38,18 @@ public class SendMessageHelper { @@ -36,4 +38,18 @@ public class SendMessageHelper {
36 log.error("sendMessage error,e is {}.",e); 38 log.error("sendMessage error,e is {}.",e);
37 } 39 }
38 } 40 }
  41 + public void sendMessage(int uid, int type, int time, BigDecimal amount) {
  42 + log.info("sendMessage enter,uid is {},type is {},time is {},amount is {}.",uid,type,time,amount);
  43 + String key = keyMap.get(type);
  44 + if (key == null) {
  45 + log.info("sendMessage end,type error,uid is {},type is {},time is {},amount is {}.",uid,type,time,amount);
  46 + return;
  47 + }
  48 + try {
  49 +
  50 + System.out.println(key);
  51 + } catch (Exception e) {
  52 + log.error("sendMessage error,e is {}.",e);
  53 + }
  54 + }
39 } 55 }
@@ -639,6 +639,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -639,6 +639,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
639 int result = unionShareUserMapper.insertSelective(unionShareUser); 639 int result = unionShareUserMapper.insertSelective(unionShareUser);
640 if (result > 0) { 640 if (result > 0) {
641 logger.info("relateUnionType,begin to send message,uid is {},unionType is {}", uid,unionDepartmentUrl.getUnionType()); 641 logger.info("relateUnionType,begin to send message,uid is {},unionType is {}", uid,unionDepartmentUrl.getUnionType());
  642 + //
  643 + sendMessageHelper.sendMessage(uid,1,unionShareUser.getCreateTime(),null);
642 //发送联盟用户申请成功短信 644 //发送联盟用户申请成功短信
643 sendSmsService.smsSendByMobile(UNION_SHARE_USER_APPLY_PASS_SMS_CONTENT, Lists.newArrayList(mobile)); 645 sendSmsService.smsSendByMobile(UNION_SHARE_USER_APPLY_PASS_SMS_CONTENT, Lists.newArrayList(mobile));
644 } 646 }
@@ -1703,7 +1705,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -1703,7 +1705,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
1703 return; 1705 return;
1704 } 1706 }
1705 logger.info("sendUidAoumtMessage,startTime is {},endTime is {},uids is {}.",startTime,endTime,uids); 1707 logger.info("sendUidAoumtMessage,startTime is {},endTime is {},uids is {}.",startTime,endTime,uids);
1706 - uids.forEach(u->sendMessageHelper.sendMessage(u.getPromoteUid(),1,u)); 1708 + int now = DateUtil.getCurrentTimeSecond();
  1709 + uids.forEach(u->sendMessageHelper.sendMessage(u.getPromoteUid(),1,now,u.getAmount()));
1707 } 1710 }
1708 /** 1711 /**
1709 * 发送可结算佣金提醒 1712 * 发送可结算佣金提醒
@@ -1715,7 +1718,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -1715,7 +1718,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
1715 return; 1718 return;
1716 } 1719 }
1717 logger.info("sendUidSettlementMessage,startTime is {},endTime is {},uids is {}.",startTime,endTime,uids); 1720 logger.info("sendUidSettlementMessage,startTime is {},endTime is {},uids is {}.",startTime,endTime,uids);
1718 - uids.forEach(u->sendMessageHelper.sendMessage(u.getPromoteUid(),3,u)); 1721 + int now = DateUtil.getCurrentTimeSecond();
  1722 + uids.forEach(u->sendMessageHelper.sendMessage(u.getPromoteUid(),3,now,u.getAmount()));
1719 } 1723 }
1720 1724
1721 //查询已结束等待发放奖励的普通额外返活动 1725 //查询已结束等待发放奖励的普通额外返活动
@@ -2471,7 +2475,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -2471,7 +2475,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
2471 unionShareOrdersMapper.updateStatusByCode(bo.getSettlementCode(), ShareOrdersStatusEnum.SETTLE.getCode(), ShareOrdersStatusEnum.HAS_SETTLE.getCode(), updateReq.getUpdateTime()); 2475 unionShareOrdersMapper.updateStatusByCode(bo.getSettlementCode(), ShareOrdersStatusEnum.SETTLE.getCode(), ShareOrdersStatusEnum.HAS_SETTLE.getCode(), updateReq.getUpdateTime());
2472 2476
2473 //todo 发送打款公众号消息 2477 //todo 发送打款公众号消息
2474 - sendMessageHelper.sendMessage(bo.getPromoteUid(),2,bo); 2478 + sendMessageHelper.sendMessage(bo.getPromoteUid(),2,updateReq.getUpdateTime(),bo.getSettlementAmount());
2475 //清缓存 2479 //清缓存
2476 clearShareOrderRedis(unionShareSettlement.getPromoteUid()); 2480 clearShareOrderRedis(unionShareSettlement.getPromoteUid());
2477 } 2481 }
@@ -2687,7 +2691,10 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -2687,7 +2691,10 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
2687 logger.info("addMessage.req is {}",record); 2691 logger.info("addMessage.req is {}",record);
2688 record.setCreateTime(DateUtils.getCurrentTimeSecond()); 2692 record.setCreateTime(DateUtils.getCurrentTimeSecond());
2689 record.setUpdateTime(DateUtils.getCurrentTimeSecond()); 2693 record.setUpdateTime(DateUtils.getCurrentTimeSecond());
2690 - 2694 + //列表页有固定的分享id
  2695 + if (record.getType() == 3 && record.getSomeKey() == null) {
  2696 + record.setSomeKey(configReader.getInt(UNION_SHAREID, 0));
  2697 + }
2691 return unionShareMessageMapper.insert(record); 2698 return unionShareMessageMapper.insert(record);
2692 } 2699 }
2693 2700
@@ -2706,7 +2713,10 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -2706,7 +2713,10 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
2706 if(null == record || null == record.getId()) { 2713 if(null == record || null == record.getId()) {
2707 return 0; 2714 return 0;
2708 } 2715 }
2709 - 2716 + //列表页有固定的分享id
  2717 + if (record.getType() == 3 && record.getSomeKey() == null) {
  2718 + record.setSomeKey(configReader.getInt(UNION_SHAREID, 0));
  2719 + }
2710 record.setUpdateTime(DateUtils.getCurrentTimeSecond()); 2720 record.setUpdateTime(DateUtils.getCurrentTimeSecond());
2711 return unionShareMessageMapper.updateByPrimaryKeySelective(record); 2721 return unionShareMessageMapper.updateByPrimaryKeySelective(record);
2712 } 2722 }
@@ -131,10 +131,10 @@ @@ -131,10 +131,10 @@
131 </div> 131 </div>
132 <div class="row-input"> 132 <div class="row-input">
133 <div class="row-left"> 133 <div class="row-left">
134 - 标识 134 + 链接标识
135 </div> 135 </div>
136 <div class="row-right"> 136 <div class="row-right">
137 - <input id="someKey" name="someKey" class="easyui-textbox" style="width:180px"><font color="gray">选择商品详情页或者拼团商品详情页时需填skn</font> 137 + <input id="someKey" name="someKey" class="easyui-textbox" style="width:180px"><font color="gray">商品详情页、拼团商品详情页填skn,h5、咨询、拼团列表页填相应id</font>
138 </div> 138 </div>
139 </div> 139 </div>
140 <div class="row-input"> 140 <div class="row-input">
@@ -243,15 +243,31 @@ @@ -243,15 +243,31 @@
243 } 243 }
244 requestObj.type = type; 244 requestObj.type = type;
245 245
246 - if(type==1||type==6) {  
247 - var someKey = $("#someKey").val();  
248 - if (someKey == "") {  
249 - alert("此类型标识字段需填入skn"); 246 + var someKey = $("#someKey").val();
  247 + if(someKey == "") {
  248 + //消息类型:0-其他,1-商品详情页,2-h5,3-列表页,4-资讯,5-拼团列表,6-拼团商品详情页
  249 + if (type==1||type==6) {
  250 + alert("链接标识需填入skn");
  251 + $("#someKey").focus();
  252 + return;
  253 + }
  254 + if (type==2) {
  255 + alert("链接标识需填入h5的分享id");
  256 + $("#someKey").focus();
  257 + return;
  258 + }
  259 + if (type==4) {
  260 + alert("链接标识需填入资讯id");
  261 + $("#someKey").focus();
  262 + return;
  263 + }
  264 + if (type==5) {
  265 + alert("链接标识需填入拼团活动id");
250 $("#someKey").focus(); 266 $("#someKey").focus();
251 return; 267 return;
252 } 268 }
253 - requestObj.someKey = someKey;  
254 } 269 }
  270 + requestObj.someKey = someKey;
255 271
256 var priority = $("#priority").val(); 272 var priority = $("#priority").val();
257 if (priority == "") { 273 if (priority == "") {
@@ -144,10 +144,10 @@ function getQueryString(url,name) { @@ -144,10 +144,10 @@ function getQueryString(url,name) {
144 </div> 144 </div>
145 <div class="row-input"> 145 <div class="row-input">
146 <div class="row-left"> 146 <div class="row-left">
147 - 标识 147 + 链接标识
148 </div> 148 </div>
149 <div class="row-right"> 149 <div class="row-right">
150 - <input id="someKey" name="someKey" class="easyui-textbox" style="width:180px"><font color="gray">选择商品详情页或者拼团商品详情页时需填skn</font> 150 + <input id="someKey" name="someKey" class="easyui-textbox" style="width:180px"><font color="gray">商品详情页、拼团商品详情页填skn,h5、咨询、拼团列表页填相应id</font>
151 </div> 151 </div>
152 </div> 152 </div>
153 <div class="row-input"> 153 <div class="row-input">
@@ -284,15 +284,31 @@ function getQueryString(url,name) { @@ -284,15 +284,31 @@ function getQueryString(url,name) {
284 } 284 }
285 requestObj.type = type; 285 requestObj.type = type;
286 286
287 - if(type==1||type==6) {  
288 - var someKey = $("#someKey").val();  
289 - if (someKey == "") {  
290 - alert("此类型标识字段需填入skn"); 287 + var someKey = $("#someKey").val();
  288 + if(someKey == "") {
  289 + //消息类型:0-其他,1-商品详情页,2-h5,3-列表页,4-资讯,5-拼团列表,6-拼团商品详情页
  290 + if (type==1||type==6) {
  291 + alert("链接标识需填入skn");
  292 + $("#someKey").focus();
  293 + return;
  294 + }
  295 + if (type==2) {
  296 + alert("链接标识需填入h5的分享id");
  297 + $("#someKey").focus();
  298 + return;
  299 + }
  300 + if (type==4) {
  301 + alert("链接标识需填入资讯id");
  302 + $("#someKey").focus();
  303 + return;
  304 + }
  305 + if (type==5) {
  306 + alert("链接标识需填入拼团活动id");
291 $("#someKey").focus(); 307 $("#someKey").focus();
292 return; 308 return;
293 } 309 }
294 - requestObj.someKey = someKey;  
295 } 310 }
  311 + requestObj.someKey = someKey;
296 312
297 var priority = $("#priority").val(); 313 var priority = $("#priority").val();
298 if (priority == "") { 314 if (priority == "") {
@@ -103,7 +103,7 @@ @@ -103,7 +103,7 @@
103 align: "center", 103 align: "center",
104 formatter : function(value, rowData, rowIndex) { 104 formatter : function(value, rowData, rowIndex) {
105 var newData = JSON.stringify(rowData); 105 var newData = JSON.stringify(rowData);
106 - var imgstr="<a href='"+rowData.image+"'><img src='"+rowData.image+"' height='78px;' width='59px;' /></a>"; 106 + var imgstr="<a href='"+rowData.image+"'><img src='"+rowData.image+"' width='159px;' /></a>";
107 return imgstr; 107 return imgstr;
108 } 108 }
109 }, { 109 }, {
@@ -141,7 +141,7 @@ @@ -141,7 +141,7 @@
141 } 141 }
142 } 142 }
143 }, { 143 }, {
144 - title: "标识", 144 + title: "链接标识",
145 field: "someKey", 145 field: "someKey",
146 width: 80, 146 width: 80,
147 align: "center" 147 align: "center"