定时任务
This commit is contained in:
parent
a56511b4f2
commit
ddaf344907
|
|
@ -207,7 +207,7 @@ public class OrderController extends BaseController {
|
|||
goods.setGoodsName(request.getGoodsBrand());
|
||||
goods.setGoodsImgUrl(request.getImageUrl());
|
||||
goods.setGoodsVideoUrl(request.getVideoUrl());
|
||||
goods.setDeptGoodsCategoryId(request.getCategoryId3());
|
||||
goods.setDeptGoodsCategoryId(request.getOrderGoodsStandards().get(0).getDeptCategoryId());
|
||||
goods.setStatus(1);
|
||||
goods.setRemark(request.getRemark());
|
||||
goodsService.insertGoods(goods);
|
||||
|
|
|
|||
|
|
@ -262,6 +262,24 @@ public class OrderMasterController extends BaseController {
|
|||
GoodsStandard goodsStandard = goodsStandardService.selectById(orderStandardList.get(0).getGoodsStandardId());
|
||||
|
||||
Goods goods = goodsService.selectById(goodsStandard.getGoodsId());
|
||||
// 填充商品三级类目
|
||||
if(goods.getDeptGoodsCategoryId() != null){
|
||||
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(goods.getDeptGoodsCategoryId());
|
||||
if(deptGoodsCategory != null){
|
||||
GoodsCategory one = goodsCategoryService.selectById(deptGoodsCategory.getGoodsCategoryId());
|
||||
if(one != null && one.getParentCategoryId() != null){
|
||||
GoodsCategory two = goodsCategoryService.selectById(one.getParentCategoryId());
|
||||
if(two != null && two.getParentCategoryId() != null){
|
||||
GoodsCategory three = goodsCategoryService.selectById(two.getParentCategoryId());
|
||||
if(three != null){
|
||||
master.setConsoleGoodsName("【" + three.getGoodsCategoryName()
|
||||
+ "-" + two.getGoodsCategoryName()
|
||||
+ "-" + one.getGoodsCategoryName() + "】");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 财务信息
|
||||
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(master.getId());
|
||||
|
|
@ -301,7 +319,7 @@ public class OrderMasterController extends BaseController {
|
|||
orderListResponse.setGoodsBrand(master.getGoodsBrand());
|
||||
orderListResponse.setGoodsSpecification(master.getGoodsSpecification());
|
||||
orderListResponse.setOrderMasterId(master.getId());
|
||||
orderListResponse.setGoodsName(goods.getGoodsName());
|
||||
orderListResponse.setGoodsName(master.getConsoleGoodsName());
|
||||
orderListResponse.setGoodsLogoUrl(goods.getGoodsImgUrl());
|
||||
orderListResponse.setDiscountMoney(financialMaster.getDiscountMoney());
|
||||
orderListResponse.setTotalMoney(financialMaster.getTotalMoney());
|
||||
|
|
|
|||
|
|
@ -179,6 +179,12 @@
|
|||
<if test="createTimeEnd != null">
|
||||
AND om.create_time <= #{createTimeEnd}
|
||||
</if>
|
||||
<if test="updateTimeStart != null">
|
||||
AND om.update_time >= #{updateTimeStart}
|
||||
</if>
|
||||
<if test="updateTimeEnd != null">
|
||||
AND om.update_time <= #{updateTimeEnd}
|
||||
</if>
|
||||
<if test="orderMasterIds != null and orderMasterIds != ''">
|
||||
AND om.id in (${orderMasterIds})
|
||||
</if>
|
||||
|
|
@ -465,7 +471,8 @@
|
|||
|
||||
<update id="removeWorker">
|
||||
UPDATE order_master
|
||||
SET worker_id = NULL
|
||||
SET worker_id = NULL,
|
||||
update_time = SYSDATE()
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
|
|
|
|||
|
|
@ -90,5 +90,45 @@ public class OrderAlertTaskServiceImpl implements OrderAlertTaskService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
orderMaster.setCreateTimeStart(null);
|
||||
orderMaster.setCreateTimeEnd(null);
|
||||
orderMaster.setUpdateTimeStart(LocalDateTime.parse(startTime, df));
|
||||
orderMaster.setUpdateTimeEnd(LocalDateTime.parse(endTime, df));
|
||||
List<OrderMaster> updateOrderMasters = orderMasterService.selectOrderMasterList(orderMaster);
|
||||
if(CollectionUtils.isNotEmpty(updateOrderMasters)){
|
||||
List<Long> addressList = updateOrderMasters.stream().map(OrderMaster::getAddressId).collect(Collectors.toList());
|
||||
CustomerAddress customerAddress = new CustomerAddress();
|
||||
customerAddress.setCustomerAddressIds(addressList);
|
||||
List<CustomerAddress> customerAddresses = customerAddressService.getCustomerAddressList(customerAddress);
|
||||
if(CollectionUtils.isNotEmpty(customerAddresses)){
|
||||
List<Long> cityIds = customerAddresses.stream().map(CustomerAddress::getCityId).collect(Collectors.toList());
|
||||
WorkerArea workerArea = new WorkerArea();
|
||||
workerArea.setCityIds(cityIds);
|
||||
List<WorkerArea> workerAreaList = workerAreaService.getWorkerAreaList(workerArea);
|
||||
List<Long> workIds = workerAreaList.stream().map(WorkerArea::getWorkerId).distinct().collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(workIds)){
|
||||
workIds.forEach(model->{
|
||||
// 通知师傅新订单
|
||||
try {
|
||||
Worker assignWorker = workerService.selectById(model);
|
||||
// 消息组装。
|
||||
Map<String, Object> paramsNew = new HashMap<>();
|
||||
// 订单编号
|
||||
paramsNew.put("character_string6", "newOrder");
|
||||
// 名称
|
||||
paramsNew.put("thing14", "需求大厅有新订单哦,请尽快查看");
|
||||
// 预约时间
|
||||
paramsNew.put("time4", com.ghy.common.utils.DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", new Date()));
|
||||
// 消息推送
|
||||
WechatMsgUtils.sendWeChatMsg(WechatMsgUtils.getToken(), assignWorker.getWxOpenId(), WxMsgEnum.TEXT, paramsNew);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,13 @@ public class OrderServiceImpl implements OrderService {
|
|||
if (ZERO.equals(order.getOrderStatus())) {
|
||||
Date createTime = order.getCreateTime();
|
||||
Date overTime30min = getOverTime(createTime, 30 * 60 * 1000);
|
||||
Date overTime1h = getOverTime(createTime, 60 * 60 * 1000);
|
||||
Date overTime1h = getOverTime(createTime, 30 * 60 * 1000);
|
||||
boolean flag;
|
||||
if(order.getUpdateTime() != null){
|
||||
flag = getOverTime(order.getUpdateTime(), 30 * 60 * 1000).before(now);
|
||||
}else {
|
||||
flag = getOverTime(createTime, 30 * 60 * 1000).before(now);
|
||||
}
|
||||
// 是否已经超时
|
||||
boolean timeout = ONE.equals(order.getTimeout());
|
||||
if (!timeout) {
|
||||
|
|
@ -101,13 +107,11 @@ public class OrderServiceImpl implements OrderService {
|
|||
timeout = true;
|
||||
}
|
||||
}
|
||||
if (timeout) {
|
||||
if (overTime1h.before(now) && order.getWorkerId() != null) {
|
||||
log.info("主订单[{}]超时60分钟", order.getId());
|
||||
// 已超时 60min后取消超时状态 清空workerId
|
||||
orderMasterService.updateTimeout(order.getId(), 0);
|
||||
orderMasterService.removeWorker(order.getId());
|
||||
}
|
||||
if (flag && order.getWorkerId() != null) {
|
||||
log.info("主订单[{}]超时60分钟", order.getId());
|
||||
// 已超时 60min后取消超时状态 清空workerId
|
||||
orderMasterService.updateTimeout(order.getId(), 0);
|
||||
orderMasterService.removeWorker(order.getId());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue