修复空指针 bug,店铺管理员同步到账号时,初始化店铺配置
This commit is contained in:
parent
5a40e0ad27
commit
c096bf4334
@ -1700,7 +1700,9 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
throw new ApiException(_("请输入账号"));
|
||||
}
|
||||
|
||||
String user_password = (String) userInfo.get("user_password");
|
||||
// 原始明文密码
|
||||
String user_password_src = (String) userInfo.get("user_password");
|
||||
String user_password = user_password_src;
|
||||
if (StrUtil.isBlank(user_password)) {
|
||||
throw new ApiException(_("请输入密码"));
|
||||
}
|
||||
@ -1738,7 +1740,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
if (CommonConstant.USER_TYPE_MCH.equals(userIsAdmin)) {
|
||||
user_base_reg_row.setRights_group_id("2,24");// 店铺管理员,店铺 权限
|
||||
}
|
||||
|
||||
|
||||
if (!saveOrUpdate(user_base_reg_row)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
}
|
||||
@ -1860,6 +1862,13 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
addChannelSourceUserId(user_id, source_ucc_code);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(user_mobile) && userIsAdmin.equals(CommonConstant.USER_TYPE_MCH)) {
|
||||
// 如果是商家首次注册 SMS_481085172 发送短信通知用户,告知用户随机密码:您已成功注册!密码:${password},该密码可用于登录商家APP,登录后请尽快修改密码。
|
||||
Map<String, Object> smsArgs = new HashMap<>();
|
||||
smsArgs.put("password", user_password_src);
|
||||
sendSmsMessage(PhoneNumberUtils.cleanPhoneNumber(user_mobile), "SMS_481085172", smsArgs);
|
||||
}
|
||||
|
||||
//初次注册发送消息
|
||||
String message_id = "registration-of-welcome-information";
|
||||
HashMap<String, Object> args = new HashMap<>();
|
||||
@ -2850,11 +2859,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
if (accountUserBase == null) {
|
||||
throw new ApiException(_("账号注册失败!"));
|
||||
}
|
||||
|
||||
// SMS_481085172 发送短信通知用户,告知用户随机密码:您已成功注册!密码:${password},该密码可用于登录商家APP,登录后请尽快修改密码。
|
||||
Map<String, Object> smsArgs = new HashMap<>();
|
||||
smsArgs.put("password", user_password);
|
||||
sendSmsMessage(user_mobile, "SMS_481085172", smsArgs);
|
||||
}
|
||||
|
||||
Map<String, String> params = new HashMap<>();
|
||||
|
||||
@ -20,6 +20,7 @@ import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ -38,6 +39,10 @@ public class MchOrderInfoDTO implements Serializable {
|
||||
// 顺丰同城配送信息
|
||||
MchSFOrderDTO sf_order_info;
|
||||
|
||||
// 物流轨迹信息(物流,已发货的才有数据)
|
||||
@ApiModelProperty(value = "物流轨迹信息")
|
||||
Map<String, Object> logistics_traces;
|
||||
|
||||
// 订单信息
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
private String order_id;
|
||||
|
||||
@ -10,6 +10,8 @@ import com.suisung.mall.common.constant.AuthConstant;
|
||||
import com.suisung.mall.common.domain.UserDto;
|
||||
import com.suisung.mall.common.exception.ApiException;
|
||||
import com.suisung.mall.common.pojo.vo.UserLoginVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -20,6 +22,7 @@ import java.text.ParseException;
|
||||
*/
|
||||
public class UserInfoService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(UserInfoService.class);
|
||||
private final HttpServletRequest request;
|
||||
|
||||
public UserInfoService(HttpServletRequest request) {
|
||||
@ -27,29 +30,35 @@ public class UserInfoService {
|
||||
}
|
||||
|
||||
public synchronized UserDto getUser() {
|
||||
String userStr = null;
|
||||
String userStr;
|
||||
try {
|
||||
// 当使用定时器业务中调用该方法会报错,用户信息着直接返回 null
|
||||
// 从请求头中获取用户信息
|
||||
userStr = this.request.getHeader(AuthConstant.USER_TOKEN_HEADER);
|
||||
// 上传文件不会进入AuthGlobalFilter,所以Header中并没有user,ByteArrayUtil.hexStringToByteArray(null)时会抛异常
|
||||
if (StrUtil.isNotBlank(userStr)) {
|
||||
// 将十六进制字符串转换为字节数组
|
||||
byte[] bytes = ByteArrayUtil.hexStringToByteArray(userStr);
|
||||
// 将字节数组转换为字符串
|
||||
userStr = new String(bytes, StandardCharsets.UTF_8);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
} catch (NullPointerException | IllegalArgumentException e) {
|
||||
// 处理请求头为空或其他空指针异常
|
||||
log.error("请求头中获取用户信息失败!", e);
|
||||
userStr = null;
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(userStr)) {
|
||||
return getUserByToken();
|
||||
// 将 JSON 字符串转换为 UserDto 对象
|
||||
return JSONUtil.toBean(userStr, UserDto.class);
|
||||
}
|
||||
|
||||
return StrUtil.isBlank(userStr) ? new UserDto() : JSONUtil.toBean(userStr, UserDto.class);
|
||||
// 如果 userStr 为空,尝试通过 token 获取用户信息
|
||||
return getUserByToken();
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
UserDto user = getUser();
|
||||
return ObjectUtil.isNotNull(user) ? user.getId() : null;
|
||||
return ObjectUtil.isNotEmpty(user) ? user.getId() : null;
|
||||
}
|
||||
|
||||
private UserDto getUserByToken() {
|
||||
|
||||
@ -19,12 +19,6 @@
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org</groupId>
|
||||
<artifactId>jaudiotagger</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mp3文件支持(如语音时长)-->
|
||||
<dependency>
|
||||
<groupId>org</groupId>
|
||||
|
||||
@ -9,9 +9,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/**
|
||||
* @program: mall-suite
|
||||
* @description:
|
||||
@ -27,15 +24,14 @@ public class KdApiExpressSearchController {
|
||||
private KdApiExpressSearchService kdApiExpressSearchService;
|
||||
|
||||
@RequestMapping(value = "/viewLogistics", method = RequestMethod.POST)
|
||||
public CommonResult select(@RequestParam String order_id, @RequestParam String stock_bill_id) throws UnsupportedEncodingException, NoSuchAlgorithmException {
|
||||
|
||||
public CommonResult select(@RequestParam String order_id, @RequestParam String stock_bill_id) {
|
||||
return kdApiExpressSearchService.select(order_id, stock_bill_id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/returnlogistics", method = RequestMethod.POST)
|
||||
public CommonResult returnLogistics(@RequestParam String return_tracking_name,
|
||||
@RequestParam String return_tracking_number,
|
||||
@RequestParam(value = "order_id", required = false) String order_id) throws UnsupportedEncodingException, NoSuchAlgorithmException {
|
||||
@RequestParam(value = "order_id", required = false) String order_id) {
|
||||
|
||||
return kdApiExpressSearchService.returnLogistics(return_tracking_name, return_tracking_number, order_id);
|
||||
}
|
||||
|
||||
@ -2,9 +2,6 @@ package com.suisung.mall.shop.api.service;
|
||||
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -17,13 +14,13 @@ public interface KdApiExpressSearchService {
|
||||
|
||||
CommonResult select(String order_id, String stock_bill_id);
|
||||
|
||||
CommonResult returnLogistics(String return_tracking_name, String return_tracking_number, String order_id) throws UnsupportedEncodingException, NoSuchAlgorithmException;
|
||||
CommonResult returnLogistics(String return_tracking_name, String return_tracking_number, String order_id);
|
||||
|
||||
/**
|
||||
* 根据订单号,获取快递鸟的物流轨迹(注意)
|
||||
* 根据订单Id,获取物流轨迹
|
||||
*
|
||||
* @param order_id
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getLogisticsTraces(String order_id);
|
||||
Map<String, Object> getLogisticsTraces(String orderId);
|
||||
}
|
||||
|
||||
@ -33,7 +33,6 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -223,65 +222,65 @@ public class KdApiExpressSearchServiceImpl implements KdApiExpressSearchService
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, Object>> getLogisticsTraces(String order_id) {
|
||||
/**
|
||||
* 根据订单Id,获取物流轨迹
|
||||
*
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getLogisticsTraces(String orderId) {
|
||||
QueryWrapper<ShopOrderLogistics> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_id", order_id);
|
||||
queryWrapper.eq("order_id", orderId);
|
||||
queryWrapper.eq("logistics_enable", CommonConstant.Enable);
|
||||
|
||||
List<ShopOrderLogistics> shopOrderLogistics = shopOrderLogisticsService.find(queryWrapper);
|
||||
if (CollUtil.isEmpty(shopOrderLogistics)) {
|
||||
ShopOrderLogistics shopOrderLogistic = shopOrderLogisticsService.findOne(queryWrapper);
|
||||
if (ObjectUtil.isEmpty(shopOrderLogistic)) {
|
||||
logger.warn(I18nUtil._("未找到发货记录"));
|
||||
return null;
|
||||
}
|
||||
|
||||
ShopOrderDeliveryAddress orderDeliveryAddress = shopOrderDeliveryAddressService.get(order_id);
|
||||
String phone_number;
|
||||
try {
|
||||
phone_number = orderDeliveryAddress.getDa_mobile().substring(7, 11); // 手机号码末尾4位数
|
||||
} catch (Exception e) {
|
||||
logger.info(I18nUtil._("收货信息中手机号填写错误"));
|
||||
ShopOrderDeliveryAddress orderDeliveryAddress = shopOrderDeliveryAddressService.get(orderId);
|
||||
String phone_number = orderDeliveryAddress.getDa_mobile();
|
||||
if (StrUtil.isBlank(phone_number) || phone_number.length() < 11) {
|
||||
throw new ApiException(I18nUtil._("收货信息中手机号有误"));
|
||||
}
|
||||
phone_number = orderDeliveryAddress.getDa_mobile().substring(7, 11); // 手机号码末尾4位数
|
||||
|
||||
Map<String, Object> resultMap = new HashMap();
|
||||
String order_tracking_number = shopOrderLogistic.getOrder_tracking_number(); // 物流运单号
|
||||
String logistics_info_str = orderOnlineByJson(order_tracking_number, shopOrderLogistic.getLogistics_number(), phone_number);
|
||||
if (StrUtil.isBlank(logistics_info_str)) {
|
||||
logger.info(I18nUtil._("物流信息获取失败"));
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Map<String, Object>> retList = new ArrayList<>();
|
||||
for (ShopOrderLogistics shopOrderLogistic : shopOrderLogistics) {
|
||||
Map<String, Object> resultMap = new HashMap();
|
||||
String order_tracking_number = shopOrderLogistic.getOrder_tracking_number(); // 物流运单号
|
||||
String logistics_info_str = orderOnlineByJson(order_tracking_number, shopOrderLogistic.getLogistics_number(), phone_number);
|
||||
if (StrUtil.isBlank(logistics_info_str)) {
|
||||
logger.info(I18nUtil._("物流信息获取失败"));
|
||||
continue;
|
||||
}
|
||||
|
||||
JSONObject logistics_info = JSONUtil.parseObj(logistics_info_str);
|
||||
if (ObjectUtil.isNull(logistics_info)) {
|
||||
logger.info(I18nUtil._("转换物流信息获取失败"));
|
||||
continue;
|
||||
}
|
||||
String StateEx = (String) logistics_info.get("StateEx");
|
||||
Integer state = logistics_info.get("State", Integer.class);
|
||||
if (state == null || state.equals(0)) {
|
||||
String reason = logistics_info.get("Reason", String.class);
|
||||
logger.info(I18nUtil._("非系统错误,请联系管理员检查物流配置项,或检查发货信息是否真实有效!错误信息:{" + reason + "}"));
|
||||
continue;
|
||||
}
|
||||
|
||||
resultMap.put("shipperCode", logistics_info.get("ShipperCode"));
|
||||
resultMap.put("logisticCode", logistics_info.get("LogisticCode"));
|
||||
resultMap.put("state", logistics_info.get("State"));
|
||||
resultMap.put("stateEx", StateEx);
|
||||
resultMap.put("express_state", stateMap.get(StateEx));
|
||||
resultMap.put("traces", logistics_info.get("Traces"));
|
||||
|
||||
retList.add(resultMap);
|
||||
JSONObject logistics_info = JSONUtil.parseObj(logistics_info_str);
|
||||
if (ObjectUtil.isNull(logistics_info)) {
|
||||
logger.info(I18nUtil._("转换物流信息获取失败"));
|
||||
return null;
|
||||
}
|
||||
String StateEx = (String) logistics_info.get("StateEx");
|
||||
Integer state = logistics_info.get("State", Integer.class);
|
||||
if (state == null || state.equals(0)) {
|
||||
String reason = logistics_info.get("Reason", String.class);
|
||||
logger.info(I18nUtil._("非系统错误,请联系管理员检查物流配置项,或检查发货信息是否真实有效!错误信息:{" + reason + "}"));
|
||||
return null;
|
||||
}
|
||||
|
||||
return retList;
|
||||
resultMap.put("shipperCode", logistics_info.get("ShipperCode"));
|
||||
resultMap.put("logisticCode", logistics_info.get("LogisticCode"));
|
||||
resultMap.put("state", logistics_info.get("State"));
|
||||
resultMap.put("stateEx", StateEx);
|
||||
resultMap.put("express_state", stateMap.get(StateEx));
|
||||
resultMap.put("traces", logistics_info.get("Traces"));
|
||||
|
||||
return resultMap;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult returnLogistics(String return_tracking_name, String return_tracking_number, String order_id) throws UnsupportedEncodingException, NoSuchAlgorithmException {
|
||||
public CommonResult returnLogistics(String return_tracking_name, String return_tracking_number, String order_id) {
|
||||
QueryWrapper<ShopBaseExpress> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("express_name", return_tracking_name);
|
||||
ShopBaseExpress shopBaseExpress = shopBaseExpressService.findOne(wrapper);
|
||||
|
||||
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.suisung.mall.common.modules.order.ShopOrderInfo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 订单信息表 Mapper 接口
|
||||
@ -16,4 +18,21 @@ import org.springframework.stereotype.Repository;
|
||||
@Repository
|
||||
public interface ShopOrderInfoMapper extends BaseMapper<ShopOrderInfo> {
|
||||
|
||||
/**
|
||||
* 根据订单Id、订单状态、配送方式、退款状态 获取订单的数量
|
||||
*
|
||||
* @param storeId 店铺Id
|
||||
* @param orderStatusIdList 订单状态:
|
||||
* // orderstatus 订单状态:2010-ORDER_STATE_WAIT_PAY待付款;2011-ORDER_STATE_WAIT_REVIEW待订单审核;
|
||||
* // 2013-ORDER_STATE_WAIT_FINANCE_REVIEW待财务审核;2014-待配货/待出库审核;
|
||||
* // 2020-ORDER_STATE_PICKING待配货;2030-ORDER_STATE_WAIT_SHIPPING待发货/待收货确认;
|
||||
* // 2040-已发货/待收货确认;2050-ORDER_STATE_RECEIVED已签收;2060-ORDER_STATE_FINISH已完成/已签收;
|
||||
* // 2070-ORDER_STATE_CANCEL已取消/已作废;2080-ORDER_STATE_SELF_PICKUP自提
|
||||
* @param orderRefundStatusIdList 退款状态:0-是无退款;1-是部分退款;2-是全部退款
|
||||
* @param deliveryTypeList 配送方式
|
||||
* @param expireSeconds 过期时间,单位秒 默认60*20=120秒
|
||||
* @return
|
||||
*/
|
||||
Long getOrderCountByStoreId(Integer storeId, List<Integer> orderStatusIdList, List<Integer> orderRefundStatusIdList, List<Integer> deliveryTypeList, Long expireSeconds);
|
||||
|
||||
}
|
||||
|
||||
@ -53,4 +53,21 @@ public interface ShopOrderInfoService extends IBaseService<ShopOrderInfo> {
|
||||
*/
|
||||
Long isPaidOrderGenPickNumAndPrint(Integer storeId, String orderId);
|
||||
|
||||
/**
|
||||
* 根据订单Id、订单状态、配送方式、退款状态 获取订单的数量
|
||||
*
|
||||
* @param storeId 店铺Id
|
||||
* @param orderStatusIdList 订单状态:
|
||||
* // orderstatus 订单状态:2010-ORDER_STATE_WAIT_PAY待付款;2011-ORDER_STATE_WAIT_REVIEW待订单审核;
|
||||
* // 2013-ORDER_STATE_WAIT_FINANCE_REVIEW待财务审核;2014-待配货/待出库审核;
|
||||
* // 2020-ORDER_STATE_PICKING待配货;2030-ORDER_STATE_WAIT_SHIPPING待发货/待收货确认;
|
||||
* // 2040-已发货/待收货确认;2050-ORDER_STATE_RECEIVED已签收;2060-ORDER_STATE_FINISH已完成/已签收;
|
||||
* // 2070-ORDER_STATE_CANCEL已取消/已作废;2080-ORDER_STATE_SELF_PICKUP自提
|
||||
* @param orderRefundStatusIdList 退款状态:0-是无退款;1-是部分退款;2-是全部退款
|
||||
* @param deliveryTypeList 配送方式
|
||||
* @param expireSeconds 过期时间,单位秒 默认60*20=120秒
|
||||
* @return
|
||||
*/
|
||||
Long getOrderCountByStoreId(Integer storeId, List<Integer> orderStatusIdList, List<Integer> orderRefundStatusIdList, List<Integer> deliveryTypeList, Long expireSeconds);
|
||||
|
||||
}
|
||||
|
||||
@ -67,6 +67,7 @@ import com.suisung.mall.common.service.MessageService;
|
||||
import com.suisung.mall.common.utils.*;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.activity.service.*;
|
||||
import com.suisung.mall.shop.api.service.KdApiExpressSearchService;
|
||||
import com.suisung.mall.shop.base.service.*;
|
||||
import com.suisung.mall.shop.chain.service.ShopChainBaseService;
|
||||
import com.suisung.mall.shop.chain.service.ShopChainItemService;
|
||||
@ -103,6 +104,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -285,6 +287,9 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
private ShopMessageTemplateService shopMessageTemplateService;
|
||||
@Autowired
|
||||
private ShopStoreSfOrderService shopStoreSfOrderService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private KdApiExpressSearchService kdApiExpressSearchService;
|
||||
|
||||
|
||||
@Value("${sf-express.enable}")
|
||||
@ -8499,7 +8504,23 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
if (expiredMinute == null || expiredMinute <= 0) {
|
||||
expiredMinute = 20;
|
||||
}
|
||||
return shopOrderBaseMapper.selectMchOrderPageList(storeId, keyword, delivery, status, expiredMinute, page);
|
||||
|
||||
|
||||
IPage<MchOrderInfoDTO> pageList = shopOrderBaseMapper.selectMchOrderPageList(storeId, keyword, delivery, status, expiredMinute, page);
|
||||
if (pageList != null && CollUtil.isNotEmpty(pageList.getRecords())) {
|
||||
pageList.getRecords().forEach(mchOrderInfoDTO -> {
|
||||
if ((StateCode.DELIVERY_TYPE_EXP == mchOrderInfoDTO.getDelivery_type_id()
|
||||
|| StateCode.DELIVERY_TYPE_EXP == mchOrderInfoDTO.getDelivery_type_id())
|
||||
&& (mchOrderInfoDTO.getOrder_state_id() == StateCode.ORDER_STATE_FINISH
|
||||
|| mchOrderInfoDTO.getOrder_state_id() == StateCode.ORDER_STATE_SHIPPED)
|
||||
) {
|
||||
// 发快递普通物流的物流轨迹
|
||||
mchOrderInfoDTO.setLogistics_traces(kdApiExpressSearchService.getLogisticsTraces(mchOrderInfoDTO.getOrder_id()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -8516,30 +8537,153 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
// refundstatus 退款状态:0-是无退款;1-是部分退款;2-是全部退款
|
||||
// orderstatus 订单状态:2010-ORDER_STATE_WAIT_PAY待付款;2011-ORDER_STATE_WAIT_REVIEW待订单审核;
|
||||
// 2013-ORDER_STATE_WAIT_FINANCE_REVIEW待财务审核;2014-待配货/待出库审核;
|
||||
// 2020-ORDER_STATE_PICKING待配货;2030-ORDER_STATE_WAIT_SHIPPING待发货/待收货确认;
|
||||
// 2040-已发货/待收货确认;2050-ORDER_STATE_RECEIVED已签收;2060-ORDER_STATE_FINISH已完成/已签收;
|
||||
// 2070-ORDER_STATE_CANCEL已取消/已作废;2080-ORDER_STATE_SELF_PICKUP自提
|
||||
// 全部订单总数量
|
||||
jsonObject.put("all_order_count", 100);
|
||||
jsonObject.put("all_order_count", shopOrderInfoService.getOrderCountByStoreId(storeId, null, null, null, null));
|
||||
|
||||
// 同城配送订单总数量
|
||||
jsonObject.put("same_city_order_count", 30);
|
||||
jsonObject.put("same_city_order_count", shopOrderInfoService.getOrderCountByStoreId(storeId, null, null, new ArrayList<Integer>() {{
|
||||
add(StateCode.DELIVERY_TYPE_SAME_CITY);
|
||||
}},
|
||||
null
|
||||
));
|
||||
// 同城配送进行中订单数量
|
||||
jsonObject.putByPath("all_same_city_order.progress_count", 12);
|
||||
jsonObject.putByPath("same_city_order.progress_count", shopOrderInfoService.getOrderCountByStoreId(storeId,
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.ORDER_STATE_WAIT_REVIEW);
|
||||
add(StateCode.ORDER_STATE_WAIT_FINANCE_REVIEW);
|
||||
add(StateCode.ORDER_STATE_WAIT_PAID);
|
||||
add(StateCode.ORDER_STATE_PICKING);
|
||||
add(StateCode.ORDER_STATE_WAIT_SHIPPING);
|
||||
add(StateCode.ORDER_STATE_SHIPPED);
|
||||
}},
|
||||
|
||||
new ArrayList<Integer>() {{
|
||||
add(0);
|
||||
}},
|
||||
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.DELIVERY_TYPE_SAME_CITY);
|
||||
}},
|
||||
null
|
||||
));
|
||||
// 同城配送超时订单数量
|
||||
jsonObject.putByPath("same_city_order.overtime_count", 8);
|
||||
jsonObject.putByPath("same_city_order.overtime_count", shopOrderInfoService.getOrderCountByStoreId(storeId,
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.ORDER_STATE_WAIT_REVIEW);
|
||||
add(StateCode.ORDER_STATE_WAIT_FINANCE_REVIEW);
|
||||
add(StateCode.ORDER_STATE_WAIT_PAID);
|
||||
add(StateCode.ORDER_STATE_PICKING);
|
||||
add(StateCode.ORDER_STATE_WAIT_SHIPPING);
|
||||
add(StateCode.ORDER_STATE_SHIPPED);
|
||||
}},
|
||||
|
||||
new ArrayList<Integer>() {{
|
||||
add(0);
|
||||
}},
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.DELIVERY_TYPE_SAME_CITY);
|
||||
}},
|
||||
120L
|
||||
));
|
||||
|
||||
// 同城配送退款订单数量
|
||||
jsonObject.putByPath("same_city_order.refund_count", 10);
|
||||
jsonObject.putByPath("same_city_order.refund_count", shopOrderInfoService.getOrderCountByStoreId(storeId,
|
||||
null,
|
||||
new ArrayList<Integer>() {{
|
||||
add(1);
|
||||
add(2);
|
||||
}},
|
||||
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.DELIVERY_TYPE_SAME_CITY);
|
||||
}},
|
||||
null
|
||||
));
|
||||
|
||||
|
||||
// 普通物流订单总数量
|
||||
jsonObject.put("logistics_order_count", 10);
|
||||
// 普通物流订单总数量
|
||||
jsonObject.putByPath("logistics_order.progress_count", 5);
|
||||
// 普通物流订单总数量
|
||||
jsonObject.putByPath("logistics_order.overtime_count", 1);
|
||||
// 普通物流订单总数量
|
||||
jsonObject.putByPath("logistics_order.refund_count", 2);
|
||||
// 普通物流订单总数量
|
||||
jsonObject.putByPath("logistics_order.refund_count", 2);
|
||||
jsonObject.put("logistics_order_count", shopOrderInfoService.getOrderCountByStoreId(storeId, null, null, new ArrayList<Integer>() {{
|
||||
add(StateCode.DELIVERY_TYPE_EXPRESS);
|
||||
add(StateCode.DELIVERY_TYPE_EXP);
|
||||
}},
|
||||
null
|
||||
));
|
||||
// 普通物流待支付订单数量
|
||||
jsonObject.putByPath("logistics_order.wait_pay_count", shopOrderInfoService.getOrderCountByStoreId(storeId,
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.ORDER_STATE_WAIT_PAY);
|
||||
}},
|
||||
|
||||
// todo 预订单数量相关数量
|
||||
new ArrayList<Integer>() {{
|
||||
add(0);
|
||||
}},
|
||||
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.DELIVERY_TYPE_EXPRESS);
|
||||
add(StateCode.DELIVERY_TYPE_EXP);
|
||||
}},
|
||||
null
|
||||
));
|
||||
// 普通物流待发货订单数量
|
||||
jsonObject.putByPath("logistics_order.wait_shipping_count", shopOrderInfoService.getOrderCountByStoreId(storeId,
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.ORDER_STATE_WAIT_REVIEW);
|
||||
add(StateCode.ORDER_STATE_WAIT_FINANCE_REVIEW);
|
||||
add(StateCode.ORDER_STATE_WAIT_PAID);
|
||||
add(StateCode.ORDER_STATE_PICKING);
|
||||
add(StateCode.ORDER_STATE_WAIT_SHIPPING);
|
||||
}},
|
||||
|
||||
new ArrayList<Integer>() {{
|
||||
add(0);
|
||||
}},
|
||||
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.DELIVERY_TYPE_EXPRESS);
|
||||
add(StateCode.DELIVERY_TYPE_EXP);
|
||||
}},
|
||||
null
|
||||
));
|
||||
// 普通物流待收货订单数量
|
||||
jsonObject.putByPath("logistics_order.receiving_count", shopOrderInfoService.getOrderCountByStoreId(storeId,
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.ORDER_STATE_SHIPPED);
|
||||
}},
|
||||
|
||||
new ArrayList<Integer>() {{
|
||||
add(0);
|
||||
}},
|
||||
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.DELIVERY_TYPE_EXPRESS);
|
||||
add(StateCode.DELIVERY_TYPE_EXP);
|
||||
}},
|
||||
null
|
||||
));
|
||||
// 普通物流已完成订单数量
|
||||
jsonObject.putByPath("logistics_order.finished_count", shopOrderInfoService.getOrderCountByStoreId(storeId,
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.ORDER_STATE_RECEIVED);
|
||||
add(StateCode.ORDER_STATE_FINISH);
|
||||
}},
|
||||
|
||||
new ArrayList<Integer>() {{
|
||||
add(0);
|
||||
}},
|
||||
new ArrayList<Integer>() {{
|
||||
add(StateCode.DELIVERY_TYPE_EXPRESS);
|
||||
add(StateCode.DELIVERY_TYPE_EXP);
|
||||
}},
|
||||
null
|
||||
));
|
||||
|
||||
// todo 预订单数量相关数
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@ -41,7 +41,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@ -61,62 +60,46 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||
@Service
|
||||
public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMapper, ShopOrderInfo> implements ShopOrderInfoService {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ShopOrderInfoServiceImpl.class);
|
||||
@Autowired
|
||||
private ShopOrderBaseService shopOrderBaseService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductBaseService shopProductBaseService;
|
||||
|
||||
@Autowired
|
||||
private ShopDistributionUserWithdrawService shopDistributionUserWithdrawService;
|
||||
|
||||
@Autowired
|
||||
private ShopOrderReturnService shopOrderReturnService;
|
||||
|
||||
@Autowired
|
||||
private ShopStoreBaseService shopStoreBaseService;
|
||||
|
||||
@Autowired
|
||||
private ShopDistributionUserCommissionService shopDistributionUserCommissionService;
|
||||
|
||||
@Autowired
|
||||
private AccountBaseConfigService accountBaseConfigService;
|
||||
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private PayService payService;
|
||||
|
||||
@Autowired
|
||||
private SnsService snsService;
|
||||
|
||||
@Autowired
|
||||
private ShopPlantformActivityItemService shopPlantformActivityItemService;
|
||||
|
||||
@Autowired
|
||||
private ShopPlantformFeedbackService shopPlantformFeedbackService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductCommentService shopProductCommentService;
|
||||
|
||||
@Autowired
|
||||
private ShopOrderInvoiceService shopOrderInvoiceService;
|
||||
|
||||
@Autowired
|
||||
private ShopOrderStateLogService shopOrderStateLogService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseStateCodeService shopBaseStateCodeService;
|
||||
|
||||
@Autowired
|
||||
private ShopStorePrinterService shopStorePrinterService;
|
||||
|
||||
@Autowired
|
||||
private ShopOrderInfoMapper shopOrderInfoMapper;
|
||||
@Autowired
|
||||
private ThreadPoolExecutor executor;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ShopOrderInfoServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public Map dashboard() {
|
||||
|
||||
@ -339,6 +322,30 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
return orderPickupNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单Id、订单状态、配送方式、退款状态 获取订单的数量
|
||||
*
|
||||
* @param storeId 店铺Id
|
||||
* @param orderStatusIdList 订单状态:
|
||||
* // orderstatus 订单状态:2010-ORDER_STATE_WAIT_PAY待付款;2011-ORDER_STATE_WAIT_REVIEW待订单审核;
|
||||
* // 2013-ORDER_STATE_WAIT_FINANCE_REVIEW待财务审核;2014-待配货/待出库审核;
|
||||
* // 2020-ORDER_STATE_PICKING待配货;2030-ORDER_STATE_WAIT_SHIPPING待发货/待收货确认;
|
||||
* // 2040-已发货/待收货确认;2050-ORDER_STATE_RECEIVED已签收;2060-ORDER_STATE_FINISH已完成/已签收;
|
||||
* // 2070-ORDER_STATE_CANCEL已取消/已作废;2080-ORDER_STATE_SELF_PICKUP自提
|
||||
* @param orderRefundStatusIdList 退款状态:0-是无退款;1-是部分退款;2-是全部退款
|
||||
* @param deliveryTypeList 配送方式
|
||||
* @param expireSeconds 过期时间,单位秒 默认60*20=120秒
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Long getOrderCountByStoreId(Integer storeId, List<Integer> orderStatusIdList, List<Integer> orderRefundStatusIdList, List<Integer> deliveryTypeList, Long expireSeconds) {
|
||||
if (ObjectUtil.isEmpty(storeId)) {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
return shopOrderInfoMapper.getOrderCountByStoreId(storeId, orderStatusIdList, orderRefundStatusIdList, deliveryTypeList, expireSeconds);
|
||||
}
|
||||
|
||||
// todo 优化多次远程查询
|
||||
private Map dashboardPlantform() {
|
||||
List<Integer> order_state = Arrays.asList(
|
||||
|
||||
@ -1452,12 +1452,19 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
store_id = Convert.toInt(user.getStore_id());
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(store_id)) {
|
||||
logger.warn("店铺Id:{} 空值,无法获取店铺数据!", store_id);
|
||||
return new HashMap();
|
||||
}
|
||||
|
||||
Map row = getStoreInfo(store_id);
|
||||
ShopStoreConfig storeConfig = shopStoreConfigService.get(store_id);
|
||||
row.put("sc_is_enabled_invoice", Convert.toBool(storeConfig.getSc_is_enabled_invoice()));
|
||||
if (ObjectUtil.isNotEmpty(storeConfig)) {
|
||||
row.put("sc_is_enabled_invoice", Convert.toBool(storeConfig.getSc_is_enabled_invoice()));
|
||||
}
|
||||
row = accountService.fixUserAvatar(row, true);
|
||||
|
||||
if (!user.isPlatform()) {
|
||||
if (user != null && !user.isPlatform()) {
|
||||
if (!CheckUtil.checkDataRights(store_id, row, "store_id")) {
|
||||
return new HashMap();
|
||||
}
|
||||
@ -3249,6 +3256,57 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
throw new ApiException(I18nUtil._("店铺关联到用户失败"));
|
||||
}
|
||||
}
|
||||
|
||||
// 店铺配置
|
||||
ShopStoreConfig shopStoreConfig = new ShopStoreConfig();
|
||||
shopStoreConfig.setStore_id(storeId);
|
||||
List<Integer> sc_order_process = Arrays.asList(StateCode.ORDER_PROCESS_PAY,
|
||||
//支付
|
||||
StateCode.ORDER_PROCESS_OUT, //出库审核
|
||||
StateCode.ORDER_PROCESS_SHIPPED,
|
||||
//发货确认
|
||||
StateCode.ORDER_PROCESS_RECEIVED);
|
||||
|
||||
String str_sc_order_process = CollUtil.join(sc_order_process, ",");
|
||||
shopStoreConfig.setSc_order_process(str_sc_order_process);
|
||||
|
||||
List<Integer> sc_order_return_process = Arrays.asList(
|
||||
StateCode.RETURN_PROCESS_SUBMIT,
|
||||
//【客户】提交退单1ReturnReturn
|
||||
StateCode.RETURN_PROCESS_CHECK,
|
||||
//退单审核1ReturnReturn
|
||||
StateCode.RETURN_PROCESS_FINISH
|
||||
//完成1ReturnReturn3130-商家拒绝退货
|
||||
);
|
||||
|
||||
String str_sc_order_return_process = CollUtil.join(sc_order_return_process, ",");
|
||||
shopStoreConfig.setSc_order_return_process(str_sc_order_return_process); // 退货流程设置(DOT)
|
||||
shopStoreConfig.setSc_settle_circle(30);
|
||||
shopStoreConfig.setSc_settle_last_time(System.currentTimeMillis());
|
||||
shopStoreConfig.setSc_settle_next_time(Convert.toLong(DateUtil.nextMonth()));
|
||||
shopStoreConfig.setSc_start_distance(BigDecimal.ZERO);
|
||||
shopStoreConfig.setSc_festival_name("");
|
||||
shopStoreConfig.setSc_festival_start("");
|
||||
shopStoreConfig.setSc_festival_end("");
|
||||
shopStoreConfig.setSc_start_amount(BigDecimal.ZERO);
|
||||
shopStoreConfig.setSc_extra_amount(BigDecimal.ZERO);
|
||||
shopStoreConfig.setSc_festival_amount_down(BigDecimal.ZERO);
|
||||
shopStoreConfig.setSc_festival_amount_upper(BigDecimal.ZERO);
|
||||
shopStoreConfig.setSc_festival_float_proportion(BigDecimal.ZERO);
|
||||
|
||||
if (!shopStoreConfigService.saveOrUpdate(shopStoreConfig)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
}
|
||||
|
||||
InvoicingCustomerLevel invoicingCustomerLevel = new InvoicingCustomerLevel();
|
||||
invoicingCustomerLevel.setCustomer_level_name(I18nUtil._("普通(系统默认,不可删除)"));
|
||||
invoicingCustomerLevel.setCustomer_level_discountrate(new BigDecimal("100"));
|
||||
invoicingCustomerLevel.setCustomer_level_is_buildin(1);
|
||||
invoicingCustomerLevel.setCustomer_level_desc("");
|
||||
|
||||
if (!invoicingCustomerLevelService.saveOrUpdate(invoicingCustomerLevel)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.suisung.mall.shop.order.mapper.ShopOrderInfoMapper">
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
order_id, order_title, store_id, subsite_id, buyer_user_id, kind_id, order_lock_status, order_is_settlemented,
|
||||
order_id
|
||||
, order_title, store_id, subsite_id, buyer_user_id, kind_id, order_lock_status, order_is_settlemented,
|
||||
order_settlement_time, order_buyer_evaluation_status, order_seller_evaluation_status, order_year, order_month,
|
||||
order_day, order_time, order_deal_time, order_buyer_hidden, order_shop_hidden, payment_type_id, payment_time,
|
||||
order_state_id, order_is_review, order_finance_review, order_is_paid, order_is_out, order_is_shipped,
|
||||
@ -14,4 +14,34 @@
|
||||
order_fx_is_settlemented, order_fx_settlement_time, order_pickup_num
|
||||
</sql>
|
||||
|
||||
<!--// refundstatus 退款状态:0-是无退款;1-是部分退款;2-是全部退款
|
||||
// orderstatus 订单状态:2010-待付款;2011-待订单审核;2012-待发货;2013-待财务审核;2014-待配货/待出库审核;2020-待发货;2030-待发货/待收货确认;2040-已发货/待收货确认;2050-已签收;2060-已完成/已签收;2070-已取消/已作废;2080-自提-->
|
||||
<select id="getOrderCountByStoreId" resultType="long">
|
||||
SELECT count(*)
|
||||
FROM shop_order_info a
|
||||
JOIN shop_order_data b on a.order_id=b.order_id
|
||||
WHERE a.store_id=#{storeId}
|
||||
<if test="orderStatusIdList!=null and orderStatusIdList.size()>0">
|
||||
AND a.order_state_id IN
|
||||
<foreach collection="orderStatusIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="orderRefundStatusIdList!=null and orderRefundStatusIdList.size()>0">
|
||||
AND b.order_refund_status IN
|
||||
<foreach collection="orderRefundStatusIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="deliveryTypeList!=null and deliveryTypeList.size()>0">
|
||||
AND a.delivery_type_id IN
|
||||
<foreach collection="deliveryTypeList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- 过期的订单-->
|
||||
<if test="expireSeconds!=null and expireSeconds>0">
|
||||
AND a.order_time + #{expireSeconds}*1000 <![CDATA[<=]]> UNIX_TIMESTAMP() * 1000
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user