新消息通知。新订单下单/子师傅拒绝接单

This commit is contained in:
kuang.yife 2023-03-27 00:11:32 +08:00
parent 3d86a523fe
commit 30b91107b1
4 changed files with 42 additions and 15 deletions

View File

@ -2,10 +2,7 @@ package com.ghy.web.controller.order;
import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.enums.FinancialDetailType; import com.ghy.common.enums.*;
import com.ghy.common.enums.OrderBehaviorEnum;
import com.ghy.common.enums.OrderStatus;
import com.ghy.common.enums.PayStatus;
import com.ghy.common.utils.StringUtils; import com.ghy.common.utils.StringUtils;
import com.ghy.customer.domain.Customer; import com.ghy.customer.domain.Customer;
import com.ghy.customer.domain.CustomerAddress; import com.ghy.customer.domain.CustomerAddress;
@ -33,6 +30,7 @@ import com.ghy.payment.service.FinancialMasterService;
import com.ghy.payment.service.OrderFineRecordService; import com.ghy.payment.service.OrderFineRecordService;
import com.ghy.system.domain.SysArea; import com.ghy.system.domain.SysArea;
import com.ghy.system.service.ISysAreaService; import com.ghy.system.service.ISysAreaService;
import com.ghy.system.service.IWxMsgService;
import com.ghy.web.pojo.vo.*; import com.ghy.web.pojo.vo.*;
import com.ghy.worker.domain.Worker; import com.ghy.worker.domain.Worker;
import com.ghy.worker.domain.WorkerCertification; import com.ghy.worker.domain.WorkerCertification;
@ -42,6 +40,7 @@ import com.huifu.adapay.core.exception.BaseAdaPayException;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -104,6 +103,9 @@ public class OrderController extends BaseController {
@Resource @Resource
private OrderBehaviorService orderBehaviorService; private OrderBehaviorService orderBehaviorService;
@Autowired
private IWxMsgService wxMsgService;
/** /**
* 可派单商品数量 * 可派单商品数量
*/ */
@ -382,6 +384,8 @@ public class OrderController extends BaseController {
List<GoodsStandard> goodsList = goodsStandardService.selectByIds(goodsStandardIds); List<GoodsStandard> goodsList = goodsStandardService.selectByIds(goodsStandardIds);
// 商品所属师傅 // 商品所属师傅
Goods goods = goodsService.selectById(goodsList.get(0).getGoodsId()); Goods goods = goodsService.selectById(goodsList.get(0).getGoodsId());
// 师傅信息
Worker worker = workerService.selectById(goods.getWorkerId());
// 商户ID // 商户ID
Long deptId = appOrderRequest.getDeptId(); Long deptId = appOrderRequest.getDeptId();
Assert.notNull(deptId, "deptId is null!"); Assert.notNull(deptId, "deptId is null!");
@ -435,7 +439,17 @@ public class OrderController extends BaseController {
goodsStandard.getGoodsStandardName(), appGoods.getNum(), 0); goodsStandard.getGoodsStandardName(), appGoods.getNum(), 0);
orderGoodsService.insertOrderGoods(orderGoods); orderGoodsService.insertOrderGoods(orderGoods);
} }
// 通知师傅新订单
try {
Map<String,Object> params = new HashMap<>();
params.put("character_string22", orderMaster.getCode());
params.put("thing19",customer.getName());
params.put("time1", com.ghy.common.utils.DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", new Date()));
params.put("thing5", "有新订单,请及时处理!");
wxMsgService.sendWxMsg(worker.getOpenId(), WxMsgEnum.NEW_ORDER, params);
}catch (Exception e){
e.printStackTrace();
}
return AjaxResult.success(orderMaster); return AjaxResult.success(orderMaster);
} }

View File

