完成超时问题解决,类目三级筛选,修改扣点和金额无效问题
This commit is contained in:
parent
67f8738c5e
commit
5c54c87ea3
|
|
@ -163,35 +163,45 @@ public class WorkerController extends BaseController {
|
||||||
|
|
||||||
// 查询满足技能条件的师傅技能记录
|
// 查询满足技能条件的师傅技能记录
|
||||||
List<Long> workerIdsByCategory = new ArrayList<>();
|
List<Long> workerIdsByCategory = new ArrayList<>();
|
||||||
|
WorkerGoodsCategory workerGoodsCategory = new WorkerGoodsCategory();
|
||||||
if(workerListRequest.getGoodsCategoryId() != null){
|
if(workerListRequest.getGoodsCategoryId() != null){
|
||||||
WorkerGoodsCategory workerGoodsCategory = new WorkerGoodsCategory();
|
|
||||||
workerGoodsCategory.setGoodsCategoryId(workerListRequest.getGoodsCategoryId());
|
workerGoodsCategory.setGoodsCategoryId(workerListRequest.getGoodsCategoryId());
|
||||||
// 如果选择了上级类目但未选择最终类目,则查询该类目下所有子类目
|
}
|
||||||
if(StringUtils.isNotEmpty(workerListRequest.getCategoryLevel1())
|
// 如果选择了上级类目但未选择最终类目,则查询该类目下所有子类目
|
||||||
|
if(StringUtils.isNotEmpty(workerListRequest.getCategoryLevel1())
|
||||||
&& workerListRequest.getGoodsCategoryId() == null) {
|
&& workerListRequest.getGoodsCategoryId() == null) {
|
||||||
GoodsCategory param = new GoodsCategory();
|
// 1. 先查找二级类目
|
||||||
param.setParentCategoryId(Long.valueOf(workerListRequest.getCategoryLevel1()));
|
GoodsCategory param = new GoodsCategory();
|
||||||
List<GoodsCategory> subCategories = goodsCategoryService.selectGoodsCategoryList(param);
|
param.setParentCategoryId(Long.valueOf(workerListRequest.getCategoryLevel1()));
|
||||||
List<String> categoryIds = subCategories.stream()
|
List<GoodsCategory> secondCategories = goodsCategoryService.selectGoodsCategoryList(param);
|
||||||
|
|
||||||
|
// 2. 用二级类目查找三级类目
|
||||||
|
List<String> categoryIds = new ArrayList<>();
|
||||||
|
for (GoodsCategory secondCategory : secondCategories) {
|
||||||
|
param.setParentCategoryId(secondCategory.getGoodsCategoryId());
|
||||||
|
List<GoodsCategory> thirdCategories = goodsCategoryService.selectGoodsCategoryList(param);
|
||||||
|
categoryIds.addAll(thirdCategories.stream()
|
||||||
|
.map(x->x.getGoodsCategoryId().toString())
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
workerGoodsCategory.setCategoryIds(categoryIds);
|
||||||
|
}
|
||||||
|
// 如果选择了二级类目但未选择三级类目
|
||||||
|
else if(StringUtils.isNotEmpty(workerListRequest.getCategoryLevel2())
|
||||||
|
&& workerListRequest.getGoodsCategoryId() == null) {
|
||||||
|
GoodsCategory param = new GoodsCategory();
|
||||||
|
param.setParentCategoryId(Long.valueOf(workerListRequest.getCategoryLevel2()));
|
||||||
|
List<GoodsCategory> subCategories = goodsCategoryService.selectGoodsCategoryList(param);
|
||||||
|
List<String> categoryIds = subCategories.stream()
|
||||||
.map(x->x.getGoodsCategoryId().toString())
|
.map(x->x.getGoodsCategoryId().toString())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
workerGoodsCategory.setCategoryIds(categoryIds);
|
workerGoodsCategory.setCategoryIds(categoryIds);
|
||||||
}
|
}
|
||||||
// 如果选择了二级类目但未选择三级类目
|
if(CollectionUtils.isNotEmpty(workerGoodsCategory.getCategoryIds()) || workerGoodsCategory.getGoodsCategoryId() != null){
|
||||||
else if(StringUtils.isNotEmpty(workerListRequest.getCategoryLevel2())
|
|
||||||
&& workerListRequest.getGoodsCategoryId() == null) {
|
|
||||||
GoodsCategory param = new GoodsCategory();
|
|
||||||
param.setParentCategoryId(Long.valueOf(workerListRequest.getCategoryLevel2()));
|
|
||||||
List<GoodsCategory> subCategories = goodsCategoryService.selectGoodsCategoryList(param);
|
|
||||||
List<String> categoryIds = subCategories.stream()
|
|
||||||
.map(x->x.getGoodsCategoryId().toString())
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
workerGoodsCategory.setCategoryIds(categoryIds);
|
|
||||||
}
|
|
||||||
List<WorkerGoodsCategory> workerGoodsCategoryList = workerGoodsCategoryService.getWorkerGoodsCategory(workerGoodsCategory);
|
List<WorkerGoodsCategory> workerGoodsCategoryList = workerGoodsCategoryService.getWorkerGoodsCategory(workerGoodsCategory);
|
||||||
workerIdsByCategory = workerGoodsCategoryList.stream()
|
workerIdsByCategory = workerGoodsCategoryList.stream()
|
||||||
.map(WorkerGoodsCategory::getWorkerId)
|
.map(WorkerGoodsCategory::getWorkerId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 两个list中的workerid取交集
|
// 两个list中的workerid取交集
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class OrderServiceImpl implements OrderService {
|
||||||
*
|
*
|
||||||
* @see OrderStatus
|
* @see OrderStatus
|
||||||
*/
|
*/
|
||||||
@Value("${order.timeout.status:-4,-3,-2,0,1,2,3}")
|
@Value("${order.timeout.status:-4,-3,0,1,3}")
|
||||||
private List<Integer> timeoutOrderStatus;
|
private List<Integer> timeoutOrderStatus;
|
||||||
private static final List<Integer> orderMasterTimeoutStatus = Arrays.asList(0, 1);
|
private static final List<Integer> orderMasterTimeoutStatus = Arrays.asList(0, 1);
|
||||||
|
|
||||||
|
|
@ -84,7 +84,7 @@ public class OrderServiceImpl implements OrderService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
void checkTimeout(OrderMaster order) {
|
public void checkTimeout(OrderMaster order) {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
// 待接单状态的超时逻辑
|
// 待接单状态的超时逻辑
|
||||||
if (ZERO.equals(order.getOrderStatus())) {
|
if (ZERO.equals(order.getOrderStatus())) {
|
||||||
|
|
@ -93,9 +93,9 @@ public class OrderServiceImpl implements OrderService {
|
||||||
Date overTime1h = getOverTime(createTime, 30 * 60 * 1000);
|
Date overTime1h = getOverTime(createTime, 30 * 60 * 1000);
|
||||||
boolean flag;
|
boolean flag;
|
||||||
if(order.getUpdateTime() != null){
|
if(order.getUpdateTime() != null){
|
||||||
flag = getOverTime(order.getUpdateTime(), 40 * 60 * 1000).before(now);
|
flag = getOverTime(order.getUpdateTime(), 45 * 60 * 1000).before(now);
|
||||||
}else {
|
}else {
|
||||||
flag = getOverTime(createTime, 40 * 60 * 1000).before(now);
|
flag = getOverTime(createTime, 45 * 60 * 1000).before(now);
|
||||||
}
|
}
|
||||||
// 是否已经超时
|
// 是否已经超时
|
||||||
boolean timeout = ONE.equals(order.getTimeout());
|
boolean timeout = ONE.equals(order.getTimeout());
|
||||||
|
|
@ -103,14 +103,14 @@ public class OrderServiceImpl implements OrderService {
|
||||||
if (overTime30min.before(now) && overTime1h.after(now)) {
|
if (overTime30min.before(now) && overTime1h.after(now)) {
|
||||||
// 30min未接单为超时
|
// 30min未接单为超时
|
||||||
log.info("主订单[{}]超时30分钟", order.getId());
|
log.info("主订单[{}]超时30分钟", order.getId());
|
||||||
// orderMasterService.updateTimeout(order.getId(), 1);
|
orderMasterService.updateTimeout(order.getId(), 1);
|
||||||
timeout = true;
|
timeout = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flag && order.getWorkerId() != null) {
|
if (flag && order.getWorkerId() != null) {
|
||||||
log.info("主订单[{}]超时60分钟", order.getId());
|
log.info("主订单[{}]超时60分钟", order.getId());
|
||||||
// 已超时 60min后取消超时状态 清空workerId
|
// 已超时 45min后取消超时状态 清空workerId
|
||||||
// orderMasterService.updateTimeout(order.getId(), 0);
|
orderMasterService.updateTimeout(order.getId(), 0);
|
||||||
orderMasterService.removeWorker(order.getId());
|
orderMasterService.removeWorker(order.getId());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
@ -129,7 +129,7 @@ public class OrderServiceImpl implements OrderService {
|
||||||
if (overTime30min.before(now)) {
|
if (overTime30min.before(now)) {
|
||||||
// 30min未接单为超时
|
// 30min未接单为超时
|
||||||
log.info("主订单[{}]超时30分钟", order.getId());
|
log.info("主订单[{}]超时30分钟", order.getId());
|
||||||
// orderMasterService.updateTimeout(order.getId(), 1);
|
orderMasterService.updateTimeout(order.getId(), 1);
|
||||||
timeout = true;
|
timeout = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -165,13 +165,26 @@ public class OrderServiceImpl implements OrderService {
|
||||||
* @param order 订单信息
|
* @param order 订单信息
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
void checkTimeout(OrderDetail order) {
|
public void checkTimeout(OrderDetail order) {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
// 是否超时
|
// 是否超时
|
||||||
boolean timeout = ONE.equals(order.getTimeout());
|
boolean timeout = ONE.equals(order.getTimeout());
|
||||||
// 超时扣款次数
|
// 超时扣款次数
|
||||||
Integer times = order.getTimeoutFineTimes();
|
Integer times = order.getTimeoutFineTimes();
|
||||||
if (!timeout) {
|
if (!timeout) {
|
||||||
|
// 待上门超时
|
||||||
|
if(order.getOrderStatus().equals(OrderStatus.GOING.code())){
|
||||||
|
// 服务中状态要按预计上门时间计算4h超时
|
||||||
|
Date overTime = getOverTime(order.getExpectTimeStart(), 30 * 60 * 1000);
|
||||||
|
if (overTime.before(now)) {
|
||||||
|
log.info("订单[{}]待上门状态超时30分钟", order.getId());
|
||||||
|
OrderTimeoutRecord record = new OrderTimeoutRecord(order.getId(), order.getWorkerId(), order.getDeptId(), order.getOrderStatus());
|
||||||
|
record.setPayMoney(getFineMoney(order));
|
||||||
|
record.setFineStatus(0);
|
||||||
|
// orderFineRecordMapper.insert(record);
|
||||||
|
orderDetailService.updateTimeout(order.getId(), 1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
// 未超时的单
|
// 未超时的单
|
||||||
if (order.getOrderStatus().equals(OrderStatus.SERVER.code())) {
|
if (order.getOrderStatus().equals(OrderStatus.SERVER.code())) {
|
||||||
// 服务中状态要按预计上门时间计算4h超时
|
// 服务中状态要按预计上门时间计算4h超时
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,12 @@
|
||||||
#{goodsCategoryId}
|
#{goodsCategoryId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="categoryIds != null">
|
||||||
|
AND gc.goods_category_id in
|
||||||
|
<foreach collection="categoryIds" item="categoryId" open="(" separator="," close=")">
|
||||||
|
#{categoryId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue