Search in sources :

Example 1 with RedpackLog

use of com.ikoori.vip.common.persistence.model.RedpackLog in project vip by guangdada.

the class RedpackLogController method redpackLogUpdate.

/**
 * 跳转到修改红包记录
 */
@RequestMapping("/redpackLog_update/{redpackLogId}")
@Permission
public String redpackLogUpdate(@PathVariable Long redpackLogId, Model model) {
    RedpackLog redpackLog = redpackLogService.selectById(redpackLogId);
    model.addAttribute(redpackLog);
    return PREFIX + "redpackLog_edit.html";
}
Also used : RedpackLog(com.ikoori.vip.common.persistence.model.RedpackLog) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with RedpackLog

use of com.ikoori.vip.common.persistence.model.RedpackLog in project vip by guangdada.

the class RedpackLogServiceImpl method saveRedPackLog.

@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void saveRedPackLog(int amount, String unionid, String openid, String ip, Long merchantId, Long redpackId, String actName, String remark, String wishing) {
    log.info("进入saveRedPackLog>>amount = " + amount);
    log.info("进入saveRedPackLog>>unionid = " + unionid);
    log.info("进入saveRedPackLog>>openid = " + openid);
    log.info("进入saveRedPackLog>>ip = " + ip);
    log.info("进入saveRedPackLog>>merchantId = " + merchantId);
    log.info("进入saveRedPackLog>>redpackId = " + redpackId);
    log.info("进入saveRedPackLog>>actName = " + actName);
    log.info("进入saveRedPackLog>>remark = " + remark);
    log.info("进入saveRedPackLog>>wishing = " + wishing);
    log.info("进入saveRedPackLog>>certPath = " + gunsProperties.getCertPath());
    if (!gunsProperties.getRedpackFlag()) {
        log.info("发送红包开关没有打开");
        return;
    }
    String billno = "kryhb" + new SimpleDateFormat("yyyyMMddHHmmssSSSS").format(new Date());
    RedPackResData rprd = RedPackUtil.redPackSend(amount, actName, remark, wishing, openid, billno, gunsProperties.getCertPath());
    // 通信成功则记录发送日志
    if (rprd != null && "SUCCESS".equals(rprd.getReturn_code())) {
        RedpackLog log = new RedpackLog();
        log.setBillno(billno);
        log.setIp(ip);
        log.setRedpackId(redpackId);
        log.setMerchantId(merchantId);
        log.setUnionid(unionid);
        log.setReason(rprd.getErr_code_des());
        log.setSendAmount(amount);
        if ("SUCCESS".equals(rprd.getErr_code())) {
            log.setSendStatus(RedPackSendStatus.SENDING.getCode());
        } else {
            log.setSendStatus(RedPackSendStatus.FAILED.getCode());
        }
        redpackLogMapper.insert(log);
        // 修改发放信息
        redpackDao.updateSendInfo(amount, redpackId);
    }
}
Also used : RedpackLog(com.ikoori.vip.common.persistence.model.RedpackLog) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) RedPackResData(com.coolfish.weixin.redpack.protocol.RedPackResData) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with RedpackLog

use of com.ikoori.vip.common.persistence.model.RedpackLog in project vip by guangdada.

the class RedpackQueryJob method scheduler.

// 每小时执行一次
@Scheduled(cron = "0 0 0/1 * * ?")
public void scheduler() {
    log.info(">>>>>>>>>>>>> 同步红包数据开始 ... " + DateUtil.getDayTime());
    List<RedpackLog> rs = redpackService.selectBySendStatus(RedPackSendStatus.SENDING.getCode());
    if (CollectionUtils.isNotEmpty(rs)) {
        for (RedpackLog redpackLog : rs) {
            try {
                redpackService.updateRedPackLog(redpackLog);
            } catch (Exception e) {
                log.error("同步红包数据异常:", e);
            }
        }
    }
    log.info(">>>>>>>>>>>>> 同步红包数据结束... " + DateUtil.getDayTime());
}
Also used : RedpackLog(com.ikoori.vip.common.persistence.model.RedpackLog) Scheduled(org.springframework.scheduling.annotation.Scheduled)

Aggregations

RedpackLog (com.ikoori.vip.common.persistence.model.RedpackLog)3 RedPackResData (com.coolfish.weixin.redpack.protocol.RedPackResData)1 Permission (com.ikoori.vip.common.annotion.Permission)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Scheduled (org.springframework.scheduling.annotation.Scheduled)1 Transactional (org.springframework.transaction.annotation.Transactional)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1