|
|
@@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.zhongzheng.common.core.domain.entity.SysUser;
|
|
|
@@ -23,37 +22,30 @@ import com.zhongzheng.common.type.EncryptHandler;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ToolsUtils;
|
|
|
import com.zhongzheng.common.utils.http.HttpUtils;
|
|
|
-import com.zhongzheng.modules.alisms.service.IAliSmsService;
|
|
|
import com.zhongzheng.modules.course.domain.CourseSubject;
|
|
|
import com.zhongzheng.modules.course.service.ICourseSubjectService;
|
|
|
-import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
|
import com.zhongzheng.modules.grade.domain.UserPeriod;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
|
import com.zhongzheng.modules.grade.service.IUserPeriodService;
|
|
|
import com.zhongzheng.modules.inform.bo.InformSysUserAddBo;
|
|
|
-import com.zhongzheng.modules.inform.bo.InformUserAddBo;
|
|
|
-import com.zhongzheng.modules.inform.domain.InformRemindRelevance;
|
|
|
-import com.zhongzheng.modules.inform.service.IInformRemindRelevanceService;
|
|
|
import com.zhongzheng.modules.inform.service.IInformRemindService;
|
|
|
import com.zhongzheng.modules.inform.service.IInformSysUserService;
|
|
|
import com.zhongzheng.modules.inform.vo.InformRemindVo;
|
|
|
import com.zhongzheng.modules.order.domain.*;
|
|
|
import com.zhongzheng.modules.order.service.*;
|
|
|
+import com.zhongzheng.modules.order.vo.OrderGoodsVo;
|
|
|
import com.zhongzheng.modules.sdk.domain.TopNuoMplatformLog;
|
|
|
import com.zhongzheng.modules.sdk.service.ITopNuoMplatformLogService;
|
|
|
import com.zhongzheng.modules.system.bo.SysTenantBadBillConfigBo;
|
|
|
-import com.zhongzheng.modules.order.vo.OrderGoodsVo;
|
|
|
import com.zhongzheng.modules.system.domain.SysOldOrg;
|
|
|
import com.zhongzheng.modules.system.domain.SysTenant;
|
|
|
import com.zhongzheng.modules.system.service.ISysOldOrgService;
|
|
|
import com.zhongzheng.modules.system.service.ISysTenantService;
|
|
|
import com.zhongzheng.modules.system.service.ISysUserService;
|
|
|
-import com.zhongzheng.modules.top.financial.bo.TopDivideLogQueryBo;
|
|
|
import com.zhongzheng.modules.system.vo.SysTenantAccountVo;
|
|
|
import com.zhongzheng.modules.top.financial.bo.*;
|
|
|
import com.zhongzheng.modules.top.financial.domain.*;
|
|
|
-import com.zhongzheng.modules.top.financial.domain.TopCostTp;
|
|
|
import com.zhongzheng.modules.top.financial.service.*;
|
|
|
import com.zhongzheng.modules.top.financial.vo.*;
|
|
|
import com.zhongzheng.modules.top.goods.bo.*;
|
|
|
@@ -62,32 +54,25 @@ import com.zhongzheng.modules.top.goods.mapper.TopOldOrderMapper;
|
|
|
import com.zhongzheng.modules.top.goods.service.*;
|
|
|
import com.zhongzheng.modules.top.goods.vo.*;
|
|
|
import com.zhongzheng.modules.top.order.bo.PayOrderCallBackBo;
|
|
|
-import com.zhongzheng.modules.top.order.bo.TopOrderRecNoteAddBo;
|
|
|
import com.zhongzheng.modules.top.order.domain.TopOrderBankPay;
|
|
|
import com.zhongzheng.modules.top.order.service.ITopOrderBankPayService;
|
|
|
import com.zhongzheng.modules.top.order.vo.TopOldOrderCommissionExportVo;
|
|
|
import com.zhongzheng.modules.top.order.vo.TopOldOrderCompanyExportVo;
|
|
|
+import com.zhongzheng.modules.top.order.vo.TopOldOrderExportVo;
|
|
|
import com.zhongzheng.modules.top.order.vo.TopOldOrderSellerExportVo;
|
|
|
import com.zhongzheng.modules.top.user.domain.TopSysUserRole;
|
|
|
import com.zhongzheng.modules.top.user.service.ITopSysConfigService;
|
|
|
import com.zhongzheng.modules.top.user.service.ITopSysRoleService;
|
|
|
import com.zhongzheng.modules.top.user.service.ITopSysUserRoleService;
|
|
|
-import com.zhongzheng.modules.top.order.vo.TopOldOrderExportVo;
|
|
|
import com.zhongzheng.modules.top.user.service.ITopSysUserService;
|
|
|
import com.zhongzheng.modules.user.domain.User;
|
|
|
-import com.zhongzheng.modules.user.domain.UserSubscribe;
|
|
|
import com.zhongzheng.modules.user.service.IUserService;
|
|
|
-import com.zhongzheng.modules.user.vo.UserSubscribeVo;
|
|
|
-import com.zhongzheng.modules.user.vo.UserVo;
|
|
|
-import net.sf.jsqlparser.statement.select.Top;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -245,6 +230,9 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
@Value("${oldOrder.refundPayHandle}")
|
|
|
private String REFUND_PAY_HANDLE;
|
|
|
|
|
|
+ @Value("${oldOrder.updateRemark}")
|
|
|
+ private String UPDATE_REMARK;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public TopOldOrderVo queryById(String orderSn) {
|
|
|
@@ -1779,6 +1767,53 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean updateFinanceRemark(TopUpdateRemarkBo bo) {
|
|
|
+ //查询视图 v_top_order
|
|
|
+ List<TopOldOrderVo> orderVos = baseMapper.queryByOrderSns(bo.getOrderSnList());
|
|
|
+ if (CollectionUtils.isEmpty(orderVos)) {
|
|
|
+ throw new CustomException("订单号有误!");
|
|
|
+ }
|
|
|
+ Map<Integer, List<TopOldOrderVo>> map = orderVos.stream().collect(Collectors.groupingBy(TopOldOrderVo::getOrderFrom));
|
|
|
+ List<String> oldOrderSn = new ArrayList<>();
|
|
|
+ map.forEach((k, v) -> {
|
|
|
+ if (k == 1) {
|
|
|
+ //新系统订单
|
|
|
+ orderService.update(new LambdaUpdateWrapper<Order>()
|
|
|
+ .set(Order::getRemark, bo.getRemark())
|
|
|
+ .in(Order::getOrderSn, v.stream().map(TopOldOrderVo::getOrderSn).collect(Collectors.toList())));
|
|
|
+ } else {
|
|
|
+ update(new LambdaUpdateWrapper<TopOldOrder>()
|
|
|
+ .set(TopOldOrder::getFinanceRemark, bo.getRemark())
|
|
|
+ .in(TopOldOrder::getOrderSn, v.stream().map(TopOldOrderVo::getOrderSn).collect(Collectors.toList())));
|
|
|
+
|
|
|
+ oldOrderSn.addAll(v.stream().map(TopOldOrderVo::getOrderSn).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(oldOrderSn)){
|
|
|
+ //修改备注
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ Long nowTime = DateUtils.getNowTime();
|
|
|
+ String sign = ToolsUtils.EncoderByMd5( nowTime.toString() + "pubilc2022");
|
|
|
+ params.put("stamp", nowTime.toString());
|
|
|
+ params.put("sign", sign);
|
|
|
+ params.put("orderSn", oldOrderSn.stream().collect(Collectors.joining(",")));
|
|
|
+ params.put("remark", bo.getRemark());
|
|
|
+ String respone = "";
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.postFormBody(UPDATE_REMARK, params);
|
|
|
+ if (!respone.contains("\"Status\":true")) {
|
|
|
+ throw new CustomException("旧系统修改备注接口请求错误!");
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ log.error("旧系统修改备注接口请求错误" + respone);
|
|
|
+ throw new CustomException("旧系统修改备注接口请求错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean orderRefundApply(TopOrderRefundApplyBo bo) {
|
|
|
@@ -2668,11 +2703,25 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public TopOrderStatisticsVo statisticsOrder() {
|
|
|
+ public TopOrderStatisticsVo statisticsOrder(TopOldOrderQueryBo bo) {
|
|
|
+ //查询视图 v_top_order
|
|
|
+ if (ObjectUtils.isNotNull(bo.getEducationTypeId())) {
|
|
|
+ TopCourseEducationType educationType = topCourseEducationTypeService.getById(bo.getEducationTypeId());
|
|
|
+ if (StringUtils.isNotBlank(educationType.getSchemeName())) {
|
|
|
+ bo.setBusinessFullName(educationType.getSchemeName() + educationType.getEducationName());
|
|
|
+ } else {
|
|
|
+ bo.setBusinessFullName(educationType.getEducationName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(bo.getBusinessId())) {
|
|
|
+ String name = topCourseBusinessService.getBusinessFullName(bo.getBusinessId());
|
|
|
+ bo.setBusinessFullName(name);
|
|
|
+ }
|
|
|
+
|
|
|
TopOrderStatisticsVo vo = new TopOrderStatisticsVo();
|
|
|
//订单统计
|
|
|
//查询视图 v_top_order
|
|
|
- List<TopOldOrderVo> vos = baseMapper.queryListAll();
|
|
|
+ List<TopOldOrderVo> vos = baseMapper.queryList(bo);
|
|
|
if (CollectionUtils.isEmpty(vos)) {
|
|
|
return vo;
|
|
|
}
|
|
|
@@ -2684,19 +2733,24 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
BigDecimal practical = received.subtract(refunded);
|
|
|
BigDecimal cost = vos.stream().filter(x -> ObjectUtils.isNotNull(x.getOrderCost())).map(TopOldOrderVo::getOrderCost).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
//订单学员数
|
|
|
- Integer orderUserNum = 0;
|
|
|
+ Set<String> userCard = new HashSet<>();
|
|
|
for (TopOldOrderVo orderVo : vos) {
|
|
|
- if (orderVo.getOrderFrom() == 2) {
|
|
|
- //业务系统B端订单
|
|
|
+ if (orderVo.getOrderFrom() != 1) {
|
|
|
+ //旧系统订单
|
|
|
List<TopOldOrderGoods> list = topOrderGoodsService
|
|
|
- .list(new LambdaQueryWrapper<TopOldOrderGoods>().eq(TopOldOrderGoods::getOrderSn, orderVo.getOrderSn()).eq(TopOldOrderGoods::getStatus, 1));
|
|
|
+ .list(new LambdaQueryWrapper<TopOldOrderGoods>()
|
|
|
+ .eq(TopOldOrderGoods::getOrderSn, orderVo.getOrderSn())
|
|
|
+ .eq(TopOldOrderGoods::getStatus, 1)
|
|
|
+ .ne(TopOldOrderGoods::getCheckStatus,-1));
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
- Set<String> collect = list.stream().map(TopOldOrderGoods::getUserCard).collect(Collectors.toSet());
|
|
|
- orderUserNum += collect.size();
|
|
|
+ list.forEach(x -> userCard.add(x.getUserCard()));
|
|
|
}
|
|
|
} else {
|
|
|
- //C端 一单一人
|
|
|
- orderUserNum += 1;
|
|
|
+ //新系统订单
|
|
|
+ User user = userService.getById(orderVo.getUserId());
|
|
|
+ if (ObjectUtils.isNotNull(user)){
|
|
|
+ userCard.add(user.getIdCard());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
Integer orderNum = vos.size();
|
|
|
@@ -2707,7 +2761,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
vo.setOrderUncollectedTotal(uncollected);
|
|
|
vo.setPracticalPriceTotal(practical);
|
|
|
vo.setOrderCostTotal(cost);
|
|
|
- vo.setOrderUserNum(orderUserNum);
|
|
|
+ vo.setOrderUserNum(userCard.size());
|
|
|
vo.setOrderNum(orderNum);
|
|
|
return vo;
|
|
|
}
|