@ -34,6 +34,7 @@ import com.ghy.system.domain.SysArea;
import com.ghy.system.domain.SysDeptConfig; import com.ghy.system.domain.SysDeptConfig;
import com.ghy.system.service.ISysAreaService; import com.ghy.system.service.ISysAreaService;
import com.ghy.system.service.ISysDeptConfigService; import com.ghy.system.service.ISysDeptConfigService;
import com.ghy.system.service.IWxMsgService;
import com.ghy.web.pojo.vo.OrderChangePriceRequest; import com.ghy.web.pojo.vo.OrderChangePriceRequest;
import com.ghy.web.pojo.vo.OrderListResponse; import com.ghy.web.pojo.vo.OrderListResponse;
import com.ghy.web.pojo.vo.OrderStandard; import com.ghy.web.pojo.vo.OrderStandard;
@ -45,6 +46,7 @@ import com.huifu.adapay.core.exception.BaseAdaPayException;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.util.Assert; import org.apache.shiro.util.Assert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
@ -106,6 +108,8 @@ public class OrderDetailController extends BaseController {
private ISysDeptConfigService sysDeptConfigService; private ISysDeptConfigService sysDeptConfigService;
@Resource @Resource
private OrderBehaviorService orderBehaviorService; private OrderBehaviorService orderBehaviorService;
@Autowired
private IWxMsgService wxMsgService;
@RequiresPermissions("order:detail:view") @RequiresPermissions("order:detail:view")
@GetMapping() @GetMapping()
@ -858,6 +862,15 @@ public class OrderDetailController extends BaseController {
.setBehavior(OrderBehaviorEnum.REFUSE_ORDER); .setBehavior(OrderBehaviorEnum.REFUSE_ORDER);
orderBehaviorService.insert(orderBehavior); orderBehaviorService.insert(orderBehavior);
// 通知师傅新订单
try {
Map<String,Object> params = new HashMap<>();
params.put("thing1", "订单被拒通知!");
params.put("thing5", "订单:"+ orderDetail.getCode() +"被拒绝,请及时处理!");
wxMsgService.sendWxMsg(worker.getOpenId(), WxMsgEnum.ORDER_PLAN, params);
}catch (Exception e){
e.printStackTrace();
}
return AjaxResult.success(); return AjaxResult.success();
} }

View File

@ -8,22 +8,22 @@ package com.ghy.common.enums;
public enum WxMsgEnum { public enum WxMsgEnum {
/** 任务大厅订单通知 */ /** 任务大厅订单通知 */
PUBLIC_ORDER("", ""), ORDER_PLAN("", "yqd3p4qsqn1RiyUb8kO4dPqoGKipRQg_y99nGw0jtLE"),
/** 新订单通知 */ /** 新订单通知 */
NEW_ORDER("",""), NEW_ORDER("","gFoPAYF4J6Y_O5OzzNUbvMxTrsAS7aUWffdNH42xhzM");
/** 超时消息通知 */ /** 超时消息通知 */
OVER_TIME("","8I5BnJMfwj-Z7udhNm9Z-kdjdg4__MV5ug1x8KKsbc0"), // OVER_TIME("","8I5BnJMfwj-Z7udhNm9Z-kdjdg4__MV5ug1x8KKsbc0"),
/** 今日单消息通知 */ /** 今日单消息通知 */
TODAY_ORDER("", ""), // TODAY_ORDER("", "yqd3p4qsqn1RiyUb8kO4dPqoGKipRQg_y99nGw0jtLE"),
/** 明日单通知 */ /** 明日单通知 */
TOMORROW_ORDER("", ""), // TOMORROW_ORDER("", "yqd3p4qsqn1RiyUb8kO4dPqoGKipRQg_y99nGw0jtLE"),
/** 不同意排单通知 */ /** 不同意排单通知 */
NOT_AGREE_PLAIN("", ""), // NOT_AGREE_PLAIN("", "yqd3p4qsqn1RiyUb8kO4dPqoGKipRQg_y99nGw0jtLE"),
/** 不同意完单通知 */ /** 不同意完单通知 */
NOT_AGREE_FINISH("",""), // NOT_AGREE_FINISH("","Yd2PJIdgBhEadi3EkAGyS4DiFp1Rd5ErsEs_jEt-HX4"),
/** 子师傅拒绝接单/退单通知 */ /** 子师傅拒绝接单/退单通知 */
DETAIL_REJECT("", "") // DETAIL_REJECT("", "Yd2PJIdgBhEadi3EkAGyS4DiFp1Rd5ErsEs_jEt-HX4")
;
private String type; private String type;
private String tempCode; private String tempCode;

View File

@ -145,7 +145,7 @@ public class WxMsgServiceImpl implements IWxMsgService {
for (Map.Entry<String, Object> objectEntry : params.entrySet()) { for (Map.Entry<String, Object> objectEntry : params.entrySet()) {
JSONObject model = new JSONObject(); JSONObject model = new JSONObject();
model.put("value", objectEntry.getValue()); model.put("value", objectEntry.getValue());
jsonObject.put(objectEntry.getKey(), jsonObject); jsonObject.put(objectEntry.getKey(), model);
} }
/** /**
* 消息推送配置参数拼接 * 消息推送配置参数拼接