package com.mallplus.order.service.impl;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mallplus.common.constant.AllEnum;
import com.mallplus.common.constant.OrderStatus;
import com.mallplus.common.entity.oms.*;
import com.mallplus.common.entity.pms.*;
import com.mallplus.common.entity.sms.*;
import com.mallplus.common.entity.ums.UmsIntegrationConsumeSetting;
import com.mallplus.common.entity.ums.UmsMember;
import com.mallplus.common.entity.ums.UmsMemberBlanceLog;
import com.mallplus.common.exception.ApiMallPlusException;
import com.mallplus.common.exception.BusinessException;
import com.mallplus.common.feign.MarkingFeignClinent;
import com.mallplus.common.feign.MemberFeignClient;
import com.mallplus.common.feign.PmsFeignClinent;
import com.mallplus.common.redis.constant.RedisToolsConstant;
import com.mallplus.common.redis.template.RedisUtil;
import com.mallplus.common.utils.CommonResult;
import com.mallplus.common.utils.DateUtils;
import com.mallplus.common.utils.JsonUtil;
import com.mallplus.common.utils.ValidatorUtils;
import com.mallplus.common.vo.*;
import com.mallplus.order.config.WxAppletProperties;
import com.mallplus.order.mapper.OmsCartItemMapper;
import com.mallplus.order.mapper.OmsOrderMapper;
import com.mallplus.order.mapper.OmsOrderOperateHistoryMapper;
import com.mallplus.order.mapper.OmsOrderSettingMapper;
import com.mallplus.order.service.*;
import com.mallplus.order.utils.applet.TemplateData;
import com.mallplus.order.utils.applet.WX_TemplateMsgUtil;
import com.mallplus.order.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StopWatch;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
* 订单表 服务实现类
* </p>
*
* @author zscat
* @since 2019-04-17
*/
@Slf4j
@Service
public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder> implements IOmsOrderService {
@Autowired
private WxAppletProperties wxAppletProperties;
@Resource
private WechatApiService wechatApiService;
@Resource
private IUmsMemberReceiveAddressService addressService;
@Resource
private OmsOrderMapper orderMapper;
@Resource
private RedisUtil redisUtil;
@Resource
private IOmsOrderOperateHistoryService orderOperateHistoryDao;
@Resource
private OmsOrderOperateHistoryMapper orderOperateHistoryMapper;
@Resource
private PmsFeignClinent pmsFeignClinent;
@Resource
private MemberFeignClient memberFeignClient;
@Resource
private MarkingFeignClinent markingFeignClinent;
@Resource
private OmsCartItemMapper cartItemMapper;
@Resource
private IOmsOrderService orderService;
@Resource
private IOmsOrderItemService orderItemService;
@Resource
private OmsOrderSettingMapper orderSettingMapper;
@Resource
private IOmsCartItemService cartItemService;
@Autowired
private IOmsOrderOperateHistoryService orderOperateHistoryService;
@Autowired
private ApiContext apiContext;
@Override
public int delivery(List<OmsOrderDeliveryParam> deliveryParamList) {
//批量发货
int count = orderMapper.delivery(deliveryParamList);
//添加操作记录
List<OmsOrderOperateHistory> operateHistoryList = deliveryParamList.stream()
.map(omsOrderDeliveryParam -> {
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(omsOrderDeliveryParam.getOrderId());
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(2);
history.setNote("完成发货");
return history;
}).collect(Collectors.toList());
orderOperateHistoryDao.saveBatch(operateHistoryList);
return count;
}
@Override
public int close(List<Long> ids, String note) {
OmsOrder record = new OmsOrder();
record.setStatus(4);
int count = orderMapper.update(record, new QueryWrapper<OmsOrder>().eq("delete_status",0).in("id",ids));
List<OmsOrderOperateHistory> historyList = ids.stream().map(orderId -> {
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(orderId);
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(4);
history.setNote("订单关闭:" + note);
return history;
}).collect(Collectors.toList());
orderOperateHistoryDao.saveBatch(historyList);
return count;
}
@Override
public int updateReceiverInfo(OmsReceiverInfoParam receiverInfoParam) {
OmsOrder order = new OmsOrder();
order.setId(receiverInfoParam.getOrderId());
order.setReceiverName(receiverInfoParam.getReceiverName());
order.setReceiverPhone(receiverInfoParam.getReceiverPhone());
order.setReceiverPostCode(receiverInfoParam.getReceiverPostCode());
order.setReceiverDetailAddress(receiverInfoParam.getReceiverDetailAddress());
order.setReceiverProvince(receiverInfoParam.getReceiverProvince());
order.setReceiverCity(receiverInfoParam.getReceiverCity());
order.setReceiverRegion(receiverInfoParam.getReceiverRegion());
order.setModifyTime(new Date());
int count = orderMapper.updateById(order);
//插入操作记录
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(receiverInfoParam.getOrderId());
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(receiverInfoParam.getStatus());
history.setNote("修改收货人信息");
orderOperateHistoryMapper.insert(history);
return count;
}
@Override
public int updateMoneyInfo(OmsMoneyInfoParam moneyInfoParam) {
OmsOrder order = new OmsOrder();
order.setId(moneyInfoParam.getOrderId());
order.setFreightAmount(moneyInfoParam.getFreightAmount());
order.setDiscountAmount(moneyInfoParam.getDiscountAmount());
order.setModifyTime(new Date());
int count = orderMapper.updateById(order);
//插入操作记录
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(moneyInfoParam.getOrderId());
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(moneyInfoParam.getStatus());
history.setNote("修改费用信息");
orderOperateHistoryMapper.insert(history);
return count;
}
@Override
public int updateNote(Long id, String note, Integer status) {
OmsOrder order = new OmsOrder();
order.setId(id);
order.setNote(note);
order.setModifyTime(new Date());
int count = orderMapper.updateById(order);
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(id);
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(status);
history.setNote("修改备注信息:" + note);
orderOperateHistoryMapper.insert(history);
return count;
}
/**
* 计算购物车中商品的价格
*/
lsx202406
- 粉丝: 3046
- 资源: 5780
最新资源
- 基于S7-200 PLC的饮料灌装机控制系统详解:梯形图程序、接线图与IO配置全解析,基于S7-200 PLC饮料灌装机控制系统 带解释的梯形图程序,接线图原理图图纸,io分配,组态画面 ,基于S7
- jetty-javadoc-9.0.3-8.el7.x64-86.rpm.tar.gz
- 基于三菱PLC和MCGS的全方位音乐喷泉控制系统详解:梯形图程序、接线图与组态画面全解析,基于三菱PLC和MCGS组态音乐喷泉控制系统 带解释的梯形图程序,接线图原理图图纸,io分配,组态画面 ,核心
- jetty-jmx-9.0.3-8.el7.x64-86.rpm.tar.gz
- jetty-jndi-9.0.3-8.el7.x64-86.rpm.tar.gz
- 基于欧姆龙PLC的音乐喷泉精准控制系统设计:涵盖电气控制、梯形图程序、接线图与组态画面,基于欧姆龙PLC的花样喷泉控制系统设计喷泉电气控制设计音乐喷泉 带解释的梯形图程序,接线图原理图图纸,io分配
- "探究ABB变频器功率部分维修原理图:深入解析与操作指南",ABB变频器维修原理图 仅有功率部分,不含主板 ,核心关键词:ABB变频器;维修原理图;功率部分;不含主板;维修方法 ,"ABB变频
- jetty-jsp-9.0.3-8.el7.x64-86.rpm.tar.gz
- jetty-jspc-maven-plugin-9.0.3-8.el7.x64-86.rpm.tar.gz
- 发那科全系列系统调试维修手册:涵盖参数设定、编程操作、梯形图详解及手册大全,发那科0系统调试维修 0-M系统 0-T系统调试维修 0系统资料大全 参数 维修 编程操作 梯形图 等等手册 ,关键词:发
- jetty-maven-plugin-9.0.3-8.el7.x64-86.rpm.tar.gz
- jetty-monitor-9.0.3-8.el7.x64-86.rpm.tar.gz
- 基于TSN和802.1AS标准的纯逻辑时间同步系统:支持PTP v2 PTP over TSN仿真与文档详述,TSN 802.1AS 1588 时间同步 纯逻辑实现时间同步,支持1588,gpt
- jetty-parent-19-8.el7.x64-86.rpm.tar.gz
- 基于Matlab的通信信号调制识别数据集生成与性能分析代码,自动生成数据集、打标签、绘制训练策略与样本数量对比曲线,支持多种信号参数自定义与瑞利衰落信道模拟 ,通信信号调制识别所用数据集生成代码 Ma
- jetty-plus-9.0.3-8.el7.x64-86.rpm.tar.gz
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