Commit bc1b47f1 by lihui.wang

add

parent a408e51a
...@@ -49,7 +49,6 @@ public class ApiController { ...@@ -49,7 +49,6 @@ public class ApiController {
baseParam.setDbPartition("1205"); baseParam.setDbPartition("1205");
baseParam.setLinkServer(""); baseParam.setLinkServer("");
payMessageService.pushMessage(baseParam); payMessageService.pushMessage(baseParam);
} }
} }
\ No newline at end of file
...@@ -15,4 +15,6 @@ public interface PayMessageDMMapper extends IBaseDao<PayMessageDM>{ ...@@ -15,4 +15,6 @@ public interface PayMessageDMMapper extends IBaseDao<PayMessageDM>{
int updateMessageTryTimes(@Param("trytimes") Integer trytimes,@Param("id") Long id); int updateMessageTryTimes(@Param("trytimes") Integer trytimes,@Param("id") Long id);
PayMessageDM selectById(@Param("id") Long id);
} }
\ No newline at end of file
...@@ -20,5 +20,5 @@ public interface IPayMessageRepository extends IBaseRepository{ ...@@ -20,5 +20,5 @@ public interface IPayMessageRepository extends IBaseRepository{
List<PayMessageDM> getPayMessages(Map<String, Object> paramsMap); List<PayMessageDM> getPayMessages(Map<String, Object> paramsMap);
int updateMessageStatus(Integer status,Long id); int updateMessageStatus(Integer status,Long id);
int updateMessageTryTimes(Integer trytimes,Long id); int updateMessageTryTimes(Integer trytimes,Long id);
PayMessageDM selectById(Integer id); PayMessageDM selectById(Long id);
} }
...@@ -52,9 +52,9 @@ public class PayMessageRepositoryImpl extends BaseRepositoryImpl implements IPay ...@@ -52,9 +52,9 @@ public class PayMessageRepositoryImpl extends BaseRepositoryImpl implements IPay
} }
@Override @Override
public PayMessageDM selectById(Integer id) { public PayMessageDM selectById(Long id) {
return this.getById(id); return payMessageMapper.selectById(id);
} }
} }
\ No newline at end of file
...@@ -22,5 +22,5 @@ public interface IPayMessageService { ...@@ -22,5 +22,5 @@ public interface IPayMessageService {
int updateMessageStatus(Integer status,Long id); int updateMessageStatus(Integer status,Long id);
List<PayMessageDM> getPayMessages(BaseParam baseParam); List<PayMessageDM> getPayMessages(BaseParam baseParam);
int updateMessageTryTimes(Integer trytimes,Long id); int updateMessageTryTimes(Integer trytimes,Long id);
PayMessageDM selectByPrimaryKey(Long id); PayMessageDM selectById(Long id);
} }
package com.freemud.pay.job.service; package com.freemud.pay.job.service;
import com.freemud.pay.job.dao.dbModel.PayPlatformAccountDM; import com.freemud.pay.job.dao.dbModel.PayPlatformAccountDM;
import com.freemud.pay.job.entity.PayMessage;
import java.util.List; import java.util.List;
...@@ -16,5 +17,5 @@ import java.util.List; ...@@ -16,5 +17,5 @@ import java.util.List;
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目 * 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/ */
public interface IPayPlatformAccountService { public interface IPayPlatformAccountService {
PayPlatformAccountDM getPayPlatformAccount(Integer partnerId); PayPlatformAccountDM getPayPlatformAccount(PayMessage payMessage,String platform);
} }
package com.freemud.pay.job.service.constants;
import org.springframework.stereotype.Component;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title:
* @Package com.freemud.pay
* @Description:
* @author: lihui.wang
* @date:
* @Copyright: 2017 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Component
public class PayPlatformAccountConstans {
public static final String PLATFORM_ALI_FWC = "ali.fwc";
public static final String PLATFORM_WECHAT_MEMBER= "wechat.member";
public static final String PLATFORM_ALIPASS_MEMBER = "alipass.member";
}
\ No newline at end of file
...@@ -55,7 +55,7 @@ public class PayMessageServiceImpl implements IPayMessageService { ...@@ -55,7 +55,7 @@ public class PayMessageServiceImpl implements IPayMessageService {
if (linkServer.isEmpty()){ if (linkServer.isEmpty()){
linkServer = ""; linkServer = "";
} }
else if (!linkServer.substring(linkServer.length()-1).equals(".")){ else if (!linkServer.endsWith(".")){
linkServer = linkServer + "."; linkServer = linkServer + ".";
} }
baseParam.setLinkServer(linkServer); baseParam.setLinkServer(linkServer);
...@@ -157,8 +157,8 @@ public class PayMessageServiceImpl implements IPayMessageService { ...@@ -157,8 +157,8 @@ public class PayMessageServiceImpl implements IPayMessageService {
} }
@Override @Override
public PayMessageDM selectByPrimaryKey(Long id) { public PayMessageDM selectById(Long id) {
return null; return iPayMessageRepository.selectById(id);
} }
......
package com.freemud.pay.job.service.impl; package com.freemud.pay.job.service.impl;
import com.freemud.pay.job.dao.dbModel.PayMessageDM;
import com.freemud.pay.job.dao.dbModel.PayPlatformAccountDM; import com.freemud.pay.job.dao.dbModel.PayPlatformAccountDM;
import com.freemud.pay.job.dao.repository.PayPlatformAccountRepository; import com.freemud.pay.job.dao.repository.PayPlatformAccountRepository;
import com.freemud.pay.job.dao.repository.impl.PayMessageRepositoryImpl; import com.freemud.pay.job.dao.repository.impl.PayMessageRepositoryImpl;
...@@ -7,6 +8,7 @@ import com.freemud.pay.job.entity.PayMessage; ...@@ -7,6 +8,7 @@ import com.freemud.pay.job.entity.PayMessage;
import com.freemud.pay.job.entity.dto.PayPlatformAcountKey; import com.freemud.pay.job.entity.dto.PayPlatformAcountKey;
import com.freemud.pay.job.service.IPayMessageService; import com.freemud.pay.job.service.IPayMessageService;
import com.freemud.pay.job.service.IPayPlatformAccountService; import com.freemud.pay.job.service.IPayPlatformAccountService;
import com.freemud.pay.job.service.constants.PayPlatformAccountConstans;
import com.freemud.pay.job.service.util.EncryptionHelper; import com.freemud.pay.job.service.util.EncryptionHelper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -42,29 +44,29 @@ public class PayPlatformAccountServiceImpl implements IPayPlatformAccountService ...@@ -42,29 +44,29 @@ public class PayPlatformAccountServiceImpl implements IPayPlatformAccountService
@Autowired @Autowired
IPayPlatformAccountService iPayPlatformAccountService; IPayPlatformAccountService iPayPlatformAccountService;
@Autowired
PayPlatformAcountKey payPlatformAcountKey;
@Autowired
PayMessage payMessage;
@Override @Override
public PayPlatformAccountDM getPayPlatformAccount(Integer partnerId) { public PayPlatformAccountDM getPayPlatformAccount(PayMessage payMessage,String platform) {
EncryptionHelper encryptionHelper = new EncryptionHelper(); EncryptionHelper encryptionHelper = new EncryptionHelper();
List<PayPlatformAccountDM> payPlatformAccountDMList = payPlatformAccountRepository.selectByPartnerId(partnerId); List<PayPlatformAccountDM> payPlatformAccountDMList = payPlatformAccountRepository.selectByPartnerId(payMessage.getPayMessage().getPartnerid());
payPlatformAcountKey.setPartnerId(iPayMessageService.selectByPrimaryKey(payMessage.getPayMessage().getId()).getPartnerid());
payPlatformAcountKey.setPlatform(iPayMessageService.selectByPrimaryKey(payMessage.getPayMessage().getId()).getPlatform());
payPlatformAcountKey.setStoreId(iPayMessageService.selectByPrimaryKey(payMessage.getPayMessage().getId()).getStore_id());
List<PayPlatformAccountDM> payPlatformAccountDMList1 = new ArrayList<>(); List<PayPlatformAccountDM> payPlatformAccountDMList1 = new ArrayList<>();
payPlatformAccountDMList.stream().forEach(p->{ payPlatformAccountDMList.stream().forEach(p->{
if(p.getEnable() == true && p.getPlatform().equalsIgnoreCase(payPlatformAcountKey.getPlatform()) ){ if(p.getEnable() == true && p.getPlatform().equalsIgnoreCase(platform) ){
if (p != null && p.getPassword() != null){ if (p != null){
payPlatformAccountDMList1.add(p); payPlatformAccountDMList1.add(p);
} }
} }
}); });
PayPlatformAccountDM payPlatformAccountDM = payPlatformAccountDMList1.get(0); if (payPlatformAccountDMList1.size() > 0){
payPlatformAccountDM.setPassword(encryptionHelper.Decode(payPlatformAccountDM.getPassword())); PayPlatformAccountDM payPlatformAccountDM = payPlatformAccountDMList1.get(0);
return payPlatformAccountDM; if(payPlatformAccountDM.getPassword()!=null) {
payPlatformAccountDM.setPassword(encryptionHelper.Decode(payPlatformAccountDM.getPassword()));
}
return payPlatformAccountDM;
}
return null;
} }
} }
\ No newline at end of file
...@@ -9,6 +9,7 @@ import com.freemud.pay.job.dao.dbModel.PayPlatformAccountDM; ...@@ -9,6 +9,7 @@ import com.freemud.pay.job.dao.dbModel.PayPlatformAccountDM;
import com.freemud.pay.job.entity.PayMessage; import com.freemud.pay.job.entity.PayMessage;
import com.freemud.pay.job.entity.dto.PayPlatformAcountKey; import com.freemud.pay.job.entity.dto.PayPlatformAcountKey;
import com.freemud.pay.job.service.*; import com.freemud.pay.job.service.*;
import com.freemud.pay.job.service.constants.PayPlatformAccountConstans;
import com.freemud.pay.job.service.processorfactory.IMessageProcessor; import com.freemud.pay.job.service.processorfactory.IMessageProcessor;
import com.freemud.pay.job.service.util.EncryptionHelper; import com.freemud.pay.job.service.util.EncryptionHelper;
import com.freemud.pay.job.service.util.InterrprentUtil; import com.freemud.pay.job.service.util.InterrprentUtil;
...@@ -77,7 +78,7 @@ public class AliFuWuChuangSingleMessageSender implements IMessageProcessor { ...@@ -77,7 +78,7 @@ public class AliFuWuChuangSingleMessageSender implements IMessageProcessor {
// } // }
// //
// }); // });
PayPlatformAccountDM payPlatformAccountDM = iPayPlatformAccountService.getPayPlatformAccount(payMessage.getPayMessage().getPartnerid()); PayPlatformAccountDM payPlatformAccountDM = iPayPlatformAccountService.getPayPlatformAccount(payMessage, PayPlatformAccountConstans.PLATFORM_ALI_FWC);
System.out.println(payPlatformAccountDM.getId()); System.out.println(payPlatformAccountDM.getId());
if (payPlatformAccountDM == null){ if (payPlatformAccountDM == null){
...@@ -117,6 +118,7 @@ public class AliFuWuChuangSingleMessageSender implements IMessageProcessor { ...@@ -117,6 +118,7 @@ public class AliFuWuChuangSingleMessageSender implements IMessageProcessor {
} }
}catch (Exception e){ }catch (Exception e){
e.printStackTrace();
logger.error("消息推送失败"); logger.error("消息推送失败");
return false; return false;
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<select id="getPayMessages" parameterType="Map" resultMap="BaseResultMap"> <select id="getPayMessages" parameterType="Map" resultMap="BaseResultMap">
<![CDATA[ <![CDATA[
SELECT TOP 10 SELECT TOP 100
a.[Id] , a.[Id] ,
a.[PartnerId] , a.[PartnerId] ,
a.[FMId] , a.[FMId] ,
...@@ -47,6 +47,13 @@ ...@@ -47,6 +47,13 @@
]]> ]]>
</select> </select>
<select id="selectById" parameterType="java.lang.Long" resultType="com.freemud.pay.job.dao.dbModel.PayMessageDM">
SELECT
<include refid="Base_Column_List" />
FROM [Freemud_ThirdParty].[dbo].[Pay_Message]
WHERE id=#{id}
</select>
<update id="updateMessageStatus"> <update id="updateMessageStatus">
update top(1) [Freemud_ThirdParty].[dbo].[Pay_Message] set Status=#{status} ,TryTimes=TryTimes+1 where id=#{id} update top(1) [Freemud_ThirdParty].[dbo].[Pay_Message] set Status=#{status} ,TryTimes=TryTimes+1 where id=#{id}
</update> </update>
......
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{
"TplMsgId":"#templateId#",
"OrderId":"#fmId#",
"OpenId":"#toUserId#",
keyword:"#createDate#,#storeName#,¥#actualPay#(总金额:¥#amount#),¥#discount#,#platfromTranNo#"
}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{
"TplMsgId":"#templateId#",
"OrderId":"#fmId#",
"OpenId":"#toUserId#",
keyword:"#createDate#,#storeName#,¥#actualPay#(总金额:¥#amount#),¥#discount#,#platfromTranNo#","id":"#id#",
"WXMsgActiveId":"#wxMsgActiveId#"
}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{
"TplMsgId":"#templateId#",
"OrderId":"#fmId#",
"OpenId":"#toUserId#",
keyword:"#createDate#,#storeName#,¥#actualPay#(总金额:¥#amount#),¥#discount#,#platfromTranNo#"
}
\ No newline at end of file
{
"TplMsgId":"#templateId#",
"OrderId":"#fmId#",
"OpenId":"#toUserId#",
keyword:"#createDate#,#storeName#,¥#actualPay#(总金额:¥#amount#),¥#discount#,#platfromTranNo#",
"WXMsgActiveId":"#wxMsgActiveId#"
}
\ No newline at end of file
{
"TplMsgId":"#templateId#",
"OrderId":"#fmId#",
"OpenId":"#toUserId#",
keyword:"#code#,#validFrom#~#validEnd#"
}
\ No newline at end of file
{
"TplMsgId":"#templateId#",
"OrderId":"#fmId#",
"OpenId":"#toUserId#",
keyword:"#createDate#,#storeName#,¥#actualPay#(总金额:¥#amount#),¥#discount#,#platfromTranNo#"
}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#"}
\ No newline at end of file
{
"TplMsgId":"#templateId#",
"OrderId":"#fmId#",
"OpenId":"#toUserId#",
keyword:"#createDate#,#storeName#,¥#actualPay#(总金额:¥#amount#),¥#discount#,#platfromTranNo#"
}
\ No newline at end of file
{"TplMsgId":"#templateId#", "OrderId":"#fmId#", "OpenId":"#toUserId#","keyword":"#code#,#validFrom#~#validEnd#","id":"#id#","WXMsgActiveId":"#wxMsgActiveId#"}
\ No newline at end of file
{"toUserId":"#toUserId#","template":{"templateId":"e50b9b8c863640debc08f8eca19f69c6","context":{"HeadColor":"#FAC100","url":"http://mcd.fwc.freemud.cn/survey/survey.html?outtradeNo=#fmId#","actionName":"立即查看","title":"立即反馈用餐体验,赢取专属优惠券","first":"目前仅适用于反馈天津,杭州,青岛和四川麦当劳餐厅","ImageUrl":"http://68fj829u.fwc.freemud.cn/suvery/banner.jpg"}}}
\ No newline at end of file
{"toUserId":"#toUserId#","template":{"templateId":"f884cd4b68744e5489d244faf6e88ee8","context":{"HeadColor":"#FAC100","url":"http://mcd.fwc.freemud.cn/survey/survey.html?outtradeNo=#fmId#","actionName":"立即查看","title":"立即反馈用餐体验,赢取专属优惠券","first":"目前仅适用于反馈天津及杭州市内所有麦当劳餐厅","imageUrl":"http://68fj829u.fwc.freemud.cn/suvery/banner.jpg"}}}
\ No newline at end of file
{
"aliOpenId":"#alipayOpenId#",
"appId":"T007",
"operatorId":"1",
"partnerId":"a8bee0dd-09d1-4fa9-a9eb-80cb36d3d611",
"reqType":1008,
"stationId":"#stationId#",
"storeId":"0000",
"t":"#timestamp#",
"thirdPayTransId":"#platfromTranNo#",
"weixinOpenId":"#wechatOpenId#"
}
{"aliOpenId":"#alipayOpenId#","appId":"T007","operatorId":"1","partnerId":"a8bee0dd-09d1-4fa9-a9eb-80cb36d3d611","reqType":1008,"stationId":"#stationId#", "storeId":"#storeId#","t":"#timestamp#", "thirdPayTransId":"#platfromTranNo#"}
\ No newline at end of file
{"appId":"T007","operatorId":"1","partnerId":"a8bee0dd-09d1-4fa9-a9eb-80cb36d3d611","reqType":1008,"stationId":"#stationId#","storeId":"#storeId#","t":"#timestamp#","thirdPayTransId":"#platfromTranNo#","weixinOpenId":"#wechatOpenId#"}
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