补发红包

master
james.zhao 6 years ago
parent 47ddb3e3d9
commit b23ad3d782

@ -12,4 +12,6 @@ public interface CustomerRewardLogService {
void saveReward(int type2,int type3,String type1,String date);
void checkRedpacksStatus(String rewardId);
void reSendRedPacks();
}

@ -206,6 +206,26 @@ public class CustomerRewardLogServiceImpl implements CustomerRewardLogService {
}
}
@Override
public void reSendRedPacks() {
List<JSONObject> redpacks = cusRewardLogsMapper.resendRewards();
for(JSONObject pack:redpacks){
String sendName = "RoyalPay";
String actName = cusRewardConfigMapper.getValue("act_name").getString("value");
String wishing = cusRewardConfigMapper.getValue("wishing").getString("value");
String notifyUrl = PlatformEnvironment.getEnv().concatUrl("/act/new_year/redpacks/"+pack.getString("reward_id"));
MpWechatApi redpackApi = mpWechatApiProvider.getApi("redpack");
WechatRedpack wechatRedpack = new WechatRedpack();
wechatRedpack.setSendName(sendName).setOpenId(pack.getString("openid")).setActName(actName)
.setRemark(actName).setAmount(pack.getBigDecimal("amount")).setWishing(wishing).setNotifyUrl(notifyUrl);
JSONObject res = redpackApi.sendRedpack(wechatRedpack);
logger.info("2019新年活动获取的红包信息==>"+res.toJSONString());
pack.put("status",0);
pack.put("send_listid",res.getString("redpack_id"));
cusRewardLogsMapper.update(pack);
}
}
private JSONObject getRandomReward(String openid){
JSONObject reward = cusRewardCouponMapper.randomType();

@ -74,4 +74,9 @@ public class NewYearRedPacketController {
// mpWechatApi(request.getRequestURI(), sign, timestamp);
// redpackSupport.checkRedpack(rewardId);
}
@RequestMapping(value = "/resendRedpacks", method = RequestMethod.GET)
public void updateRedpackStatus(){
customerRewardLogService.reSendRedPacks();
}
}

@ -33,4 +33,7 @@ public interface CusRewardLogsMapper {
@Select("SELECT * FROM cus_reward_log WHERE type=1 AND (`status`=0 OR `status`=1) AND openid IS NOT NULL ORDER BY send_time ASC")
List<JSONObject> listUnconfirmRewards();
@Select("select * from cus_reward_log where openid is not null and type=1 and send_listid is null")
List<JSONObject> resendRewards();
}

Loading…
Cancel
Save