|
|
@ -2,13 +2,15 @@ package org.jeecg.api.service.impl; |
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import org.apache.commons.lang.StringUtils; |
|
|
import org.apache.commons.lang.StringUtils; |
|
|
import org.jeecg.api.bean.PageBean; |
|
|
import org.jeecg.api.bean.PageBean; |
|
|
import org.jeecg.api.service.AppletOrderTeamService; |
|
|
import org.jeecg.api.service.AppletOrderTeamService; |
|
|
import org.jeecg.common.api.vo.Result; |
|
|
import org.jeecg.common.api.vo.Result; |
|
|
import org.jeecg.config.shiro.ShiroRealm; |
|
|
import org.jeecg.config.shiro.ShiroRealm; |
|
|
import org.jeecg.modules.CommonRecyclingDestination.service.ICommonRecyclingDestinationService; |
|
|
|
|
|
|
|
|
import org.jeecg.modules.commonAdminOrderBrowseRecord.entity.CommonAdminOrderBrowseRecord; |
|
|
|
|
|
import org.jeecg.modules.commonAdminOrderBrowseRecord.service.ICommonAdminOrderBrowseRecordService; |
|
|
import org.jeecg.modules.commonDistributionRatio.entity.CommonDistributionRatio; |
|
|
import org.jeecg.modules.commonDistributionRatio.entity.CommonDistributionRatio; |
|
|
import org.jeecg.modules.commonDistributionRatio.service.ICommonDistributionRatioService; |
|
|
import org.jeecg.modules.commonDistributionRatio.service.ICommonDistributionRatioService; |
|
|
import org.jeecg.modules.commonGet.entity.CommonGet; |
|
|
import org.jeecg.modules.commonGet.entity.CommonGet; |
|
|
@ -22,7 +24,6 @@ import org.jeecg.modules.commonShop.service.ICommonShopService; |
|
|
import org.jeecg.modules.commonText.service.ICommonTextService; |
|
|
import org.jeecg.modules.commonText.service.ICommonTextService; |
|
|
import org.jeecg.modules.commonVip.entity.CommonVip; |
|
|
import org.jeecg.modules.commonVip.entity.CommonVip; |
|
|
import org.jeecg.modules.commonVip.service.ICommonVipService; |
|
|
import org.jeecg.modules.commonVip.service.ICommonVipService; |
|
|
import org.jeecg.modules.common_reasons.entity.CommonReasons; |
|
|
|
|
|
import org.jeecg.modules.common_reasons.service.ICommonReasonsService; |
|
|
import org.jeecg.modules.common_reasons.service.ICommonReasonsService; |
|
|
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; |
|
|
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; |
|
|
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; |
|
|
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; |
|
|
@ -59,6 +60,8 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
private ICommonShopService commonShopService; |
|
|
private ICommonShopService commonShopService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private org.jeecg.api.service.impl.LogisticsUtil logisticsUtil; |
|
|
private org.jeecg.api.service.impl.LogisticsUtil logisticsUtil; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ICommonAdminOrderBrowseRecordService commonAdminOrderBrowseRecordService; |
|
|
|
|
|
|
|
|
//管理员:订单列表带分页搜索 |
|
|
//管理员:订单列表带分页搜索 |
|
|
@Override |
|
|
@Override |
|
|
@ -76,27 +79,45 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
} else if (status === 1 && state === 3) { |
|
|
} else if (status === 1 && state === 3) { |
|
|
return { label: '已驳回', class: 'red' } |
|
|
return { label: '已驳回', class: 'red' } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
订单管理栏目修改 |
|
|
|
|
|
【待审核】不包邮待审核订单 |
|
|
|
|
|
【已预约】下单了以及甚于的订单, |
|
|
|
|
|
【待质检】快递送达我们这里签收了 |
|
|
|
|
|
【已结款】质检完成 |
|
|
|
|
|
【已驳回】 |
|
|
|
|
|
【已取消】取消订单 |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
IPage<CommonOrder> pageList = commonOrderService |
|
|
IPage<CommonOrder> pageList = commonOrderService |
|
|
.lambdaQuery() |
|
|
.lambdaQuery() |
|
|
.eq(userId != null,CommonOrder::getUserId,userId) |
|
|
.eq(userId != null,CommonOrder::getUserId,userId) |
|
|
.and(status != null && status > 0 && status < 5, n -> { |
|
|
|
|
|
if (status == 1){//已预约 |
|
|
|
|
|
n.in(CommonOrder::getStatus, 0, 1); |
|
|
|
|
|
|
|
|
.and(status != null && status >= 0 && status <= 5, n -> { |
|
|
|
|
|
/* |
|
|
|
|
|
订单流程 待取件+在线预约 = 待取件+快递上门 = 已取件+快递上门 = 已取件+透明质检 = 已完成+现金打款 |
|
|
|
|
|
*/ |
|
|
|
|
|
if (status == 0){//待审核 待取件+在线预约 |
|
|
|
|
|
n.eq(CommonOrder::getStatus, 0); |
|
|
|
|
|
n.eq(CommonOrder::getState, 0); |
|
|
|
|
|
} |
|
|
|
|
|
if (status == 1){//已预约 待取件+快递上门 or 已取件+快递上门 |
|
|
|
|
|
n.eq(CommonOrder::getStatus, 1); |
|
|
n.eq(CommonOrder::getState, 0); |
|
|
n.eq(CommonOrder::getState, 0); |
|
|
} |
|
|
} |
|
|
if (status == 2){//待质检 |
|
|
|
|
|
|
|
|
if (status == 2){//待质检 已取件+透明质检 |
|
|
n.eq(CommonOrder::getStatus, 2); |
|
|
n.eq(CommonOrder::getStatus, 2); |
|
|
n.eq(CommonOrder::getState, 1); |
|
|
n.eq(CommonOrder::getState, 1); |
|
|
} |
|
|
} |
|
|
if (status == 3){//已结款 |
|
|
|
|
|
|
|
|
if (status == 3){//已结款 已完成+现金打款 |
|
|
n.eq(CommonOrder::getStatus, 3); |
|
|
n.eq(CommonOrder::getStatus, 3); |
|
|
n.eq(CommonOrder::getState, 2); |
|
|
n.eq(CommonOrder::getState, 2); |
|
|
} |
|
|
} |
|
|
if (status == 4){//已驳回 |
|
|
if (status == 4){//已驳回 |
|
|
n.eq(CommonOrder::getState, 4); |
|
|
n.eq(CommonOrder::getState, 4); |
|
|
} |
|
|
} |
|
|
|
|
|
if (status == 5){//已取消 |
|
|
|
|
|
n.eq(CommonOrder::getState, 3); |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
//订单状态不为空则搜索 |
|
|
//订单状态不为空则搜索 |
|
|
.and(StringUtils.isNotBlank(pageBean.getTitle()), n -> { |
|
|
.and(StringUtils.isNotBlank(pageBean.getTitle()), n -> { |
|
|
@ -110,7 +131,6 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
.or() |
|
|
.or() |
|
|
.like(CommonOrder::getOrdeNo, pageBean.getTitle()); |
|
|
.like(CommonOrder::getOrdeNo, pageBean.getTitle()); |
|
|
}) |
|
|
}) |
|
|
.ne(CommonOrder::getState, 3) |
|
|
|
|
|
.orderByDesc(CommonOrder::getCreateTime) |
|
|
.orderByDesc(CommonOrder::getCreateTime) |
|
|
.eq(CommonOrder::getPid,"0") |
|
|
.eq(CommonOrder::getPid,"0") |
|
|
.page(page); |
|
|
.page(page); |
|
|
@ -186,6 +206,11 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
public Result<?> passOrder(String token, String orderId){ |
|
|
public Result<?> passOrder(String token, String orderId){ |
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
CommonOrder commonOrder = commonOrderService.getById(orderId); |
|
|
CommonOrder commonOrder = commonOrderService.getById(orderId); |
|
|
|
|
|
|
|
|
|
|
|
if (commonOrder == null){ |
|
|
|
|
|
return Result.error("订单不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
commonOrder.setStatus(1);//快递上门 |
|
|
commonOrder.setStatus(1);//快递上门 |
|
|
|
|
|
|
|
|
HanHaiMember member = hanHaiMemberService.getById(commonOrder.getUserId()); |
|
|
HanHaiMember member = hanHaiMemberService.getById(commonOrder.getUserId()); |
|
|
@ -195,6 +220,12 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
|
|
|
|
|
|
commonOrderService.updateById(commonOrder); |
|
|
commonOrderService.updateById(commonOrder); |
|
|
|
|
|
|
|
|
|
|
|
// 删除其他用户的浏览记录 |
|
|
|
|
|
commonAdminOrderBrowseRecordService |
|
|
|
|
|
.remove(Wrappers.<CommonAdminOrderBrowseRecord>lambdaQuery() |
|
|
|
|
|
.eq(CommonAdminOrderBrowseRecord::getOrderId, orderId) |
|
|
|
|
|
.ne(CommonAdminOrderBrowseRecord::getUserId, hanHaiMember.getId())); |
|
|
|
|
|
|
|
|
return Result.OK("订单审核通过"); |
|
|
return Result.OK("订单审核通过"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -204,8 +235,20 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
public Result<?> rejectOrder(String token, String orderId){ |
|
|
public Result<?> rejectOrder(String token, String orderId){ |
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
CommonOrder commonOrder = commonOrderService.getById(orderId); |
|
|
CommonOrder commonOrder = commonOrderService.getById(orderId); |
|
|
|
|
|
|
|
|
|
|
|
if (commonOrder == null){ |
|
|
|
|
|
return Result.error("订单不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
commonOrder.setState(4);//驳回 |
|
|
commonOrder.setState(4);//驳回 |
|
|
commonOrderService.updateById(commonOrder); |
|
|
commonOrderService.updateById(commonOrder); |
|
|
|
|
|
|
|
|
|
|
|
// 删除其他用户的浏览记录 |
|
|
|
|
|
commonAdminOrderBrowseRecordService |
|
|
|
|
|
.remove(Wrappers.<CommonAdminOrderBrowseRecord>lambdaQuery() |
|
|
|
|
|
.eq(CommonAdminOrderBrowseRecord::getOrderId, orderId) |
|
|
|
|
|
.ne(CommonAdminOrderBrowseRecord::getUserId, hanHaiMember.getId())); |
|
|
|
|
|
|
|
|
return Result.OK("订单审核拒绝"); |
|
|
return Result.OK("订单审核拒绝"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -276,12 +319,60 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
@Override |
|
|
@Override |
|
|
public Result<?> getUserOrderNum(String userId){ |
|
|
public Result<?> getUserOrderNum(String userId){ |
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
//查询用户信息 |
|
|
//查询用户信息 |
|
|
HanHaiMember hanHaiMember = hanHaiMemberService.getById(userId); |
|
|
HanHaiMember hanHaiMember = hanHaiMemberService.getById(userId); |
|
|
|
|
|
if (hanHaiMember == null) { |
|
|
|
|
|
return Result.error("用户不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int sum = 0; |
|
|
|
|
|
|
|
|
|
|
|
//总订单id |
|
|
|
|
|
List<String> idCount = commonOrderService. |
|
|
|
|
|
lambdaQuery() |
|
|
|
|
|
.eq(CommonOrder::getUserId, hanHaiMember.getId()) |
|
|
|
|
|
.eq(CommonOrder::getPid, "0") // 只查询主订单 |
|
|
|
|
|
.select(CommonOrder::getId) |
|
|
|
|
|
.list() |
|
|
|
|
|
.stream().map(n -> n.getId()) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
// 如果没有订单,直接返回0统计 |
|
|
|
|
|
if (idCount.isEmpty()) { |
|
|
|
|
|
map.put("sum", 0);//总件数 |
|
|
|
|
|
map.put("unit_num", 0);//总回收订单 |
|
|
|
|
|
map.put("order_money", BigDecimal.ZERO);//回收总金额 |
|
|
|
|
|
return Result.OK("该用户的总回收统计",map); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//查询子订单获得总件数 |
|
|
|
|
|
List<CommonOrder> list = commonOrderService |
|
|
|
|
|
.lambdaQuery() |
|
|
|
|
|
.in(CommonOrder::getPid, idCount) |
|
|
|
|
|
.eq(CommonOrder::getType, 1)//质检订单 |
|
|
|
|
|
.select( |
|
|
|
|
|
CommonOrder::getQualifiedNum,//合格数量 |
|
|
|
|
|
CommonOrder::getNoQualifiedNum,//不合格数量 |
|
|
|
|
|
CommonOrder::getUnrecyclable//不可回收数量 |
|
|
|
|
|
) |
|
|
|
|
|
.list(); |
|
|
|
|
|
|
|
|
|
|
|
// 计算总件数:合格数量 + 不合格数量 + 不可回收数量 |
|
|
|
|
|
for (CommonOrder order : list) { |
|
|
|
|
|
Integer qualifiedNum = order.getQualifiedNum() != null ? order.getQualifiedNum() : 0; |
|
|
|
|
|
Integer noQualifiedNum = order.getNoQualifiedNum() != null ? order.getNoQualifiedNum() : 0; |
|
|
|
|
|
Integer unrecyclable = order.getUnrecyclable() != null ? order.getUnrecyclable() : 0; |
|
|
|
|
|
|
|
|
|
|
|
sum += qualifiedNum + noQualifiedNum + unrecyclable; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
map.put("sum",100); |
|
|
|
|
|
map.put("unit_num",200); |
|
|
|
|
|
map.put("order_money",10000); |
|
|
|
|
|
|
|
|
// 设置回收总金额,如果为null则设置为0 |
|
|
|
|
|
BigDecimal orderMoney = hanHaiMember.getPayRole() != null ? hanHaiMember.getPayRole() : BigDecimal.ZERO; |
|
|
|
|
|
|
|
|
|
|
|
map.put("sum", sum);//总件数 |
|
|
|
|
|
map.put("unit_num", idCount.size());//总回收订单 |
|
|
|
|
|
map.put("order_money", orderMoney);//回收总金额 |
|
|
|
|
|
|
|
|
return Result.OK("该用户的总回收统计",map); |
|
|
return Result.OK("该用户的总回收统计",map); |
|
|
} |
|
|
} |
|
|
@ -306,10 +397,30 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
|
|
|
|
|
|
HashMap<String, Long> map = new HashMap<>(); |
|
|
HashMap<String, Long> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
// 统计已预约数量 (status=0或1, state=0) |
|
|
|
|
|
|
|
|
// 获取当前用户已查看的订单ID列表 |
|
|
|
|
|
List<String> viewedOrderIds = commonAdminOrderBrowseRecordService.lambdaQuery() |
|
|
|
|
|
.eq(org.jeecg.modules.commonAdminOrderBrowseRecord.entity.CommonAdminOrderBrowseRecord::getUserId, hanHaiMember.getId()) |
|
|
|
|
|
.select(org.jeecg.modules.commonAdminOrderBrowseRecord.entity.CommonAdminOrderBrowseRecord::getOrderId) |
|
|
|
|
|
.list() |
|
|
|
|
|
.stream() |
|
|
|
|
|
.map(org.jeecg.modules.commonAdminOrderBrowseRecord.entity.CommonAdminOrderBrowseRecord::getOrderId) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
// 统计待审核数量 (status=0, state=0) |
|
|
|
|
|
Long pendingAuditCount = commonOrderService.lambdaQuery() |
|
|
|
|
|
.eq(CommonOrder::getStatus, 0) |
|
|
|
|
|
.eq(CommonOrder::getState, 0) |
|
|
|
|
|
.eq(CommonOrder::getPid, "0") |
|
|
|
|
|
.and(!viewedOrderIds.isEmpty(), n -> n.notIn(CommonOrder::getId, viewedOrderIds)) |
|
|
|
|
|
.count(); |
|
|
|
|
|
map.put("pendingAudit", pendingAuditCount); |
|
|
|
|
|
|
|
|
|
|
|
// 统计已预约数量 (status=1, state=0) |
|
|
Long appointedCount = commonOrderService.lambdaQuery() |
|
|
Long appointedCount = commonOrderService.lambdaQuery() |
|
|
.in(CommonOrder::getStatus, 0, 1) |
|
|
|
|
|
|
|
|
.eq(CommonOrder::getStatus, 1) |
|
|
.eq(CommonOrder::getState, 0) |
|
|
.eq(CommonOrder::getState, 0) |
|
|
|
|
|
.eq(CommonOrder::getPid, "0") |
|
|
|
|
|
.and(!viewedOrderIds.isEmpty(), n -> n.notIn(CommonOrder::getId, viewedOrderIds)) |
|
|
.count(); |
|
|
.count(); |
|
|
map.put("appointed", appointedCount); |
|
|
map.put("appointed", appointedCount); |
|
|
|
|
|
|
|
|
@ -317,6 +428,8 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
Long waitingInspectionCount = commonOrderService.lambdaQuery() |
|
|
Long waitingInspectionCount = commonOrderService.lambdaQuery() |
|
|
.eq(CommonOrder::getStatus, 2) |
|
|
.eq(CommonOrder::getStatus, 2) |
|
|
.eq(CommonOrder::getState, 1) |
|
|
.eq(CommonOrder::getState, 1) |
|
|
|
|
|
.eq(CommonOrder::getPid, "0") |
|
|
|
|
|
.and(!viewedOrderIds.isEmpty(), n -> n.notIn(CommonOrder::getId, viewedOrderIds)) |
|
|
.count(); |
|
|
.count(); |
|
|
map.put("waitingInspection", waitingInspectionCount); |
|
|
map.put("waitingInspection", waitingInspectionCount); |
|
|
|
|
|
|
|
|
@ -324,15 +437,27 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
Long completedCount = commonOrderService.lambdaQuery() |
|
|
Long completedCount = commonOrderService.lambdaQuery() |
|
|
.eq(CommonOrder::getStatus, 3) |
|
|
.eq(CommonOrder::getStatus, 3) |
|
|
.eq(CommonOrder::getState, 2) |
|
|
.eq(CommonOrder::getState, 2) |
|
|
|
|
|
.eq(CommonOrder::getPid, "0") |
|
|
|
|
|
.and(!viewedOrderIds.isEmpty(), n -> n.notIn(CommonOrder::getId, viewedOrderIds)) |
|
|
.count(); |
|
|
.count(); |
|
|
map.put("completed", completedCount); |
|
|
map.put("completed", completedCount); |
|
|
|
|
|
|
|
|
// 统计已驳回数量 (state=4) |
|
|
// 统计已驳回数量 (state=4) |
|
|
Long rejectedCount = commonOrderService.lambdaQuery() |
|
|
Long rejectedCount = commonOrderService.lambdaQuery() |
|
|
.eq(CommonOrder::getState, 4) |
|
|
.eq(CommonOrder::getState, 4) |
|
|
|
|
|
.eq(CommonOrder::getPid, "0") |
|
|
|
|
|
.and(!viewedOrderIds.isEmpty(), n -> n.notIn(CommonOrder::getId, viewedOrderIds)) |
|
|
.count(); |
|
|
.count(); |
|
|
map.put("rejected", rejectedCount); |
|
|
map.put("rejected", rejectedCount); |
|
|
|
|
|
|
|
|
|
|
|
// 统计已取消数量 (state=3) |
|
|
|
|
|
Long cancelledCount = commonOrderService.lambdaQuery() |
|
|
|
|
|
.eq(CommonOrder::getState, 3) |
|
|
|
|
|
.eq(CommonOrder::getPid, "0") |
|
|
|
|
|
.and(!viewedOrderIds.isEmpty(), n -> n.notIn(CommonOrder::getId, viewedOrderIds)) |
|
|
|
|
|
.count(); |
|
|
|
|
|
map.put("cancelled", cancelledCount); |
|
|
|
|
|
|
|
|
return Result.OK("订单状态统计", map); |
|
|
return Result.OK("订单状态统计", map); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -436,6 +561,97 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
return Result.OK("提交成功"); |
|
|
return Result.OK("提交成功"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<?> adminOrderBrowseRecord(String token, String orderIds) { |
|
|
|
|
|
// 验证token |
|
|
|
|
|
if (StringUtils.isBlank(token)) { |
|
|
|
|
|
return Result.error("token不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
HanHaiMember member = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
|
|
if (member == null) { |
|
|
|
|
|
return Result.error("用户token无效"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 验证orderIds参数 |
|
|
|
|
|
if (StringUtils.isBlank(orderIds)) { |
|
|
|
|
|
return Result.error("订单ID不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 分割订单ID字符串 |
|
|
|
|
|
String[] orderIdArray = orderIds.split(","); |
|
|
|
|
|
if (orderIdArray.length == 0) { |
|
|
|
|
|
return Result.error("订单ID格式不正确"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 去重并过滤空值 |
|
|
|
|
|
List<String> validOrderIds = Arrays.stream(orderIdArray) |
|
|
|
|
|
.filter(StringUtils::isNotBlank) |
|
|
|
|
|
.map(String::trim) |
|
|
|
|
|
.distinct() |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
if (validOrderIds.isEmpty()) { |
|
|
|
|
|
return Result.error("没有有效的订单ID"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 查询已存在的浏览记录,避免重复添加 |
|
|
|
|
|
List<String> existingOrderIds = commonAdminOrderBrowseRecordService.lambdaQuery() |
|
|
|
|
|
.eq(CommonAdminOrderBrowseRecord::getUserId, member.getId()) |
|
|
|
|
|
.in(CommonAdminOrderBrowseRecord::getOrderId, validOrderIds) |
|
|
|
|
|
.select(CommonAdminOrderBrowseRecord::getOrderId) |
|
|
|
|
|
.list() |
|
|
|
|
|
.stream() |
|
|
|
|
|
.map(CommonAdminOrderBrowseRecord::getOrderId) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
// 过滤出需要新增的订单ID |
|
|
|
|
|
List<String> newOrderIds = validOrderIds.stream() |
|
|
|
|
|
.filter(orderId -> !existingOrderIds.contains(orderId)) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
if (newOrderIds.isEmpty()) { |
|
|
|
|
|
return Result.OK("所有订单均已记录浏览"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 批量创建浏览记录 |
|
|
|
|
|
List<CommonAdminOrderBrowseRecord> browseRecords = new ArrayList<>(); |
|
|
|
|
|
Date now = new Date(); |
|
|
|
|
|
|
|
|
|
|
|
for (String orderId : newOrderIds) { |
|
|
|
|
|
CommonAdminOrderBrowseRecord record = new CommonAdminOrderBrowseRecord(); |
|
|
|
|
|
record.setUserId(member.getId()); |
|
|
|
|
|
record.setOrderId(orderId); |
|
|
|
|
|
record.setCreateTime(now); |
|
|
|
|
|
record.setCreateBy(member.getId()); |
|
|
|
|
|
browseRecords.add(record); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 批量保存 |
|
|
|
|
|
boolean success = commonAdminOrderBrowseRecordService.saveBatch(browseRecords); |
|
|
|
|
|
|
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.OK("成功记录 " + newOrderIds.size() + " 条订单浏览记录"); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.error("保存浏览记录失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<?> getOrderIdBywliuNo(String token, String wliuNo) { |
|
|
|
|
|
|
|
|
|
|
|
List<CommonOrder> list = commonOrderService.lambdaQuery() |
|
|
|
|
|
.eq(CommonOrder::getWliuNo, wliuNo) |
|
|
|
|
|
.select(CommonOrder::getId) |
|
|
|
|
|
.list(); |
|
|
|
|
|
|
|
|
|
|
|
if (list.size() > 0){ |
|
|
|
|
|
return Result.ok(list.get(0).getId()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return Result.error("系统中不存在该运单号"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 添加最近回收 |
|
|
// 添加最近回收 |
|
|
public void addCommonGet(CommonOrder order, HanHaiMember member){ |
|
|
public void addCommonGet(CommonOrder order, HanHaiMember member){ |
|
|
CommonGet commonGet = new CommonGet(); |
|
|
CommonGet commonGet = new CommonGet(); |
|
|
|