public int baseInsertMchNotify(String orderId, String mchId, String mchOrderNo, String orderType, String notifyUrl) { MchNotify mchNotify = new MchNotify(); mchNotify.setOrderId(orderId); mchNotify.setMchId(mchId); mchNotify.setMchOrderNo(mchOrderNo); mchNotify.setOrderType(orderType); mchNotify.setNotifyUrl(notifyUrl); return mchNotifyMapper.insertSelectiveOnDuplicateKeyUpdate(mchNotify); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode()); result = prime * result + ((getMchId() == null) ? 0 : getMchId().hashCode()); result = prime * result + ((getMchOrderNo() == null) ? 0 : getMchOrderNo().hashCode()); result = prime * result + ((getOrderType() == null) ? 0 : getOrderType().hashCode()); result = prime * result + ((getNotifyUrl() == null) ? 0 : getNotifyUrl().hashCode()); result = prime * result + ((getNotifyCount() == null) ? 0 : getNotifyCount().hashCode()); result = prime * result + ((getResult() == null) ? 0 : getResult().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getLastNotifyTime() == null) ? 0 : getLastNotifyTime().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); return result; } }
void setCriteria(MchNotifyExample.Criteria criteria, MchNotify mchNotify) { if(mchNotify != null) { if(StringUtils.isNotBlank(mchNotify.getMchId())) criteria.andMchIdEqualTo(mchNotify.getMchId()); if(StringUtils.isNotBlank(mchNotify.getOrderId())) criteria.andOrderIdEqualTo(mchNotify.getOrderId()); if(StringUtils.isNotBlank(mchNotify.getOrderType())) criteria.andOrderTypeEqualTo(mchNotify.getOrderType()); if(StringUtils.isNotBlank(mchNotify.getMchOrderNo())) criteria.andMchOrderNoEqualTo(mchNotify.getMchOrderNo()); if(mchNotify.getStatus() != null && mchNotify.getStatus() != -99) criteria.andStatusEqualTo(mchNotify.getStatus()); } }
@RequestMapping("/view.html") public String viewInput(String orderId, ModelMap model) { MchNotify item = null; if(StringUtils.isNotBlank(orderId)) { item = mchNotifyService.selectMchNotify(orderId); } if(item == null) { item = new MchNotify(); model.put("item", item); return "mch_notify/view"; } JSONObject object = (JSONObject) JSON.toJSON(item); if(item.getCreateTime() != null) object.put("createTime", DateUtil.date2Str(item.getCreateTime())); if(item.getUpdateTime() != null) object.put("updateTime", DateUtil.date2Str(item.getUpdateTime())); if(item.getLastNotifyTime() != null) object.put("lastNotifyTime", DateUtil.date2Str(item.getLastNotifyTime())); model.put("item", object); return "mch_notify/view"; }
public int baseUpdateMchNotifyFail(String orderId, String result, byte notifyCount) { MchNotify mchNotify = new MchNotify(); mchNotify.setStatus(PayConstant.MCH_NOTIFY_STATUS_FAIL); mchNotify.setResult(result); mchNotify.setNotifyCount(notifyCount); mchNotify.setLastNotifyTime(new Date()); MchNotifyExample example = new MchNotifyExample(); MchNotifyExample.Criteria criteria = example.createCriteria(); criteria.andOrderIdEqualTo(orderId); List values = new LinkedList<>(); values.add(PayConstant.MCH_NOTIFY_STATUS_NOTIFYING); values.add(PayConstant.MCH_NOTIFY_STATUS_FAIL); return mchNotifyMapper.updateByExampleSelective(mchNotify, example); }
@RequestMapping("/list") @ResponseBody public String list(@ModelAttribute MchNotify mchNotify, Integer pageIndex, Integer pageSize) { PageModel pageModel = new PageModel(); int count = mchNotifyService.count(mchNotify); if(count <= 0) return JSON.toJSONString(pageModel); List<MchNotify> mchNotifyList = mchNotifyService.getMchNotifyList((pageIndex-1)*pageSize, pageSize, mchNotify); if(!CollectionUtils.isEmpty(mchNotifyList)) { JSONArray array = new JSONArray(); for(MchNotify po : mchNotifyList) { JSONObject object = (JSONObject) JSONObject.toJSON(po); if(po.getCreateTime() != null) object.put("createTime", DateUtil.date2Str(po.getCreateTime())); if(po.getLastNotifyTime() != null) object.put("lastNotifyTime", DateUtil.date2Str(po.getLastNotifyTime())); array.add(object); } pageModel.setList(array); } pageModel.setCount(count); pageModel.setMsg("ok"); pageModel.setRel(true); return JSON.toJSONString(pageModel); }
public JSONObject createNotifyInfo(RefundOrder refundOrder, boolean isFirst) { String url = createNotifyUrl(refundOrder, "2"); if(isFirst) { int result = baseInsertMchNotify(refundOrder.getRefundOrderId(), refundOrder.getMchId(), refundOrder.getMchRefundNo(), PayConstant.MCH_NOTIFY_TYPE_REFUND, url); _log.info("增加商户通知记录,orderId={},result:{}", refundOrder.getRefundOrderId(), result); } int count = 0; if(!isFirst) { MchNotify mchNotify = baseSelectMchNotify(refundOrder.getRefundOrderId()); if(mchNotify != null) count = mchNotify.getNotifyCount(); } JSONObject object = new JSONObject(); object.put("method", "GET"); object.put("url", url); object.put("orderId", refundOrder.getRefundOrderId()); object.put("count", count); object.put("createTime", System.currentTimeMillis()); return object; }
public int baseUpdateMchNotifySuccess(String orderId, String result, byte notifyCount) { MchNotify mchNotify = new MchNotify(); mchNotify.setStatus(PayConstant.MCH_NOTIFY_STATUS_SUCCESS); mchNotify.setResult(result); mchNotify.setNotifyCount(notifyCount); mchNotify.setLastNotifyTime(new Date()); MchNotifyExample example = new MchNotifyExample(); MchNotifyExample.Criteria criteria = example.createCriteria(); criteria.andOrderIdEqualTo(orderId); List values = new LinkedList<>(); values.add(PayConstant.MCH_NOTIFY_STATUS_NOTIFYING); values.add(PayConstant.MCH_NOTIFY_STATUS_FAIL); criteria.andStatusIn(values); return mchNotifyMapper.updateByExampleSelective(mchNotify, example); }
public JSONObject createNotifyInfo(PayOrder payOrder, boolean isFirst) { String url = createNotifyUrl(payOrder, "2"); if(isFirst) { int result = baseInsertMchNotify(payOrder.getPayOrderId(), payOrder.getMchId(), payOrder.getMchOrderNo(), PayConstant.MCH_NOTIFY_TYPE_PAY, url); _log.info("增加商户通知记录,orderId={},result:{}", payOrder.getPayOrderId(), result); } int count = 0; if(!isFirst) { MchNotify mchNotify = baseSelectMchNotify(payOrder.getPayOrderId()); if(mchNotify != null) count = mchNotify.getNotifyCount(); } JSONObject object = new JSONObject(); object.put("method", "GET"); object.put("url", url); object.put("orderId", payOrder.getPayOrderId()); object.put("count", count); object.put("createTime", System.currentTimeMillis()); return object; }
@Override public boolean equals(Object that) { if (this == that) { return true; } if (that == null) { return false; } if (getClass() != that.getClass()) { return false; } MchNotify other = (MchNotify) that; return (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId())) && (this.getMchId() == null ? other.getMchId() == null : this.getMchId().equals(other.getMchId())) && (this.getMchOrderNo() == null ? other.getMchOrderNo() == null : this.getMchOrderNo().equals(other.getMchOrderNo())) && (this.getOrderType() == null ? other.getOrderType() == null : this.getOrderType().equals(other.getOrderType())) && (this.getNotifyUrl() == null ? other.getNotifyUrl() == null : this.getNotifyUrl().equals(other.getNotifyUrl())) && (this.getNotifyCount() == null ? other.getNotifyCount() == null : this.getNotifyCount().equals(other.getNotifyCount())) && (this.getResult() == null ? other.getResult() == null : this.getResult().equals(other.getResult())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getLastNotifyTime() == null ? other.getLastNotifyTime() == null : this.getLastNotifyTime().equals(other.getLastNotifyTime())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())); }
public JSONObject createNotifyInfo(TransOrder transOrder, boolean isFirst) { String url = createNotifyUrl(transOrder, "2"); if(isFirst) { int result = baseInsertMchNotify(transOrder.getTransOrderId(), transOrder.getMchId(), transOrder.getMchTransNo(), PayConstant.MCH_NOTIFY_TYPE_TRANS, url); _log.info("增加商户通知记录,orderId={},result:{}", transOrder.getTransOrderId(), result); } int count = 0; if(!isFirst) { MchNotify mchNotify = baseSelectMchNotify(transOrder.getTransOrderId()); if(mchNotify != null) count = mchNotify.getNotifyCount(); } JSONObject object = new JSONObject(); object.put("method", "GET"); object.put("url", url); object.put("orderId", transOrder.getTransOrderId()); object.put("count", count); object.put("createTime", System.currentTimeMillis()); return object; }