|
@@ -1,18 +1,13 @@
|
|
package com.kmall.schedule.service;
|
|
package com.kmall.schedule.service;
|
|
|
|
|
|
-import com.kmall.common.utils.Constant;
|
|
|
|
-import com.kmall.common.utils.wechat.ReaderXmlForDOM4J;
|
|
|
|
-import com.kmall.common.utils.wechat.WechatRefundApiResult;
|
|
|
|
-import com.kmall.common.utils.wechat.WechatRefundQueryResult;
|
|
|
|
-import com.kmall.common.utils.wechat.WechatUtil;
|
|
|
|
|
|
+import com.kmall.common.utils.*;
|
|
|
|
+import com.kmall.common.utils.wechat.*;
|
|
|
|
+import com.kmall.schedule.dao.OrderWXPayRecordMapper;
|
|
import com.kmall.schedule.dao.QzGroupMapper;
|
|
import com.kmall.schedule.dao.QzGroupMapper;
|
|
import com.kmall.schedule.dao.QzOrderMapper;
|
|
import com.kmall.schedule.dao.QzOrderMapper;
|
|
import com.kmall.common.dao.TemplateConfDao;
|
|
import com.kmall.common.dao.TemplateConfDao;
|
|
import com.kmall.common.entity.TemplateConfVo;
|
|
import com.kmall.common.entity.TemplateConfVo;
|
|
import com.kmall.schedule.quartz.OrderTask;
|
|
import com.kmall.schedule.quartz.OrderTask;
|
|
-import com.kmall.common.utils.DateUtils;
|
|
|
|
-import com.kmall.common.utils.MapUtils;
|
|
|
|
-import com.kmall.common.utils.StringUtils;
|
|
|
|
import com.kmall.common.utils.wxtemplate.TemplateData;
|
|
import com.kmall.common.utils.wxtemplate.TemplateData;
|
|
import com.kmall.common.utils.wxtemplate.WxTemplate;
|
|
import com.kmall.common.utils.wxtemplate.WxTemplate;
|
|
import com.kmall.common.utils.wxtemplate.WxTemplateUtil;
|
|
import com.kmall.common.utils.wxtemplate.WxTemplateUtil;
|
|
@@ -29,6 +24,7 @@ import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 微信提醒任务
|
|
* 微信提醒任务
|
|
|
|
+ *
|
|
* @author zhouzhengde(CN)
|
|
* @author zhouzhengde(CN)
|
|
* @date 2017/12/4.
|
|
* @date 2017/12/4.
|
|
*/
|
|
*/
|
|
@@ -41,6 +37,8 @@ public class QzOrderService {
|
|
private QzGroupMapper qzGroupMapper;
|
|
private QzGroupMapper qzGroupMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private QzOrderMapper qzOrderMapper;
|
|
private QzOrderMapper qzOrderMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private OrderWXPayRecordMapper orderWXPayRecordMapper;
|
|
|
|
|
|
/**
|
|
/**
|
|
* todo 一期暂时不实现团购
|
|
* todo 一期暂时不实现团购
|
|
@@ -49,7 +47,8 @@ public class QzOrderService {
|
|
@Transactional
|
|
@Transactional
|
|
public void groupProgressRemind() {
|
|
public void groupProgressRemind() {
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>groupProgressRemind is start ");
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>groupProgressRemind is start ");
|
|
- TemplateConfVo templateConfVo = templateConfDao.queryByTypeId(4); // 模板类型 1订单付款成功 2团购成功 3拼团失败通知 4拼团进度 5 6 7订单配送 8订单评价提醒
|
|
|
|
|
|
+ TemplateConfVo templateConfVo =
|
|
|
|
+ templateConfDao.queryByTypeId(4); // 模板类型 1订单付款成功 2团购成功 3拼团失败通知 4拼团进度 5 6 7订单配送 8订单评价提醒
|
|
if (null == templateConfVo) {
|
|
if (null == templateConfVo) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -71,7 +70,7 @@ public class QzOrderService {
|
|
}
|
|
}
|
|
WxTemplate tem = new WxTemplate();
|
|
WxTemplate tem = new WxTemplate();
|
|
tem.setTemplate_id(templateConfVo.getTemplateId());
|
|
tem.setTemplate_id(templateConfVo.getTemplateId());
|
|
-// tem.setTopcolor("#00DD00");
|
|
|
|
|
|
+ // tem.setTopcolor("#00DD00");
|
|
tem.setTouser(open_id);
|
|
tem.setTouser(open_id);
|
|
tem.setPage("/pages/groupDetail/groupDetail?id=" + group_id);
|
|
tem.setPage("/pages/groupDetail/groupDetail?id=" + group_id);
|
|
tem.setForm_id(form_id);
|
|
tem.setForm_id(form_id);
|
|
@@ -87,7 +86,9 @@ public class QzOrderService {
|
|
long second = (time - hour * 3600 - minite * 60);
|
|
long second = (time - hour * 3600 - minite * 60);
|
|
String body = hour + "时" + minite + "分" + second + "秒";
|
|
String body = hour + "时" + minite + "分" + second + "秒";
|
|
paras.add(new TemplateData("keyword3", body, "#000000"));
|
|
paras.add(new TemplateData("keyword3", body, "#000000"));
|
|
- paras.add(new TemplateData("keyword4", retail_min_price.setScale(2, BigDecimal.ROUND_HALF_DOWN).toString() + "元", "#000000"));
|
|
|
|
|
|
+ paras.add(new TemplateData("keyword4",
|
|
|
|
+ retail_min_price.setScale(2, BigDecimal.ROUND_HALF_DOWN).toString() + "元",
|
|
|
|
+ "#000000"));
|
|
paras.add(new TemplateData("keyword5", templateConfVo.getDesc(), "#000000"));
|
|
paras.add(new TemplateData("keyword5", templateConfVo.getDesc(), "#000000"));
|
|
tem.setData(paras);
|
|
tem.setData(paras);
|
|
WxTemplateUtil.sendMessage(tem);
|
|
WxTemplateUtil.sendMessage(tem);
|
|
@@ -103,7 +104,8 @@ public class QzOrderService {
|
|
@Transactional
|
|
@Transactional
|
|
public void pastGroupRemind() {
|
|
public void pastGroupRemind() {
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>pastGroupRemind is start ");
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>pastGroupRemind is start ");
|
|
- TemplateConfVo templateConfVo = templateConfDao.queryByTypeId(3); // 模板类型 1订单付款成功 2团购成功 3拼团失败通知 4拼团进度 5 6 7订单配送 8订单评价提醒
|
|
|
|
|
|
+ TemplateConfVo templateConfVo =
|
|
|
|
+ templateConfDao.queryByTypeId(3); // 模板类型 1订单付款成功 2团购成功 3拼团失败通知 4拼团进度 5 6 7订单配送 8订单评价提醒
|
|
if (null == templateConfVo) {
|
|
if (null == templateConfVo) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -124,7 +126,7 @@ public class QzOrderService {
|
|
}
|
|
}
|
|
WxTemplate tem = new WxTemplate();
|
|
WxTemplate tem = new WxTemplate();
|
|
tem.setTemplate_id(templateConfVo.getTemplateId());
|
|
tem.setTemplate_id(templateConfVo.getTemplateId());
|
|
-// tem.setTopcolor("#00DD00");
|
|
|
|
|
|
+ // tem.setTopcolor("#00DD00");
|
|
tem.setTouser(open_id);
|
|
tem.setTouser(open_id);
|
|
tem.setPage("/pages/groupDetail/groupDetail?id=" + group_id);
|
|
tem.setPage("/pages/groupDetail/groupDetail?id=" + group_id);
|
|
tem.setForm_id(form_id);
|
|
tem.setForm_id(form_id);
|
|
@@ -151,7 +153,8 @@ public class QzOrderService {
|
|
@Transactional
|
|
@Transactional
|
|
public void orderUnEvaluateRemind() {
|
|
public void orderUnEvaluateRemind() {
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>orderUnEvaluateRemind is start ");
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>orderUnEvaluateRemind is start ");
|
|
- TemplateConfVo templateConfVo = templateConfDao.queryByTypeId(8); // 模板类型 1订单付款成功 2团购成功 3拼团失败通知 4拼团进度 5 6 7订单配送 8订单评价提醒
|
|
|
|
|
|
+ TemplateConfVo templateConfVo =
|
|
|
|
+ templateConfDao.queryByTypeId(8); // 模板类型 1订单付款成功 2团购成功 3拼团失败通知 4拼团进度 5 6 7订单配送 8订单评价提醒
|
|
if (null == templateConfVo) {
|
|
if (null == templateConfVo) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -169,7 +172,7 @@ public class QzOrderService {
|
|
}
|
|
}
|
|
WxTemplate tem = new WxTemplate();
|
|
WxTemplate tem = new WxTemplate();
|
|
tem.setTemplate_id(templateConfVo.getTemplateId());
|
|
tem.setTemplate_id(templateConfVo.getTemplateId());
|
|
-// tem.setTopcolor("#00DD00");
|
|
|
|
|
|
+ // tem.setTopcolor("#00DD00");
|
|
tem.setTouser(open_id);
|
|
tem.setTouser(open_id);
|
|
tem.setPage("/pages/ucenter/orderDetail/orderDetail?id=" + id);
|
|
tem.setPage("/pages/ucenter/orderDetail/orderDetail?id=" + id);
|
|
tem.setForm_id(form_id);
|
|
tem.setForm_id(form_id);
|
|
@@ -224,11 +227,12 @@ public class QzOrderService {
|
|
String order_id = MapUtils.getString("order_id", map);
|
|
String order_id = MapUtils.getString("order_id", map);
|
|
WechatRefundQueryResult result = WechatUtil.wxRefundquery(out_trade_no);
|
|
WechatRefundQueryResult result = WechatUtil.wxRefundquery(out_trade_no);
|
|
if (result.getReturn_code().equalsIgnoreCase("SUCCESS")) {
|
|
if (result.getReturn_code().equalsIgnoreCase("SUCCESS")) {
|
|
- if(result.getResult_code().equalsIgnoreCase("SUCCESS")) {
|
|
|
|
|
|
+ if (result.getResult_code().equalsIgnoreCase("SUCCESS")) {
|
|
Map refundRaram = new HashMap();
|
|
Map refundRaram = new HashMap();
|
|
int msgCount = Integer.parseInt(result.getRefund_count());
|
|
int msgCount = Integer.parseInt(result.getRefund_count());
|
|
for (int i = 0; i < msgCount; i++) {
|
|
for (int i = 0; i < msgCount; i++) {
|
|
- WechatRefundQueryResult querySuccessResponseDto = ReaderXmlForDOM4J.parse(result.getXmlStr(), i);
|
|
|
|
|
|
+ WechatRefundQueryResult querySuccessResponseDto =
|
|
|
|
+ ReaderXmlForDOM4J.parse(result.getXmlStr(), i);
|
|
if (result.getReturn_code().equalsIgnoreCase("SUCCESS")) {
|
|
if (result.getReturn_code().equalsIgnoreCase("SUCCESS")) {
|
|
if (result.getResult_code().equalsIgnoreCase("SUCCESS")) {
|
|
if (result.getResult_code().equalsIgnoreCase("SUCCESS")) {
|
|
result.setRefund_success_time(querySuccessResponseDto.getRefund_success_time());
|
|
result.setRefund_success_time(querySuccessResponseDto.getRefund_success_time());
|
|
@@ -244,7 +248,9 @@ public class QzOrderService {
|
|
refundRaram.put("refundTime", successTime);
|
|
refundRaram.put("refundTime", successTime);
|
|
refundRaram.put("outRefundNo", result.getOut_refund_no());
|
|
refundRaram.put("outRefundNo", result.getOut_refund_no());
|
|
refundRaram.put("refundId", result.getRefund_id());
|
|
refundRaram.put("refundId", result.getRefund_id());
|
|
- refundRaram.put("refundMoney", BigDecimal.valueOf(Long.valueOf(result.getRefund_fee())).divide(Constant.ONE_HUNDRED));
|
|
|
|
|
|
+ refundRaram.put("refundMoney",
|
|
|
|
+ BigDecimal.valueOf(Long.valueOf(result.getRefund_fee()))
|
|
|
|
+ .divide(Constant.ONE_HUNDRED));
|
|
if (result.getRefund_status().equalsIgnoreCase("SUCCESS")) {
|
|
if (result.getRefund_status().equalsIgnoreCase("SUCCESS")) {
|
|
refundRaram.put("refundStatus", 2);
|
|
refundRaram.put("refundStatus", 2);
|
|
refundRaram.put("wechat_refund_status_des", "退款成功");
|
|
refundRaram.put("wechat_refund_status_des", "退款成功");
|
|
@@ -271,14 +277,15 @@ public class QzOrderService {
|
|
orderRaram.put("orderId", order_id);
|
|
orderRaram.put("orderId", order_id);
|
|
orderRaram.put("payTransactionId", result.getTransaction_id());
|
|
orderRaram.put("payTransactionId", result.getTransaction_id());
|
|
qzOrderMapper.updateOrderInfo(orderRaram);
|
|
qzOrderMapper.updateOrderInfo(orderRaram);
|
|
- }else{
|
|
|
|
- logger.info(">>>>>>>>>>>>>>>>>>>>refundUpdate 微信退款查询接口返回失败信息:code 【"+result.getErr_code()+"】,des【"+result.getErr_code_des()+"】");
|
|
|
|
|
|
+ } else {
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>refundUpdate 微信退款查询接口返回失败信息:code 【" + result.getErr_code() +
|
|
|
|
+ "】,des【" + result.getErr_code_des() + "】");
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
- logger.info(">>>>>>>>>>>>>>>>>>>>refundUpdate 微信退款查询接口调用失败: "+result.getReturn_msg());
|
|
|
|
|
|
+ } else {
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>refundUpdate 微信退款查询接口调用失败: " + result.getReturn_msg());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>refundUpdate 未查到退款数据 ");
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>refundUpdate 未查到退款数据 ");
|
|
}
|
|
}
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>refundUpdate is end ");
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>refundUpdate is end ");
|
|
@@ -307,8 +314,10 @@ public class QzOrderService {
|
|
Date nowDate = new Date();
|
|
Date nowDate = new Date();
|
|
WechatRefundApiResult result = WechatUtil.wxOrderQuery(out_trade_no);
|
|
WechatRefundApiResult result = WechatUtil.wxOrderQuery(out_trade_no);
|
|
if (result.getReturn_code().equalsIgnoreCase("SUCCESS")) {
|
|
if (result.getReturn_code().equalsIgnoreCase("SUCCESS")) {
|
|
- if(result.getResult_code().equalsIgnoreCase("SUCCESS") && result.getTrade_state().equalsIgnoreCase("SUCCESS")) {
|
|
|
|
- Date successTime = DateUtils.convertStringToDate(result.getTime_end(),DateUtils.DATE_TIME_PATTERN_YYYY_MM_DD_HH_MM_SS);
|
|
|
|
|
|
+ if (result.getResult_code().equalsIgnoreCase("SUCCESS") &&
|
|
|
|
+ result.getTrade_state().equalsIgnoreCase("SUCCESS")) {
|
|
|
|
+ Date successTime = DateUtils.convertStringToDate(result.getTime_end(),
|
|
|
|
+ DateUtils.DATE_TIME_PATTERN_YYYY_MM_DD_HH_MM_SS);
|
|
|
|
|
|
Map orderRaram = new HashMap();
|
|
Map orderRaram = new HashMap();
|
|
orderRaram.put("payStatus", 2);//已支付
|
|
orderRaram.put("payStatus", 2);//已支付
|
|
@@ -317,35 +326,140 @@ public class QzOrderService {
|
|
orderRaram.put("payTime", successTime);
|
|
orderRaram.put("payTime", successTime);
|
|
orderRaram.put("orderId", orderId);
|
|
orderRaram.put("orderId", orderId);
|
|
qzOrderMapper.updateOrderInfo(orderRaram);
|
|
qzOrderMapper.updateOrderInfo(orderRaram);
|
|
- }else if(result.getResult_code().equalsIgnoreCase("SUCCESS")
|
|
|
|
- && result.getTrade_state().equalsIgnoreCase("NOTPAY")) {//订单未支付
|
|
|
|
|
|
+ } else if (result.getResult_code().equalsIgnoreCase("SUCCESS") &&
|
|
|
|
+ result.getTrade_state().equalsIgnoreCase("NOTPAY")) {//订单未支付
|
|
Map orderRaram = new HashMap();
|
|
Map orderRaram = new HashMap();
|
|
- if(getDateBetween(addTime,nowDate) >= 15){//订单下单时间超过15分钟直接取消订单
|
|
|
|
|
|
+ if (getDateBetween(addTime, nowDate) >= 15) {//订单下单时间超过15分钟直接取消订单
|
|
orderRaram.put("payStatus", 0);//支付状态未支付
|
|
orderRaram.put("payStatus", 0);//支付状态未支付
|
|
orderRaram.put("orderStatus", 101);//订单状态已取消
|
|
orderRaram.put("orderStatus", 101);//订单状态已取消
|
|
Map param = new HashMap();
|
|
Map param = new HashMap();
|
|
param.put("id", storeRelaId);
|
|
param.put("id", storeRelaId);
|
|
param.put("stock_num", stock_num + number);
|
|
param.put("stock_num", stock_num + number);
|
|
qzOrderMapper.updateStockNum(param);
|
|
qzOrderMapper.updateStockNum(param);
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
orderRaram.put("payStatus", 0);//支付状态未支付
|
|
orderRaram.put("payStatus", 0);//支付状态未支付
|
|
orderRaram.put("orderStatus", 0);//订单状态未支付
|
|
orderRaram.put("orderStatus", 0);//订单状态未支付
|
|
}
|
|
}
|
|
orderRaram.put("orderId", orderId);
|
|
orderRaram.put("orderId", orderId);
|
|
qzOrderMapper.updateOrderInfo(orderRaram);
|
|
qzOrderMapper.updateOrderInfo(orderRaram);
|
|
- }else{
|
|
|
|
- logger.info(">>>>>>>>>>>>>>>>>>>>orderQueryUpdate 微信查询接口返回失败信息:code 【"+result.getErr_code()+"】,des【"+result.getErr_code_des()+"】");
|
|
|
|
|
|
+ } else {
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>orderQueryUpdate 微信查询接口返回失败信息:code 【" + result.getErr_code() +
|
|
|
|
+ "】,des【" + result.getErr_code_des() + "】");
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
- logger.info(">>>>>>>>>>>>>>>>>>>>orderQueryUpdate 微信查询接口调用失败: "+result.getReturn_msg());
|
|
|
|
|
|
+ } else {
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>orderQueryUpdate 微信查询接口调用失败: " + result.getReturn_msg());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>orderQueryUpdate 未查到订单数据 ");
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>orderQueryUpdate 未查到订单数据 ");
|
|
}
|
|
}
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>orderQueryUpdate is end ");
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>orderQueryUpdate is end ");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询付款码支付记录的支付状态
|
|
|
|
+ */
|
|
|
|
+ @Transactional
|
|
|
|
+ public void orderMicropayQueryUpdate() {
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>查询付款码支付记录的支付状态开始<<<<<<<<<<<<<<<<<<<<<<<");
|
|
|
|
+ // 获取交易状态是未支付,支付中和支付失败3种状态的付款码支付记录
|
|
|
|
+ List<String> tradeStates = new ArrayList<>();
|
|
|
|
+ tradeStates.add(WechatUtil.WXTradeState.NOTPAY.getCode());
|
|
|
|
+ tradeStates.add(WechatUtil.WXTradeState.USERPAYING.getCode());
|
|
|
|
+ tradeStates.add(WechatUtil.WXTradeState.PAYERROR.getCode());
|
|
|
|
+ List<Map> records = orderWXPayRecordMapper.queryRecordList(tradeStates);
|
|
|
|
+ if (null != records && records.size() > 0) {
|
|
|
|
+ for (Map map : records) {
|
|
|
|
+ String out_trade_no_wx = MapUtils.getString("out_trade_no_wx", map);
|
|
|
|
+ String out_trade_no = MapUtils.getString("out_trade_no", map);
|
|
|
|
+ Integer id = MapUtils.getInteger("id", map);
|
|
|
|
+
|
|
|
|
+ WechatRefundApiResult result = WechatUtil.wxOrderQuery(out_trade_no_wx);
|
|
|
|
+ if ("SUCCESS".equals(result.getReturn_code()) && "SUCCESS".equals(result.getResult_code())) {
|
|
|
|
+ Map recordRaram = new HashMap();
|
|
|
|
+ recordRaram.put("id", id);
|
|
|
|
+ recordRaram.put("trade_state", result.getTrade_state());
|
|
|
|
+ //查询到支付成功
|
|
|
|
+ if (WechatUtil.WXTradeState.SUCCESS.getCode().equals(result.getTrade_state())) {
|
|
|
|
+ recordRaram.put("result_code", result.getTrade_state());
|
|
|
|
+ recordRaram.put("err_code", "");
|
|
|
|
+ recordRaram.put("err_code_des", "");
|
|
|
|
+ recordRaram.put("openid", result.getOpenid());
|
|
|
|
+ recordRaram.put("is_subscribe", result.getIs_subscribe());
|
|
|
|
+ recordRaram.put("trade_type", result.getTrade_type());
|
|
|
|
+ recordRaram.put("fee_type", result.getFee_type());
|
|
|
|
+ recordRaram.put("total_fee", result.getTotal_fee());
|
|
|
|
+ recordRaram.put("transaction_id", result.getTransaction_id());
|
|
|
|
+ recordRaram.put("attach", result.getAttach());
|
|
|
|
+ recordRaram.put("time_end", result.getTime_end());
|
|
|
|
+
|
|
|
|
+ //修改订单状态
|
|
|
|
+ Map order = qzOrderMapper.queryOrder(out_trade_no);
|
|
|
|
+ if (MapUtils.getInteger("order_status", order) == 201) {
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>orderWXPayRecordQueryUpdate 此订单已付款: " + out_trade_no);
|
|
|
|
+ } else if (MapUtils.getInteger("order_status", order) == 301) {
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>orderWXPayRecordQueryUpdate 此订单已完成: " + out_trade_no);
|
|
|
|
+ } else if (MapUtils.getInteger("order_status", order) == 101) {
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>orderWXPayRecordQueryUpdate 此订单已取消: " + out_trade_no);
|
|
|
|
+ } else if (MapUtils.getInteger("order_status", order) == 102) {
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>orderWXPayRecordQueryUpdate 此订单已删除: " + out_trade_no);
|
|
|
|
+ } else {
|
|
|
|
+ Map orderRaram = new HashMap();
|
|
|
|
+ orderRaram.put("payStatus", 2);//已支付
|
|
|
|
+ orderRaram.put("orderStatus", 201);//已支付
|
|
|
|
+ orderRaram.put("payTime", new Date());
|
|
|
|
+ orderRaram.put("orderId", MapUtils.getInteger("id", order));
|
|
|
|
+ qzOrderMapper.updateOrderInfo(orderRaram);
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>orderWXPayRecordQueryUpdate 订单:" + out_trade_no +
|
|
|
|
+ "支付成功,修改支付状态");
|
|
|
|
+
|
|
|
|
+ //查询当前订单所有的支付记录
|
|
|
|
+ List<Map> orderWXPayRecordEntitys =
|
|
|
|
+ orderWXPayRecordMapper.getRecordsByOutTradeNo(out_trade_no);
|
|
|
|
+ for (Map orderWXPayRecordTemp : orderWXPayRecordEntitys) {
|
|
|
|
+ //查询出来的记录不等于当前记录,并且未撤销,未关闭时,撤销订单
|
|
|
|
+ Integer orderWXPayRecordTemp_id = MapUtils.getInteger("id", orderWXPayRecordTemp);
|
|
|
|
+ String orderWXPayRecordTemp_tradeState =
|
|
|
|
+ MapUtils.getString("trade_state", orderWXPayRecordTemp);
|
|
|
|
+ String orderWXPayRecordTemp_outTradeNoWX =
|
|
|
|
+ MapUtils.getString("out_trade_no_wx", orderWXPayRecordTemp);
|
|
|
|
+ if (orderWXPayRecordTemp_id != id && (!WechatUtil.WXTradeState.REVOKED.getCode()
|
|
|
|
+ .equals(orderWXPayRecordTemp_tradeState) ||
|
|
|
|
+ !WechatUtil.WXTradeState.CLOSED.getCode()
|
|
|
|
+ .equals(orderWXPayRecordTemp_tradeState))) {
|
|
|
|
+
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>orderWXPayRecordQueryUpdate 订单:" +
|
|
|
|
+ orderWXPayRecordTemp_outTradeNoWX + "支付失败,调用撤销订单接口开始");
|
|
|
|
+ WechatUtil.wxReverse(orderWXPayRecordTemp_outTradeNoWX);
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>orderWXPayRecordQueryUpdate 订单:" +
|
|
|
|
+ orderWXPayRecordTemp_outTradeNoWX + "支付失败,调用撤销订单接口结束");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ //查询到支付失败,撤销订单
|
|
|
|
+ } else if (WechatUtil.WXTradeState.PAYERROR.getCode().equals(result.getTrade_state())) {
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>orderWXPayRecordQueryUpdate 订单:" + out_trade_no_wx +
|
|
|
|
+ "支付失败,调用撤销订单接口开始");
|
|
|
|
+ WechatUtil.wxReverse(out_trade_no_wx);
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>orderWXPayRecordQueryUpdate 订单:" + out_trade_no_wx +
|
|
|
|
+ "支付失败,调用撤销订单接口结束");
|
|
|
|
+ }
|
|
|
|
+ recordRaram.put("mod_time", new Date());
|
|
|
|
+ orderWXPayRecordMapper.update(recordRaram);
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ logger.info(
|
|
|
|
+ ">>>>>>>>>>>>>>>>>>>>orderWXPayRecordQueryUpdate 微信查询接口调用失败: " + result.getReturn_msg());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>orderWXPayRecordQueryUpdate 未查到需要调用接口的支付记录数据 ");
|
|
|
|
+ }
|
|
|
|
+ logger.info(">>>>>>>>>>>>>>>>>>>>查询付款码支付记录的支付状态 结束<<<<<<<<<<<<<<<<<<<<<<<");
|
|
|
|
+ }
|
|
|
|
+
|
|
@Transactional
|
|
@Transactional
|
|
public void shipmentOrderAutoTakeGoods() {
|
|
public void shipmentOrderAutoTakeGoods() {
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>shipmentOrderAutoTakeGoods is start ");
|
|
logger.info(">>>>>>>>>>>>>>>>>>>>shipmentOrderAutoTakeGoods is start ");
|
|
@@ -353,18 +467,18 @@ public class QzOrderService {
|
|
// 查询门店业务发货后7天的订单
|
|
// 查询门店业务发货后7天的订单
|
|
List<Map> shipmentOrderList = qzOrderMapper.queryShipmentOrderList();
|
|
List<Map> shipmentOrderList = qzOrderMapper.queryShipmentOrderList();
|
|
if (null != shipmentOrderList && shipmentOrderList.size() > 0) {
|
|
if (null != shipmentOrderList && shipmentOrderList.size() > 0) {
|
|
- for (Map map:shipmentOrderList) {
|
|
|
|
|
|
+ for (Map map : shipmentOrderList) {
|
|
Map orderMap = new HashMap();
|
|
Map orderMap = new HashMap();
|
|
- orderMap.put("orderId",MapUtils.getLong("orderId",map));
|
|
|
|
|
|
+ orderMap.put("orderId", MapUtils.getLong("orderId", map));
|
|
qzOrderMapper.updateShipmentOrder(orderMap);
|
|
qzOrderMapper.updateShipmentOrder(orderMap);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//查询保税备货发货后7天的订单
|
|
//查询保税备货发货后7天的订单
|
|
List<Map> shipmentBondedOrderList = qzOrderMapper.queryShipmentBondedOrderList();
|
|
List<Map> shipmentBondedOrderList = qzOrderMapper.queryShipmentBondedOrderList();
|
|
if (null != shipmentBondedOrderList && shipmentBondedOrderList.size() > 0) {
|
|
if (null != shipmentBondedOrderList && shipmentBondedOrderList.size() > 0) {
|
|
- for (Map map:shipmentBondedOrderList) {
|
|
|
|
|
|
+ for (Map map : shipmentBondedOrderList) {
|
|
Map orderMap = new HashMap();
|
|
Map orderMap = new HashMap();
|
|
- orderMap.put("orderId",MapUtils.getLong("orderId",map));
|
|
|
|
|
|
+ orderMap.put("orderId", MapUtils.getLong("orderId", map));
|
|
qzOrderMapper.updateShipmentOrder(orderMap);
|
|
qzOrderMapper.updateShipmentOrder(orderMap);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -389,17 +503,17 @@ public class QzOrderService {
|
|
Map param = new HashMap();
|
|
Map param = new HashMap();
|
|
param.put("userId", userId);
|
|
param.put("userId", userId);
|
|
param.put("orderId", orderId);
|
|
param.put("orderId", orderId);
|
|
- param.put("valueId",goodsId);
|
|
|
|
- param.put("typeId",0);
|
|
|
|
- param.put("productId",productId);
|
|
|
|
- param.put("goodsSpecificationNameValue",goodsSpecificationNameValue);
|
|
|
|
- param.put("status","1");
|
|
|
|
- param.put("content","默认好评");
|
|
|
|
- param.put("evalLevel",5);
|
|
|
|
- param.put("goodsLevel",5);
|
|
|
|
- param.put("valueName",goodsName);
|
|
|
|
- param.put("createTime",new Date());
|
|
|
|
- param.put("modTime",new Date());
|
|
|
|
|
|
+ param.put("valueId", goodsId);
|
|
|
|
+ param.put("typeId", 0);
|
|
|
|
+ param.put("productId", productId);
|
|
|
|
+ param.put("goodsSpecificationNameValue", goodsSpecificationNameValue);
|
|
|
|
+ param.put("status", "1");
|
|
|
|
+ param.put("content", "默认好评");
|
|
|
|
+ param.put("evalLevel", 5);
|
|
|
|
+ param.put("goodsLevel", 5);
|
|
|
|
+ param.put("valueName", goodsName);
|
|
|
|
+ param.put("createTime", new Date());
|
|
|
|
+ param.put("modTime", new Date());
|
|
qzOrderMapper.insertComment(param);//新增评论
|
|
qzOrderMapper.insertComment(param);//新增评论
|
|
}
|
|
}
|
|
qzOrderMapper.updateReceiptOrderByCommentCount();//修改评论数量
|
|
qzOrderMapper.updateReceiptOrderByCommentCount();//修改评论数量
|
|
@@ -408,41 +522,42 @@ public class QzOrderService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public long getDateBetween(Date begin,Date end){
|
|
|
|
|
|
+ public long getDateBetween(Date begin, Date end) {
|
|
SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
- long between = (end.getTime() - begin.getTime())/1000;
|
|
|
|
|
|
+ long between = (end.getTime() - begin.getTime()) / 1000;
|
|
|
|
|
|
- long min = between/60;
|
|
|
|
|
|
+ long min = between / 60;
|
|
|
|
|
|
return min;
|
|
return min;
|
|
}
|
|
}
|
|
|
|
+
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
|
|
|
|
SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
- long between = (new Date().getTime() - DateUtils.strToDate("2018-11-16 09:30:12").getTime())/1000;
|
|
|
|
|
|
+ long between = (new Date().getTime() - DateUtils.strToDate("2018-11-16 09:30:12").getTime()) / 1000;
|
|
|
|
|
|
- long min = between/60;
|
|
|
|
|
|
+ long min = between / 60;
|
|
System.out.println(min);
|
|
System.out.println(min);
|
|
-// Calendar calendar = Calendar.getInstance();
|
|
|
|
-// calendar.add(Calendar.DAY_OF_MONTH, 3);
|
|
|
|
-//
|
|
|
|
-// long time = (calendar.getTime().getTime() - System.currentTimeMillis()) / 1000;
|
|
|
|
-// System.out.println(calendar.getTime().getTime());
|
|
|
|
-// System.out.println(System.currentTimeMillis());
|
|
|
|
-// long hour = time / 3600;
|
|
|
|
-// long minite = time / 60 % 60;
|
|
|
|
-// long second = (time - hour * 3600 - minite * 60);
|
|
|
|
-//
|
|
|
|
-// String body = hour + "时" + minite + "分" + second + "秒";
|
|
|
|
-// System.out.println(body);
|
|
|
|
|
|
+ // Calendar calendar = Calendar.getInstance();
|
|
|
|
+ // calendar.add(Calendar.DAY_OF_MONTH, 3);
|
|
|
|
+ //
|
|
|
|
+ // long time = (calendar.getTime().getTime() - System.currentTimeMillis()) / 1000;
|
|
|
|
+ // System.out.println(calendar.getTime().getTime());
|
|
|
|
+ // System.out.println(System.currentTimeMillis());
|
|
|
|
+ // long hour = time / 3600;
|
|
|
|
+ // long minite = time / 60 % 60;
|
|
|
|
+ // long second = (time - hour * 3600 - minite * 60);
|
|
|
|
+ //
|
|
|
|
+ // String body = hour + "时" + minite + "分" + second + "秒";
|
|
|
|
+ // System.out.println(body);
|
|
|
|
|
|
long currentTime = System.currentTimeMillis() + 2 * 60 * 60 * 1000;
|
|
long currentTime = System.currentTimeMillis() + 2 * 60 * 60 * 1000;
|
|
Date date = new Date(currentTime);
|
|
Date date = new Date(currentTime);
|
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
- String nowTime="";
|
|
|
|
- nowTime= df.format(date);
|
|
|
|
|
|
+ String nowTime = "";
|
|
|
|
+ nowTime = df.format(date);
|
|
System.out.println(nowTime);
|
|
System.out.println(nowTime);
|
|
|
|
|
|
Date successTime = DateUtils.strToDate("2018-11-02 14:57:12.0");
|
|
Date successTime = DateUtils.strToDate("2018-11-02 14:57:12.0");
|