## Feat - 增加新零售
This commit is contained in:
parent
d701ccab8e
commit
874de9a513
|
@ -54,7 +54,7 @@ public class TestController {
|
|||
if(CollUtil.isNotEmpty(dsList)){
|
||||
for (String dsKey : dsList) {
|
||||
DynamicDataSourceContextHolder.push(dsKey);
|
||||
StatisticsVO statisticsVO = sendMsgService.getStatistics();
|
||||
StatisticsVO statisticsVO = sendMsgService.getStatistics(dsKey);
|
||||
statisticsVO.setDsKey(dsKey);
|
||||
statisticsVOList.add(statisticsVO);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
package com.angelo.dynamicdatasource.enums;
|
||||
|
||||
import com.hzs.common.core.constant.EnumsPrefixConstants;
|
||||
import com.hzs.common.core.enums.EOrderType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单类型枚举类
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum EOrderTypeRetail {
|
||||
|
||||
/**
|
||||
* 注册订单
|
||||
*/
|
||||
REGISTER_ORDER(1, "注册订单", 1, EnumsPrefixConstants.ORDER_TYPE + 1),
|
||||
|
||||
/**
|
||||
* 升级订单
|
||||
*/
|
||||
UPGRADE_ORDER(2, "升级订单", 1, EnumsPrefixConstants.ORDER_TYPE + 2),
|
||||
|
||||
/**
|
||||
* 复购订单
|
||||
*/
|
||||
REPURCHASE_ORDER(3, "复购订单", 1, EnumsPrefixConstants.ORDER_TYPE + 3),
|
||||
|
||||
/**
|
||||
* 重消订单-重消专区
|
||||
*/
|
||||
CONSUME_ORDER(10, "重消订单", 1, EnumsPrefixConstants.ORDER_TYPE + 10),
|
||||
|
||||
/**
|
||||
* 兑换订单-积分专区
|
||||
*/
|
||||
EXCHANGE_ORDER(11, "积分订单", 1, EnumsPrefixConstants.ORDER_TYPE + 11),
|
||||
|
||||
/**
|
||||
* 福利订单-福利专区 bv
|
||||
*/
|
||||
WELFARE_ORDER(13, "福利订单", 1, EnumsPrefixConstants.ORDER_TYPE + 13),
|
||||
|
||||
/**
|
||||
* 直播订单
|
||||
*/
|
||||
MALL_ORDER(14, "直播订单", 1, EnumsPrefixConstants.ORDER_TYPE + 14),
|
||||
|
||||
/**
|
||||
* 虚拟订单
|
||||
*/
|
||||
FICTITIOUS_ORDER(20, "虚拟订单", 1, EnumsPrefixConstants.ORDER_TYPE + 20),
|
||||
|
||||
/**
|
||||
* 团队带过来的商品
|
||||
*/
|
||||
COOPERATE_ORDER(22, "合作订单", 1, EnumsPrefixConstants.ORDER_TYPE + 22),
|
||||
|
||||
/**
|
||||
* 新零售注册订单
|
||||
*/
|
||||
RETAIL_REGISTER(41, "注册订单", 0, EnumsPrefixConstants.ORDER_TYPE + 41),
|
||||
/**
|
||||
* 新零售升级订单
|
||||
*/
|
||||
RETAIL_UPGRADE(42, "升级订单", 0, EnumsPrefixConstants.ORDER_TYPE + 42),
|
||||
/**
|
||||
* 新零售复购订单
|
||||
*/
|
||||
RETAIL_REPURCHASE(43, "复购订单", 0, EnumsPrefixConstants.ORDER_TYPE + 43),
|
||||
/**
|
||||
* 新零售重消订单
|
||||
*/
|
||||
RETAIL_CONSUME(44, "重消订单", 0, EnumsPrefixConstants.ORDER_TYPE + 44),
|
||||
|
||||
RETAIL_TICKET(45, "自助购票", 0, EnumsPrefixConstants.ORDER_TYPE + 45),
|
||||
|
||||
RETAIL_PICK(46, "提货订单", 0, EnumsPrefixConstants.ORDER_TYPE + 46),
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* 实际值
|
||||
*/
|
||||
private final int value;
|
||||
/**
|
||||
* 显示标签
|
||||
*/
|
||||
private final String label;
|
||||
/**
|
||||
* 是否启用(0=是,1=否) -- 来源EYesNo
|
||||
*/
|
||||
private final int enable;
|
||||
/**
|
||||
* 国际化翻译key值
|
||||
*/
|
||||
private final String key;
|
||||
|
||||
/**
|
||||
* 根据值,返回枚举
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static EOrderType getEnumByValue(Integer value) {
|
||||
if (null == value) {
|
||||
return null;
|
||||
}
|
||||
for (EOrderType eOrderType : EOrderType.values()) {
|
||||
if (eOrderType.getValue() == value) {
|
||||
return eOrderType;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据值返回显示
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static String getEnumLabelByValue(Integer value) {
|
||||
if (null == value) {
|
||||
return "";
|
||||
}
|
||||
for (EOrderType eOrderType : EOrderType.values()) {
|
||||
if (eOrderType.getValue() == value) {
|
||||
return eOrderType.getLabel();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static List<EOrderType> getOrderTypeSpecial() {
|
||||
List<EOrderType> resultList = new ArrayList<>();
|
||||
resultList.add(EOrderType.REGISTER_ORDER);
|
||||
resultList.add(EOrderType.UPGRADE_ORDER);
|
||||
resultList.add(EOrderType.REPURCHASE_ORDER);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -3,5 +3,5 @@ package com.angelo.dynamicdatasource.service;
|
|||
import com.angelo.dynamicdatasource.entity.vo.StatisticsVO;
|
||||
|
||||
public interface ISendMsgService {
|
||||
StatisticsVO getStatistics();
|
||||
StatisticsVO getStatistics(String dsKey);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.angelo.dynamicdatasource.service.impl;
|
|||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.angelo.core.tool.DateUtils;
|
||||
import com.angelo.dynamicdatasource.entity.vo.StatisticsVO;
|
||||
import com.angelo.dynamicdatasource.enums.EOrderTypeRetail;
|
||||
import com.angelo.dynamicdatasource.service.ICuMemberRechargeService;
|
||||
import com.angelo.dynamicdatasource.service.IOrderService;
|
||||
import com.angelo.dynamicdatasource.service.ISendMsgService;
|
||||
|
@ -31,7 +32,7 @@ public class SendMsgServiceImpl implements ISendMsgService {
|
|||
@Resource
|
||||
private ICuMemberRechargeService memberRechargeService;
|
||||
@Override
|
||||
public StatisticsVO getStatistics() {
|
||||
public StatisticsVO getStatistics(String dsKey) {
|
||||
Date startDate = DateUtils.currentDate();
|
||||
// Date startDate = DateUtils.beforeDate(1, ChronoUnit.DAYS);
|
||||
Date endDate = DateUtils.afterDate(1, ChronoUnit.DAYS);
|
||||
|
@ -64,17 +65,32 @@ public class SendMsgServiceImpl implements ISendMsgService {
|
|||
// }
|
||||
orderAmount = ComputeUtil.computeMultiply(ComputeUtil.computeDivide(orderAmount, outRate), 1);
|
||||
}
|
||||
if (Objects.equals(EOrderType.REGISTER_ORDER.getValue(), saOrderExt.getOrderType()) ||
|
||||
Objects.equals(EOrderType.SPECIAL_UPGRADE_ORDER.getValue(), saOrderExt.getOrderType())) {
|
||||
registerAchieve = ComputeUtil.computeAdd(registerAchieve, orderAmount);
|
||||
} else if (Objects.equals(EOrderType.UPGRADE_ORDER.getValue(), saOrderExt.getOrderType()) ||
|
||||
Objects.equals(EOrderType.SPECIAL_REGISTER_ORDER.getValue(), saOrderExt.getOrderType())) {
|
||||
updateAchieve = ComputeUtil.computeAdd(updateAchieve, orderAmount);
|
||||
} else {
|
||||
if (Objects.equals(EOrderType.CONSUME_ORDER.getValue(), saOrderExt.getOrderType())) {
|
||||
orderAmount = ComputeUtil.computeSubtract(orderAmount, saOrderExt.getConsumeAmount());
|
||||
if(dsKey.equals("retail")) {
|
||||
if (Objects.equals(EOrderTypeRetail.REGISTER_ORDER.getValue(), saOrderExt.getOrderType()) ||
|
||||
Objects.equals(EOrderTypeRetail.RETAIL_UPGRADE.getValue(), saOrderExt.getOrderType())) {
|
||||
registerAchieve = ComputeUtil.computeAdd(registerAchieve, orderAmount);
|
||||
} else if (Objects.equals(EOrderTypeRetail.RETAIL_UPGRADE.getValue(), saOrderExt.getOrderType()) ||
|
||||
Objects.equals(EOrderTypeRetail.RETAIL_UPGRADE.getValue(), saOrderExt.getOrderType())) {
|
||||
updateAchieve = ComputeUtil.computeAdd(updateAchieve, orderAmount);
|
||||
} else {
|
||||
if (Objects.equals(EOrderTypeRetail.RETAIL_REPURCHASE.getValue(), saOrderExt.getOrderType())) {
|
||||
orderAmount = ComputeUtil.computeSubtract(orderAmount, saOrderExt.getConsumeAmount());
|
||||
}
|
||||
repurchaseAchieve = ComputeUtil.computeAdd(repurchaseAchieve, orderAmount);
|
||||
}
|
||||
}else{
|
||||
if (Objects.equals(EOrderType.REGISTER_ORDER.getValue(), saOrderExt.getOrderType()) ||
|
||||
Objects.equals(EOrderType.SPECIAL_UPGRADE_ORDER.getValue(), saOrderExt.getOrderType())) {
|
||||
registerAchieve = ComputeUtil.computeAdd(registerAchieve, orderAmount);
|
||||
} else if (Objects.equals(EOrderType.UPGRADE_ORDER.getValue(), saOrderExt.getOrderType()) ||
|
||||
Objects.equals(EOrderType.SPECIAL_REGISTER_ORDER.getValue(), saOrderExt.getOrderType())) {
|
||||
updateAchieve = ComputeUtil.computeAdd(updateAchieve, orderAmount);
|
||||
} else {
|
||||
if (Objects.equals(EOrderType.CONSUME_ORDER.getValue(), saOrderExt.getOrderType())) {
|
||||
orderAmount = ComputeUtil.computeSubtract(orderAmount, saOrderExt.getConsumeAmount());
|
||||
}
|
||||
repurchaseAchieve = ComputeUtil.computeAdd(repurchaseAchieve, orderAmount);
|
||||
}
|
||||
repurchaseAchieve = ComputeUtil.computeAdd(repurchaseAchieve, orderAmount);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -308,7 +308,7 @@ public class SmsTaskServiceImpl implements ISmsTaskService {
|
|||
if(CollUtil.isNotEmpty(dsKeySet)){
|
||||
for (String dsKey : dsList) {
|
||||
DynamicDataSourceContextHolder.push(dsKey);
|
||||
StatisticsVO statisticsVO = sendMsgService.getStatistics();
|
||||
StatisticsVO statisticsVO = sendMsgService.getStatistics(dsKey);
|
||||
statisticsVO.setDsKey(dsKey);
|
||||
statisticsVOList.add(statisticsVO);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,11 @@ spring:
|
|||
username: cloud_2
|
||||
password: pwCloud2Test180
|
||||
driver-class-name: oracle.jdbc.driver.OracleDriver
|
||||
retail:
|
||||
url: jdbc:oracle:thin:@47.95.23.100:1521:orcl
|
||||
username: retail
|
||||
password: retail_Online100xsW2
|
||||
driver-class-name: oracle.jdbc.driver.OracleDriver
|
||||
|
||||
# MyBatis Plus配置
|
||||
mybatis-plus:
|
||||
|
|
|
@ -33,6 +33,11 @@ spring:
|
|||
username: cloud_bd
|
||||
password: cloudBD_Online19xsW2
|
||||
driver-class-name: oracle.jdbc.driver.OracleDriver
|
||||
retail:
|
||||
url: jdbc:oracle:thin:@47.95.23.100:1521:orcl
|
||||
username: retail
|
||||
password: retail_Online100xsW2
|
||||
driver-class-name: oracle.jdbc.driver.OracleDriver
|
||||
|
||||
# MyBatis Plus配置
|
||||
mybatis-plus:
|
||||
|
|
Loading…
Reference in New Issue