Commit 8c7fd97b authored by huyf's avatar huyf

Merge branch 'release' of http://110.41.143.128:8081/lanbaoming/jiedao-api-boot-master into release

parents a9b54fd4 01258088
version: '3'
services:
sit-api-jiedao:
image: harbor.jiedao.com/sit-api-jiedao:latest
container_name: sit-api-jiedao
api-jd-dev:
image: harbor.com/api-jd-dev:latest
container_name: api-jd-dev
ports:
- "8001:9001"
environment:
env: sit
env: dev
volumes:
- '/etc/localtime:/etc/localtime'
- '/data/docker/apps/jiedao/sit/api/logs/operator:/logs'
- '/data/docker/apps/jiedao/sit/static:/app/static'
- '/data/docker/apps/jiedao/sit/fonts/zh:/usr/share/fonts/zh'
- '/data/apps/jd/dev/api/logs/operator:/logs'
- '/data/apps/jd/dev/static:/app/static'
- '/data/apps/jd/dev/fonts/zh:/usr/share/fonts/zh'
restart: always
ulimits:
nproc: 65535
......@@ -24,9 +24,9 @@ services:
cpus: '4'
memory: 4G
networks:
app-net:
net:
ipv4_address: 10.10.0.60
networks:
app-net:
net:
external: true
version: '3'
services:
api-jiedao-operator:
image: harbor.jiedao.com/api-jiedao-operator:latest
container_name: api-jiedao-operator
api-jd-test:
image: harbor.com/api-jd-test:latest
container_name: api-jd-test
ports:
- "9001:9001"
environment:
env: test
volumes:
- '/etc/localtime:/etc/localtime'
- '/data/docker/apps/jiedao/api/logs/operator:/logs'
- '/data/docker/apps/jiedao/static:/app/static'
- '/data/docker/apps/jiedao/fonts/zh:/usr/share/fonts/zh'
- '/data/apps/jd/test/api/logs/operator:/logs'
- '/data/apps/jd/test/static:/app/static'
- '/data/apps/jd/test/fonts/zh:/usr/share/fonts/zh'
restart: always
ulimits:
nproc: 65535
......@@ -24,9 +24,9 @@ services:
cpus: '4'
memory: 4G
networks:
app-net:
net:
ipv4_address: 10.10.0.20
networks:
app-net:
net:
external: true
......@@ -11,7 +11,7 @@
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:03:15
Date: 18/10/2024 09:26:20
*/
SET NAMES utf8mb4;
......@@ -35,6 +35,6 @@ CREATE TABLE `member_user_address` (
`updater` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员收货地址表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员收货地址表' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
......@@ -11,7 +11,7 @@
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:03:24
Date: 24/10/2024 09:12:01
*/
SET NAMES utf8mb4;
......@@ -33,6 +33,10 @@ CREATE TABLE `member_user_level_config` (
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员等级配置表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员等级配置表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of member_user_level_config
-- ----------------------------
INSERT INTO `member_user_level_config` VALUES (1, 'vip1', 0, 100, 'https://statictest.groupage.cn/2024/09/06/66dac1dfe4b0e404e1c7816f.png', '1', '2024-09-03 10:05:14', '1', '2024-09-06 16:48:34', 0);
SET FOREIGN_KEY_CHECKS = 1;
......@@ -11,7 +11,7 @@
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:03:34
Date: 18/10/2024 09:26:20
*/
SET NAMES utf8mb4;
......@@ -33,6 +33,6 @@ CREATE TABLE `member_user_score` (
`updater` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员积分表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员积分表' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
......@@ -11,7 +11,7 @@
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:03:47
Date: 18/10/2024 09:26:54
*/
SET NAMES utf8mb4;
......
......@@ -11,7 +11,7 @@
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:03:55
Date: 18/10/2024 09:27:05
*/
SET NAMES utf8mb4;
......@@ -34,6 +34,6 @@ CREATE TABLE `member_user_score_detail_releation` (
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = tis620 COLLATE = tis620_thai_ci COMMENT = '会员积分详情关联表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = tis620 COLLATE = tis620_thai_ci COMMENT = '会员积分详情关联表' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
......@@ -11,7 +11,7 @@
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:04:03
Date: 18/10/2024 09:27:20
*/
SET NAMES utf8mb4;
......
......@@ -11,7 +11,7 @@
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 06/09/2024 11:23:57
Date: 18/10/2024 09:27:30
*/
SET NAMES utf8mb4;
......@@ -26,8 +26,8 @@ CREATE TABLE `score_rule` (
`code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则编号',
`type` int NOT NULL COMMENT '指标类型',
`title_zh` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则标题中文',
`title_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '规则标题英文',
`desc_zh` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '规则说明中文',
`title_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则标题英文',
`desc_zh` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则说明中文',
`desc_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则说明英文',
`cover_image_zh` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '封面图中文',
`cover_image_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '封面图英文',
......@@ -47,6 +47,6 @@ CREATE TABLE `score_rule` (
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '积分规则表' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat Premium Data Transfer
Source Server : jiedao-uat
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : 159.75.224.138:2297
Source Schema : jiedao
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 18/10/2024 09:27:40
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for score_rule_share_fail_trigger
-- ----------------------------
DROP TABLE IF EXISTS `score_rule_share_fail_trigger`;
CREATE TABLE `score_rule_share_fail_trigger` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`share_record_id` bigint NOT NULL COMMENT '分享记录id',
`trigger_time` datetime NOT NULL COMMENT '点击时间',
`ip_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '点击ip',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat Premium Data Transfer
Source Server : jiedao-uat
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : 159.75.224.138:2297
Source Schema : jiedao
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 18/10/2024 09:27:47
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for score_rule_share_record
-- ----------------------------
DROP TABLE IF EXISTS `score_rule_share_record`;
CREATE TABLE `score_rule_share_record` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分享编号',
`member_id` bigint NOT NULL COMMENT '会员id',
`rule_id` bigint NOT NULL COMMENT '积分规则id',
`total_score` int NULL DEFAULT 0 COMMENT '总积分',
`last_trigger_time` datetime NULL DEFAULT NULL COMMENT '最后触发时间',
`create_time` datetime NOT NULL COMMENT '创建时间',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`update_time` datetime NOT NULL COMMENT '更新时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 64 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分享记录表' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
This diff is collapsed.
SET FOREIGN_KEY_CHECKS = 0;
INSERT INTO `jiedao`.`system_sms_template` (`id`, `type`, `status`, `code`, `name`, `content`, `params`, `remark`, `api_template_id`, `channel_id`, `channel_code`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `content_en`, `api_template_id_en`) VALUES (55, 3, 0, 'user-sms-redeem-reward', '积分兑换验证码', '积分兑换验证码:${code},请勿将验证码泄露给他人,以免造成不必要的损失,两分钟之内有效!', '[\"code\"]', NULL, 'SMS_471775248', 6, 'ALIYUN', '2696', '2024-08-20 10:06:06', '2696', '2024-08-20 10:14:39', b'0', '[ECLogistics]Your login code is:{code}, do not disclose this code to others to avoid any unnecessary loss, within 20 minutes effective!', 'SMS_199790126');
SET FOREIGN_KEY_CHECKS = 1;
\ No newline at end of file
......@@ -11,7 +11,7 @@
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:04:36
Date: 18/10/2024 09:28:59
*/
SET NAMES utf8mb4;
......@@ -31,7 +31,7 @@ CREATE TABLE `ecw_reward` (
`img_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '英文礼品图片',
`img_fr` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '法文礼品图片',
`points_require` int NOT NULL COMMENT '兑换所需积分',
`node_id` int NOT NULL COMMENT '兑换网点',
`node_id` int NOT NULL COMMENT '提货点id(对应仓库warehouse_id)',
`exchange_count` int NULL DEFAULT 0 COMMENT '已兑换次数',
`quantity_remain` int NOT NULL COMMENT '剩余数量',
`start_time` datetime NULL DEFAULT NULL COMMENT '活动开始时间',
......@@ -49,6 +49,6 @@ CREATE TABLE `ecw_reward` (
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `unique_code`(`code` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 38 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '礼品' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '礼品' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
......@@ -11,7 +11,7 @@
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 06/09/2024 11:26:34
Date: 18/10/2024 09:29:09
*/
SET NAMES utf8mb4;
......@@ -27,6 +27,7 @@ CREATE TABLE `ecw_reward_redeem` (
`member_id` bigint NOT NULL COMMENT '会员id',
`reward_id` bigint NOT NULL COMMENT '礼品id',
`status` int NULL DEFAULT NULL COMMENT '兑换状态',
`hold_score_before_redeem` int NULL DEFAULT 0 COMMENT '兑换前持有的积分',
`score_count` int NOT NULL COMMENT '积分数量',
`reward_count` int NOT NULL COMMENT '兑换数量',
`redeem_type` int NOT NULL COMMENT '兑换方式',
......
-- 更新订单添加预装但未提交审核的出货状态值
update ecw_order o set o.shipment_state = 304 WHERE o.`status` = 5 AND o.shipment_state = 0 AND (select COUNT(1) from ecw_box_preload_goods pg WHERE pg.order_id = o.order_id AND pg.deleted = 0) > 0;
-- 这里是补充脚本,生产环境已存在
-- 添加新字段
alter table `ecw_customer` add column `no_consignee` bit(1) NOT NULL DEFAULT b'0' COMMENT '控货无收货人';
alter table `ecw_customer` add column `default_pay` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否默认付款';
-- 添加新字段
alter table `ecw_warehouse` add column `rent_free_days` int DEFAULT NULL COMMENT '仓库免租期';
alter table `ecw_warehouse` add column `lock_recipient_days` int DEFAULT NULL COMMENT '锁定收货人天数';
-- 增加区号
alter table ecw_region add COLUMN area_code varchar(32) DEFAULT NULL comment '区号';
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (33, '33', '客户合并', 'Customer Merge', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
-- 增加报价单目的国字段
alter table ecw_offer add COLUMN dest_country_id bigint DEFAULT 0 comment '目的国id';
update ecw_offer o join ecw_warehouse_line l on o.line_id = l.id join ecw_warehouse w on w.id = l.dest_warehouse_id set o.dest_country_id = w.guojia;
\ No newline at end of file
......@@ -158,7 +158,7 @@ public class PhoneUtil {
}
// 字典中获取验证规则
String rule = null;
String rule = "";
try {
List<DictDataRespDTO> dtos = DictFrameworkUtils.listDictDatasFromCache("phone_number_rule");
if (CollUtil.isNotEmpty(dtos)) {
......@@ -178,6 +178,8 @@ public class PhoneUtil {
}
if (StrUtil.isNotBlank(rule)) {
// 这里的正则前面包含了区号做唯一识别,需要先替换掉
rule = rule.replaceFirst(code, "");
log.info(String.format("获取手机号规则成功, code: %s, mobile: %s, rule: %s", code, mobile, rule));
return mobile.matches(rule);
}
......
......@@ -55,7 +55,7 @@ public interface AbstractMapper<T> extends BaseMapper<T> {
IPage<T> mpPage = MyBatisUtils.buildPage(pageParam);
selectPage(mpPage, queryWrapper);
// 转换返回
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal());
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal(), mpPage.getSize(), mpPage.getCurrent(), mpPage.getPages());
}
/***
......
......@@ -95,6 +95,7 @@ public enum WorkFlowEmus {
SHIPMENT_LINE_WEIGHT_ALLOW_OVER("shipment_line_weight_allow_over", "出货审批-允许超出线路重量上限审核"),
ORDER_OVERSEAS_WAREHOUSE_CHANGE("order_overseas_warehouse_change", "订单审批-海外仓修改申请"),
ORDER_CONSIGNEE_LIMIT_CHANGE("order_consignee_limit_change", "订单审批-收货人限制修改申请"),
ORDER_WAREHOUSING("order_warehousing", "订单审批-入仓申请"),
;
private String key;
private String value;
......
package cn.iocoder.yudao.module.bpm.service.order.listener;
import cn.iocoder.yudao.module.bpm.enums.WorkFlowEmus;
import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEvent;
import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEventListener;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
@Slf4j
public class BmpOrderWarehouseingResultListener extends BpmProcessInstanceResultEventListener {
@Resource
OrderService orderService;
@Override
protected String getProcessDefinitionKey() {
return WorkFlowEmus.ORDER_WAREHOUSING.getKey();
}
@Override
protected void onEvent(BpmProcessInstanceResultEvent event) {
log.info("----------------------入仓申请----------------------,{},{}" + event.getBusinessKey(), event.getResult());
//orderService.approvalOrder(event.getBusinessKey(), event.getResult());
}
}
......@@ -122,7 +122,7 @@ public interface CustomerComplaintMapper extends BaseMapperX<CustomerComplaintDO
"</script>"
})
List<CustomerComplaintExcelVO> selectList(@Param("query") CustomerComplaintExportReqVO query);
List<CustomerComplaintExcelVO> selectExcelList(@Param("query") CustomerComplaintExportReqVO query);
}
......@@ -25,13 +25,13 @@ import java.util.List;
public interface CustomerMapper extends BaseMapperX<CustomerDO> {
//合并操作日志
void doMergeCustomerOperateLog(long customer_id1,long customer_id2);
void doMergeCustomerOperateLog(@Param("customer_id1") Long customer_id1, @Param("customer_id2") Long customer_id2);
//合并客户信用日志
void doMergeCustomerCreditLog(long customer_id1,long customer_id2);
void doMergeCustomerCreditLog(@Param("customer_id1") Long customer_id1, @Param("customer_id2") Long customer_id2);
//合并客户登记日志
void doMergeCustomerLevelLog(long customer_id1,long customer_id2);
void doMergeCustomerLevelLog(@Param("customer_id1") Long customer_id1, @Param("customer_id2") Long customer_id2);
IPage<CustomerDO> getPage(IPage<CustomerDO> page,
@Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper);
......
......@@ -68,4 +68,17 @@ public interface CustomerApprovalMapper extends AbstractMapper<CustomerApprovalD
"ORDER BY approval_id DESC limit 1"
})
CustomerApprovalDO getCustomerHandoverApprovalByCustomerId(@Param("customerId") Long customerId);
@Select({
"SELECT * FROM ecw_customer_approval WHERE deleted=0 ",
"AND status = 1 ",
"AND ( ",
"(type = 2 AND details is not null AND details ->> '$.customerHandoverDetailDtoList' is not null and JSON_EXTRACT(details, '$.customerHandoverDetailDtoList') like concat('%\"customerId\": ', concat(#{customerId},',%')))",
" or (customer_id = #{customerId}) ",
") ",
"ORDER BY approval_id DESC"
})
List<CustomerApprovalDO> selectInApprovalByCustomerId(@Param("customerId") Long customerId);
}
......@@ -32,7 +32,7 @@ public class CustomerApiImpl implements CustomerApi {
@Resource
private CountryService countryService;
public void associateCustomerAuto(String areaCode, String phone, Long memberUserId, String newName) {
public void associateCustomerAuto(String areaCode, String phone, Long memberUserId, String newName ,String memberCode) {
//先查询此用户是否有关联老客户
CustomerContactsDO customerContactsDO = customerContactsService.getUniqueOneAndValidate(areaCode, phone, null);
......@@ -85,7 +85,7 @@ public class CustomerApiImpl implements CustomerApi {
customerCreateReqVO.setCustomerContacts(Arrays.asList(customerContactsCreateReqVO));
customerCreateReqVO.setCustomerOperateLogRemark("会员注册关联创建客户. 会员id:" + memberUserId + "; 电话:" + phone);
customerCreateReqVO.setCustomerOperateLogRemark("会员注册关联创建客户. 会员编号:" + memberCode + "; 电话:" + phone);
// app创建
customerCreateReqVO.setCreateFrom(CustomerCreateFromEnum.APP_REGISTER.getValue());
......
......@@ -467,4 +467,7 @@ public interface CustomerService extends IService<CustomerDO> {
* @param isNew 新客户=true,老客户=false
*/
void updateCustomerNewOrOld(Long customerId, Boolean isNew);
void validateCustomerApproval(CustomerDO customerDO);
}
......@@ -8,17 +8,15 @@ import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.AssignConfirmedCustomerEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.AutoProcessNotCustomerServiceExceptionEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.QueryEstimateEnterOpenSeaTimeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent;
import cn.iocoder.yudao.framework.apollo.core.vo.ApplyInfoVO;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
......@@ -3911,4 +3909,15 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
.setRemark("手动设置客户业绩类型为【" + (isNew ? "新客户" : "老客户") + "】");
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
}
@Override
public void validateCustomerApproval(CustomerDO customerDO) {
Long customerId = customerDO.getId();
List<CustomerApprovalDO> customerApprovalDOList = customerApprovalService.selectInApprovalByCustomerId(customerId);
if (CollectionUtil.isNotEmpty(customerApprovalDOList)) {
throw exception(CUSTOMER_APPROVAL_IN_PROCESSING);
}
}
}
......@@ -131,7 +131,7 @@ public class CustomerComplaintServiceImpl extends AbstractService<CustomerCompla
@Override
public List<CustomerComplaintExcelVO> getCustomerComplaintList(CustomerComplaintExportReqVO exportReqVO) {
return customerComplaintMapper.selectList(exportReqVO);
return customerComplaintMapper.selectExcelList(exportReqVO);
}
}
......@@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.customer.vo.customerApproval.*;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerApproval.CustomerApprovalDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.apache.ibatis.annotations.Param;
/**
* 客户相关审核详情 Service 接口
......@@ -70,4 +71,12 @@ public interface CustomerApprovalService extends IService<CustomerApprovalDO> {
* @return
*/
CustomerApprovalDO getCustomerHandoverApprovalByCustomerId(Long customerId);
/**
* 通过客户id查询所有类型的审批中的审批记录
*
* @param customerId
* @return
*/
List<CustomerApprovalDO> selectInApprovalByCustomerId(Long customerId);
}
......@@ -71,4 +71,9 @@ public class CustomerApprovalServiceImpl extends AbstractService<CustomerApprova
public CustomerApprovalDO getCustomerHandoverApprovalByCustomerId(Long customerId) {
return customerApprovalMapper.getCustomerHandoverApprovalByCustomerId(customerId);
}
@Override
public List<CustomerApprovalDO> selectInApprovalByCustomerId(Long customerId) {
return customerApprovalMapper.selectInApprovalByCustomerId(customerId);
}
}
......@@ -14,9 +14,9 @@ public class CustomerMerge {
@ApiModelProperty(value = "被保留的客户id")
@NotNull(message = "被保留的客户id不能为空")
private Long id1;
private Long customerIdSaved;
@ApiModelProperty(value = "被删除的客户id")
@NotNull(message = "被删除的客户id不能为空")
private Long id2;
private Long customerIdDeleted;
}
......@@ -215,4 +215,19 @@ public class CustomerRespVO extends CustomerBaseVO {
*/
@ApiModelProperty(value = "客户角色(逗号分隔的) customer_role 字典")
private String roles;
/**
* 客户类别
* <p>
* 枚举 {@link TODO customer_type 字典}
*/
@ApiModelProperty(value = "客户类型(逗号分隔的) customer_type 字典")
private String type;
/**
* 产品类型 即主营类别
*/
@ApiModelProperty(value = "主营类别")
private Long productType;
}
......@@ -85,4 +85,15 @@ public class CustomerFollowupQueryVO extends PageParam {
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
@ApiModelProperty(value = "跟进类型,下拉多选")
private List<Integer> followTypes;
@ApiModelProperty(value = "跟进方式,下拉多选")
private List<Integer> followMethods;
@ApiModelProperty(value = "跟进结果,下拉多选")
private List<Integer> resultTypes;
//跟进状态,多选,逗号分隔
@ApiModelProperty(value = "跟进状态,下拉多选")
private List<Integer> statuses;
}
......@@ -38,6 +38,35 @@
AND a.result_type = #{query.resultType}
</if>
<if test="query.followTypes != null and query.followTypes.size()>0">
AND
<foreach item='item' index="index" collection='query.followTypes' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, a.follow_type)
</foreach>
</if>
<if test="query.followMethods != null and query.followMethods.size()>0">
AND
<foreach item='item' index="index" collection='query.followMethods' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, a.follow_method)
</foreach>
</if>
<if test="query.resultTypes != null and query.resultTypes.size()>0">
AND
<foreach item='item' index="index" collection='query.resultTypes' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, a.result_type)
</foreach>
</if>
<if test="query.statuses != null and query.statuses.size()>0">
AND
<foreach item='item' index="index" collection='query.statuses' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, a.status)
</foreach>
</if>
</sql>
<select id="selectPage1" resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.CustomerFollowupDO">
......
......@@ -29,6 +29,10 @@
<artifactId>yudao-module-sale-core</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-order-api</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
</project>
......@@ -14,6 +14,13 @@ Content-Type: application/json
### 合并客户
GET {{baseUrl}}/ecw/customer/mergeCus?customerIdSaved=52043&customerIdDeleted=52042
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
Content-Type: application/json
### create
POST {{baseUrl}}/ecw/customer/handover/approval
Authorization: Bearer {{token}}
......
package cn.iocoder.yudao.module.customer.controller.admin.customer;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
public interface CustomerMergeService {
boolean doMergeCus(CustomerDO customerDOSaved,
CustomerDO customerDODeleted,
long loginUserId);
}
......@@ -625,13 +625,16 @@ public class WarehouseServiceImpl implements WarehouseService {
@Override
public List<WarehouseDO> getWarehouseListSimple(String title) {
LambdaQueryWrapperX<WarehouseDO> queryWrapperX = new LambdaQueryWrapperX<WarehouseDO>()
.eq(WarehouseDO::getStatus, 0);
if (StringUtils.isBlank(title)) {
return warehouseMapper.selectList();
return warehouseMapper.selectList(queryWrapperX);
}
// 模糊搜索中文名和英文名
return warehouseMapper.selectList(new LambdaQueryWrapperX<WarehouseDO>()
.like(WarehouseDO::getTitleZh, title)
queryWrapperX.like(WarehouseDO::getTitleZh, title)
.or()
.like(WarehouseDO::getTitleEn, title));
.like(WarehouseDO::getTitleEn, title);
return warehouseMapper.selectList(queryWrapperX);
}
}
......@@ -33,6 +33,7 @@ import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
......@@ -109,7 +110,7 @@ public class WarehouseController {
@GetMapping("/getGuojiaAndShiAndWarehouseList")
@ApiOperation("获取仓库区域并行国家、城市、仓库列表")
@ApiImplicitParam(name = "tradeType", value = "进出口类型,1-进口,2-出口", required = false, example = "1", dataTypeClass = Integer.class)
@ApiImplicitParam(name = "tradeType", value = "进出口类型,1-进口,2-出口", required = true, example = "1", dataTypeClass = Integer.class)
public CommonResult<WarehouseListVO> getGuojiaAndShiAndWarehouseList(Integer tradeType){
WarehouseListVO warehouseListVO = warehouseService.getGuojiaAndShiAndWarehouseList(tradeType);
return success(warehouseListVO);
......@@ -216,6 +217,9 @@ public class WarehouseController {
channelInfoEvent.setChannelId(requestVO.getChannelId());
applicationContext.publishEvent(channelInfoEvent);
if (Objects.nonNull(channelInfoEvent.getCountryId()) && channelInfoEvent.getCountryId() > 0L){
if (Objects.nonNull(requestVO.getDestCountryId()) && requestVO.getDestCountryId() > 0L && !Objects.equals(requestVO.getDestCountryId(),channelInfoEvent.getCountryId())) {
return error(400,"目的国与渠道不匹配");
}
requestVO.setDestCountryId(channelInfoEvent.getCountryId());
}
}
......
......@@ -29,6 +29,7 @@ import javax.validation.Valid;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Api(tags = "app-web - 仓库")
......@@ -137,6 +138,9 @@ public class AppWarehouseController {
channelInfoEvent.setChannelId(requestVO.getChannelId());
applicationContext.publishEvent(channelInfoEvent);
if (Objects.nonNull(channelInfoEvent.getCountryId()) && channelInfoEvent.getCountryId() > 0L){
if (Objects.nonNull(requestVO.getDestCountryId()) && requestVO.getDestCountryId() > 0L && !Objects.equals(requestVO.getDestCountryId(),channelInfoEvent.getCountryId())) {
return error(400,"目的国与渠道不匹配");
}
requestVO.setDestCountryId(channelInfoEvent.getCountryId());
}
}
......@@ -186,7 +190,7 @@ public class AppWarehouseController {
@GetMapping("/getGuojiaAndShiAndWarehouseList")
@ApiOperation("获取仓库区域并行国家、城市、仓库列表")
@ApiImplicitParam(name = "tradeType", value = "进出口类型,1-进口,2-出口", required = false, example = "1", dataTypeClass = Integer.class)
@ApiImplicitParam(name = "tradeType", value = "进出口类型,1-进口,2-出口", required = true, example = "1", dataTypeClass = Integer.class)
public CommonResult<WarehouseListVO> getGuojiaAndShiAndWarehouseList(Integer tradeType){
WarehouseListVO warehouseListVO = warehouseService.getGuojiaAndShiAndWarehouseList(tradeType);
return success(warehouseListVO);
......
......@@ -4,8 +4,10 @@ import java.util.Date;
public interface CustomerApi {
void associateCustomerAuto(String areaCode, String phone, Long userId, String newName);
void associateCustomerAuto(String areaCode, String phone, Long userId, String newName, String memberCode);
void approvalCustomerDelay(String approveId, Integer result);
void approvalCustomerTransfer(String approveId, Integer result);
void fillFirstDealTimeIfNull(Long customerId, Date firstDealTime);
......
......@@ -67,6 +67,11 @@ public enum CustomerOperateTypeEnum {
CUSTOMER_UPDATE_SETUP(32, "设置客户设置"),
CUSTOMER_MERGE(33, "客户合并"),
DELETE(100, "删除"),
......
......@@ -187,6 +187,10 @@ public interface ErrorCodeConstants {
ErrorCode CUSTOMER_MERGE_CUSTOMER_SERVICE_NOT_SAME = new ErrorCode(1004006042, "customer.merge.customer.service.not.same");
ErrorCode CUSTOMER_APPROVAL_IN_PROCESSING = new ErrorCode(1004006043, "customer.approval.in.processing");
ErrorCode AREA_CODE_NOT_NULL = new ErrorCode(1004006044, "area.code.not.null");
ErrorCode CURRENCY_ID_NOT_NULL = new ErrorCode(1004006045, "currency.id.not.null");
}
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.ecw.controller.admin.region;
import cn.iocoder.yudao.framework.apollo.core.event.ChannelDataEvent;
import cn.iocoder.yudao.framework.apollo.core.event.QueryChannelInfoEvent;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -26,6 +27,7 @@ import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import static cn.iocoder.yudao.module.ecw.enums.ErrorCodeConstants.*;
import cn.iocoder.yudao.module.ecw.controller.admin.region.vo.*;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
......@@ -217,4 +219,22 @@ public class RegionController {
List<RegionDO> cityList = regionService.getCityListByParentId(parentId);
return success(RegionConvert.INSTANCE.convertList(cityList));
}
@GetMapping("/check/dest-currency/area-code/")
@ApiOperation("检查国家区域是否与手机号国家区号一致")
@ApiImplicitParams({
@ApiImplicitParam(name = "currencyId", value = "国家ID", required = true, example = "1024", dataTypeClass = Long.class),
@ApiImplicitParam(name = "areaCode", value = "手机国家区号", required = true, example = "86", dataTypeClass = String.class)
})
public CommonResult<Boolean> checkDestCurrencyAndAreaCode(@RequestParam("currencyId") Long currencyId,
@RequestParam("areaCode") String areaCode) {
if (currencyId == null) {
return CommonResult.error(CURRENCY_ID_NOT_NULL);
}
if (StringUtils.isBlank(areaCode)) {
return CommonResult.error(AREA_CODE_NOT_NULL);
}
return success(regionService.countByIdAndAreaCode(currencyId, areaCode));
}
}
......@@ -59,4 +59,6 @@ public class RegionBaseVO {
private String importCurrency4;
@ApiModelProperty(value = "应收额币种", required = false)
private String importCurrency5;
@ApiModelProperty(value = "区号", required = false)
private String areaCode;
}
......@@ -10,7 +10,9 @@ import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.ecw.service.region.RegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.security.access.prepost.PreAuthorize;
......@@ -25,6 +27,8 @@ import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.module.ecw.enums.ErrorCodeConstants.AREA_CODE_NOT_NULL;
import static cn.iocoder.yudao.module.ecw.enums.ErrorCodeConstants.CURRENCY_ID_NOT_NULL;
@Api(tags = "app-web - 国家城市管理")
@RestController
......@@ -130,6 +134,24 @@ public class AppRegionController {
return success(RegionConvert.INSTANCE.convertList(cityList));
}
@GetMapping("/check/dest-currency/area-code/")
@ApiOperation("检查国家区域是否与手机号国家区号一致")
@ApiImplicitParams({
@ApiImplicitParam(name = "currencyId", value = "国家ID", required = true, example = "1024", dataTypeClass = Long.class),
@ApiImplicitParam(name = "areaCode", value = "手机国家区号", required = true, example = "86", dataTypeClass = String.class)
})
public CommonResult<Boolean> checkDestCurrencyAndAreaCode(@RequestParam("currencyId") Long currencyId,
@RequestParam("areaCode") String areaCode) {
if (currencyId == null) {
return CommonResult.error(CURRENCY_ID_NOT_NULL);
}
if (StringUtils.isBlank(areaCode)) {
return CommonResult.error(AREA_CODE_NOT_NULL);
}
return success(regionService.countByIdAndAreaCode(currencyId, areaCode));
}
private RegionRespVO buildChildTree(RegionRespVO pNode, List<RegionRespVO> allDatas){
List<RegionRespVO> childs = new ArrayList<>();
for(RegionRespVO itemNode : allDatas) {
......
package cn.iocoder.yudao.module.ecw.dal.dataobject.region;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
......@@ -93,4 +92,8 @@ public class RegionDO extends BaseDO {
* 进口国应收额币种
*/
private String importCurrency5;
/**
* 区号
*/
private String areaCode;
}
......@@ -44,6 +44,14 @@ public interface RegionService {
*/
RegionDO getRegion(Long id);
/**
* 根据国家id和手机国家区号统计数值,判断区号是否与国家一致
* @param id
* @param areaCode
* @return
*/
Boolean countByIdAndAreaCode(Long id, String areaCode);
/**
* 获得区域设置列表
*
......
package cn.iocoder.yudao.module.ecw.service.region;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.ecw.controller.admin.region.vo.*;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
......@@ -31,12 +35,12 @@ public class RegionServiceImpl implements RegionService {
@Override
public Long createRegion(RegionCreateReqVO createReqVO) {
if (Objects.equals(createReqVO.getType(), "1") || Objects.equals(createReqVO.getType(), "3")){
if (StringUtils.isBlank(createReqVO.getLabelCode())){
if (Objects.equals(createReqVO.getType(), "1") || Objects.equals(createReqVO.getType(), "3")) {
if (StringUtils.isBlank(createReqVO.getLabelCode())) {
throw exception(REGION_LABEL_CODE_NOT_NULL);
}
String[] codes = createReqVO.getLabelCode().split(StrUtil.DASHED);
if (codes.length < 2){
if (codes.length < 2) {
throw exception(REGION_LABEL_CODE_COUNTRY_AND_CITY_AND_AIR_COUNTRY);
}
}
......@@ -49,12 +53,12 @@ public class RegionServiceImpl implements RegionService {
@Override
public void updateRegion(RegionUpdateReqVO updateReqVO) {
if (Objects.equals(updateReqVO.getType(), "1") || Objects.equals(updateReqVO.getType(), "3")){
if (StringUtils.isBlank(updateReqVO.getLabelCode())){
if (Objects.equals(updateReqVO.getType(), "1") || Objects.equals(updateReqVO.getType(), "3")) {
if (StringUtils.isBlank(updateReqVO.getLabelCode())) {
throw exception(REGION_LABEL_CODE_NOT_NULL);
}
String[] codes = updateReqVO.getLabelCode().split(StrUtil.DASHED);
if (codes.length < 2){
if (codes.length < 2) {
throw exception(REGION_LABEL_CODE_COUNTRY_AND_CITY_AND_AIR_COUNTRY);
}
}
......@@ -94,6 +98,13 @@ public class RegionServiceImpl implements RegionService {
return regionMapper.selectById(id);
}
@Override
public Boolean countByIdAndAreaCode(Long id, String areaCode) {
Long count = regionMapper.selectCount(new LambdaQueryWrapper<RegionDO>().eq(RegionDO::getId, id).eq(RegionDO::getAreaCode, areaCode));
return Objects.nonNull(count) && count > 0L;
}
@Override
public List<RegionDO> getRegionList(Collection<Long> ids) {
return regionMapper.selectBatchIds(ids);
......
......@@ -50,5 +50,6 @@ public class UserRespDTO {
private Integer country;
private Integer city;
private String code;
}
......@@ -48,14 +48,14 @@ public class ScoreRuleController {
@PostMapping("/create")
@ApiOperation("创建积分规则")
@Idempotent(timeout = 3)
@PreAuthorize("@ss.hasPermission('member:score-rule:create')")
//@PreAuthorize("@ss.hasPermission('member:score-rule:create')")
public CommonResult<Long> createScoreRule(@Valid @RequestBody ScoreRuleCreateReqVO createReqVO) {
return success(scoreRuleService.createScoreRule(createReqVO));
}
@PostMapping("/update")
@ApiOperation("更新积分规则")
@PreAuthorize("@ss.hasPermission('member:score-rule:update')")
//@PreAuthorize("@ss.hasPermission('member:score-rule:update')")
public CommonResult<Boolean> updateScoreRule(@Valid @RequestBody ScoreRuleUpdateReqVO updateReqVO) {
scoreRuleService.updateScoreRule(updateReqVO);
return success(true);
......@@ -63,7 +63,7 @@ public class ScoreRuleController {
@PostMapping("/delete")
@ApiOperation("删除积分规则")
@PreAuthorize("@ss.hasPermission('member:score-rule:delete')")
//@PreAuthorize("@ss.hasPermission('member:score-rule:delete')")
public CommonResult<Boolean> deleteScoreRule(@Valid @RequestBody IdReqVo idReqVo) {
scoreRuleService.deleteScoreRule(idReqVo.getId());
return success(true);
......@@ -71,7 +71,7 @@ public class ScoreRuleController {
@PostMapping("/get")
@ApiOperation("获得积分规则详情")
@PreAuthorize("@ss.hasPermission('member:score-rule:query')")
//@PreAuthorize("@ss.hasPermission('member:score-rule:query')")
public CommonResult<ScoreRuleBackDetailVO> getScoreRule(@Valid @RequestBody IdReqVo idReqVo) {
ScoreRuleBackDetailVO scoreRuleBackDetailVO = scoreRuleService.getScoreRule(idReqVo.getId());
return success(scoreRuleBackDetailVO);
......@@ -80,7 +80,7 @@ public class ScoreRuleController {
@PostMapping("/list")
@ApiOperation("获得积分规则列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
@PreAuthorize("@ss.hasPermission('member:score-rule:query')")
//@PreAuthorize("@ss.hasPermission('member:score-rule:query')")
public CommonResult<List<ScoreRuleBackVO>> getScoreRuleList(@NotNull @RequestParam Collection<Long> ids) {
List<ScoreRuleBackVO> list = scoreRuleService.getScoreRuleList(ids);
return success(list);
......@@ -88,7 +88,7 @@ public class ScoreRuleController {
@PostMapping("/page")
@ApiOperation("获得积分规则分页")
@PreAuthorize("@ss.hasPermission('member:score-rule:query')")
//@PreAuthorize("@ss.hasPermission('member:score-rule:query')")
public CommonResult<PageResult<ScoreRuleBackVO>> getScoreRulePage(@Valid @RequestBody ScoreRuleQueryVO query, PageVO page) {
PageResult<ScoreRuleBackVO> pageResult = scoreRuleService.getScoreRulePage(query, page);
return success(pageResult);
......@@ -96,7 +96,7 @@ public class ScoreRuleController {
@PostMapping("/status")
@ApiOperation("启用关闭")
@PreAuthorize("@ss.hasPermission('member:score-rule:update')")
//@PreAuthorize("@ss.hasPermission('member:score-rule:update')")
public CommonResult<Boolean> updateStatus(@Valid @RequestBody ScoreRuleStatusReqVO scoreRuleStatusReqVO) {
scoreRuleService.updateStatus(scoreRuleStatusReqVO);
return success(true);
......@@ -105,14 +105,14 @@ public class ScoreRuleController {
@PostMapping("/copy")
@ApiOperation("复制规则")
@Idempotent(timeout = 3)
@PreAuthorize("@ss.hasPermission('member:score-rule:create')")
//@PreAuthorize("@ss.hasPermission('member:score-rule:create')")
public CommonResult<Long> copyScoreRule(@Valid @RequestBody IdReqVo idReqVo) {
return success(scoreRuleService.copyScoreRule(idReqVo.getId()));
}
@PostMapping("/delay")
@ApiOperation("延期规则")
@PreAuthorize("@ss.hasPermission('member:score-rule:update')")
//@PreAuthorize("@ss.hasPermission('member:score-rule:update')")
public CommonResult<Boolean> delayScoreRule(@Valid @RequestBody ScoreDelayReqVO scoreDelayReqVO) {
scoreRuleService.delayScoreRule(scoreDelayReqVO);
return success(true);
......@@ -135,7 +135,7 @@ public class ScoreRuleController {
@GetMapping("/export-excel")
@ApiOperation("导出积分规则Excel")
@PreAuthorize("@ss.hasPermission('member:score-rule:export')")
//@PreAuthorize("@ss.hasPermission('member:score-rule:export')")
@OperateLog(type = EXPORT)
public void exportScoreRuleExcel(@Valid ScoreRuleQueryVO query,
HttpServletResponse response) throws IOException {
......@@ -147,7 +147,7 @@ public class ScoreRuleController {
@PostMapping("/switch/set")
@ApiOperation("设置会员工能开关")
@PreAuthorize("@ss.hasPermission('member:score-rule:update')")
//@PreAuthorize("@ss.hasPermission('member:score-rule:update')")
public CommonResult<Boolean> setScoreRuleSwitch(@RequestBody SwitchReqVo switchReqVo) {
return success(scoreRuleService.setScoreRuleSwitch(switchReqVo));
}
......
......@@ -2,18 +2,18 @@ package cn.iocoder.yudao.module.member.controller.admin.scoreRule;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord.ScoreRuleShareRecordDO;
import cn.iocoder.yudao.module.member.service.ScoreRuleShareRecord.ScoreRuleShareRecordService;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordDetailReqVO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordDetailVO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordPageVO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordQueryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
......
......@@ -11,6 +11,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
......@@ -86,6 +87,7 @@ public class UserBackVO {
* 生日
*/
@ExcelProperty("生日")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@ApiModelProperty(value = "生日")
private Date birthday;
/**
......
......@@ -43,7 +43,7 @@ public class MemberUserScoreController {
@PostMapping("/page")
@ApiOperation("获得会员积分分页")
@PreAuthorize("@ss.hasPermission('member:user-score:query')")
//@PreAuthorize("@ss.hasPermission('member:user-score:query')")
public CommonResult<PageResult<MemberUserScoreBackVO>> getUserScorePage(@Valid @RequestBody MemberUserScoreQueryVO query) {
PageResult<MemberUserScoreBackVO> pageResult = userScoreService.getUserScorePage(query);
return success(pageResult);
......@@ -52,7 +52,7 @@ public class MemberUserScoreController {
@PostMapping("/operate")
@ApiOperation("操作积分")
@Idempotent(timeout = 5)
@PreAuthorize("@ss.hasPermission('member:user-score:operate')")
//@PreAuthorize("@ss.hasPermission('member:user-score:operate')")
public CommonResult<Boolean> operate(@Valid @RequestBody MemberUserScoreOperateQueryVO query) {
Map<String,Object> extParam = new HashMap<>();
extParam.put("comment", query.getComment());
......
......@@ -29,7 +29,7 @@ public class MemberUserScoreLogController {
@PostMapping("/page")
@ApiOperation("获得积分记录分页")
@PreAuthorize("@ss.hasPermission('member:user-score-log:query')")
//@PreAuthorize("@ss.hasPermission('member:user-score-log:query')")
public CommonResult<PageResult<MemberUserScoreLogBackVO>> page(@Valid @RequestBody MemberUserScoreLogQueryVO query) {
PageResult<MemberUserScoreLogBackVO> pageResult = memberUserScoreLogService.getPage(query);
return success(pageResult);
......
......@@ -50,11 +50,24 @@ public class AppAuthController {
// if (StringUtils.isNotBlank(mobile)) {
// reqVO.setMobile(mobile);
// }
String token = authService.reg(reqVO, getClientIP(), getUserAgent());
String token = authService.reg(reqVO, getClientIP(), getUserAgent(), true);
// 返回结果
return success(AppAuthLoginRespVO.builder().token(token).build());
}
@PostMapping("/share-page/reg")
@ApiOperation("分享页面使用手机注册")
@OperateLog(enable = false)
@Idempotent(timeout = 5)
public CommonResult<Boolean> sharePageReg(@RequestBody @Valid AppAuthRegReqVO reqVO) {
String mobileCode = reqVO.getAreaCode() + StrUtil.COLON + reqVO.getMobile();
paramValidatorApi.validatorMobile(mobileCode);
authService.reg(reqVO, getClientIP(), getUserAgent(), false);
// 返回结果
return success(true);
}
@PostMapping("/login")
@ApiOperation("使用手机 + 密码登录")
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
......@@ -110,7 +123,7 @@ public class AppAuthController {
}
@PostMapping("/update-password")
@ApiOperation(value = "修改用户密码",notes = "用户修改密码时使用")
@ApiOperation(value = "修改用户密码", notes = "用户修改密码时使用")
@PreAuthenticated
@Idempotent(timeout = 5)
public CommonResult<Boolean> updatePassword(@RequestBody @Valid AppAuthUpdatePasswordReqVO reqVO) {
......@@ -129,7 +142,7 @@ public class AppAuthController {
}
@PostMapping("/update-control-password")
@ApiOperation(value = "修改用户控货密码",notes = "用户修改控货密码时使用")
@ApiOperation(value = "修改用户控货密码", notes = "用户修改控货密码时使用")
@PreAuthenticated
public CommonResult<Boolean> updateControlPassword(@RequestBody @Valid AppAuthUpdatePasswordReqVO reqVO) {
authService.updateControlPassword(getLoginUserId(), reqVO);
......
......@@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.member.controller.app.scoreRule.vo.AppScoreRuleBa
import cn.iocoder.yudao.module.member.controller.app.scoreRule.vo.AppScoreRuleListBackVO;
import cn.iocoder.yudao.module.member.controller.app.scoreRule.vo.AppScoreRuleListReqVO;
import cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum;
import cn.iocoder.yudao.module.member.service.ScoreRuleShareRecord.ScoreRuleShareRecordService;
import cn.iocoder.yudao.module.member.service.scoreRule.ScoreRuleService;
import cn.iocoder.yudao.module.member.vo.scoreRule.IdReqVo;
import io.swagger.annotations.Api;
......@@ -36,11 +37,13 @@ public class AppScoreRuleController {
private ApplicationContext applicationContext;
@Resource
private ScoreProducerApi scoreProducerApi;
@Resource
private ScoreRuleShareRecordService scoreRuleShareRecordService;
@PostMapping("/get")
@ApiOperation("客户端获得积分规则详情")
@Idempotent(timeout = 5)
@Idempotent(timeout = 1)
public CommonResult<AppScoreRuleBackDetailVO> getScoreRule(@Valid @RequestBody IdReqVo idReqVo) {
AppScoreRuleBackDetailVO scoreRuleBackDetailVO = scoreRuleService.appGetScoreRule(idReqVo.getId());
return success(scoreRuleBackDetailVO);
......@@ -48,7 +51,7 @@ public class AppScoreRuleController {
@PostMapping("/list")
@ApiOperation("客户端获得积分规则列表")
@Idempotent(timeout = 5)
@Idempotent(timeout = 1, message = "页面加载中")
public CommonResult<List<AppScoreRuleListBackVO>> getScoreRuleList(@Valid @RequestBody AppScoreRuleListReqVO reqVO) {
List<AppScoreRuleListBackVO> list = scoreRuleService.appGetScoreRuleList(reqVO);
return success(list);
......@@ -61,7 +64,11 @@ public class AppScoreRuleController {
if (ruleId == null || userId == null) {
return;
}
scoreProducerApi.sendShareMessage(ScoreRuleTypeEnum.SHARE, userId, ruleId, IPHelper.getIpAddr(request));
String ipAddr = IPHelper.getIpAddr(request);
if (!scoreRuleShareRecordService.verifyTriggerIp(userId, ruleId, ipAddr)) {
return;
}
scoreProducerApi.sendShareMessage(ScoreRuleTypeEnum.SHARE, userId, ruleId, ipAddr);
}
//@PostMapping("/page")
//@ApiOperation("获得积分规则分页")
......
......@@ -16,7 +16,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
@RestController
@Api(tags = "管理后台 - 分享记录")
@Api(tags = "用户 APP - 分享记录")
@RequestMapping("/member/score-rule/share-record")
public class AppScoreRuleShareRecordController {
......
package cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 分享规则失败点击记录 DO
*
* @author 系统管理员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("score_rule_share_fail_trigger")
public class ScoreRuleShareFailTriggerDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 分享记录id
*/
private Long shareRecordId;
/**
* 点击时间
*/
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date triggerTime;
/**
* 点击ip
*/
private String ipAddress;
}
package cn.iocoder.yudao.module.member.dal.mysql.ScoreRuleShareRecord;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord.ScoreRuleShareFailTriggerDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 分享失败点击记录 Mapper
*
* @author 系统管理员
*/
@Mapper
public interface ScoreRuleShareFailTriggerMapper extends AbstractMapper<ScoreRuleShareFailTriggerDO> {
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.member.dal.mysql.ScoreRuleShareRecord;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord.ScoreRuleShareRecordDO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordDetailReqVO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordDetailVO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordPageVO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordQueryVO;
......@@ -22,9 +23,9 @@ public interface ScoreRuleShareRecordMapper extends AbstractMapper<ScoreRuleShar
int countScoreRuleShareRecord(@Param("query") ScoreRuleShareRecordQueryVO query);
List<ScoreRuleShareRecordDetailVO> getRuleShareRecordDetail(@Param("start") int start, @Param("size") int size, @Param("id") Long id);
List<ScoreRuleShareRecordDetailVO> getRuleShareRecordDetail(@Param("start") int start, @Param("size") int size, @Param("query") ScoreRuleShareRecordDetailReqVO query);
int countScoreRuleShareRecordDetail(@Param("id") Long id);
int countScoreRuleShareRecordDetail(@Param("query") ScoreRuleShareRecordDetailReqVO query);
String getCurrentMaxShareRecordCode();
}
\ No newline at end of file
......@@ -37,6 +37,7 @@ public class ScoreRuleRedisDao {
}
public ScoreRuleDO getEnableScoreRule(ScoreRuleTypeEnum type, TransportTypeEnum transportType) {
ScoreRuleDO useScoreRuleDO;
// 如果transportType不为空则是订单V值类型
if (transportType == null) {
String redisKey = formatKey(type.getValue(), null);
......@@ -44,15 +45,20 @@ public class ScoreRuleRedisDao {
if (scoreRuleJson == null) {
return null;
}
return JsonUtils.parseObject(scoreRuleJson, ScoreRuleDO.class);
useScoreRuleDO = JsonUtils.parseObject(scoreRuleJson, ScoreRuleDO.class);
} else {
String redisKey = formatKey(type.getValue(), transportType.getValue());
String scoreRuleJson = stringRedisTemplate.opsForValue().get(redisKey);
if (scoreRuleJson == null) {
return null;
}
return JsonUtils.parseObject(scoreRuleJson, ScoreRuleDO.class);
useScoreRuleDO = JsonUtils.parseObject(scoreRuleJson, ScoreRuleDO.class);
}
// 如果当前时间不在规则时间区间
if (System.currentTimeMillis() < useScoreRuleDO.getStartTime().getTime() || System.currentTimeMillis() > useScoreRuleDO.getEndTime().getTime()) {
return null;
}
return useScoreRuleDO;
}
public ScoreRuleDO getEnableScoreRule(ScoreRuleTypeEnum type) {
......@@ -72,7 +78,7 @@ public class ScoreRuleRedisDao {
scoreRuleDO.setDescZh(null);
if (scoreRuleDO.getType() == ScoreRuleTypeEnum.ORDER_V.getValue()) {
ScoreRuleOrderVExtraVO scoreRuleOrderVExtraVO = JsonUtils.parseObject(scoreRuleDO.getExtra(), ScoreRuleOrderVExtraVO.class);
stringRedisTemplate.opsForValue().set(formatKey(scoreRuleDO.getType(), scoreRuleOrderVExtraVO.getTransportType()), JsonUtils.toJsonString(scoreRuleDO));
stringRedisTemplate.opsForValue().set(formatKey(scoreRuleDO.getType(), scoreRuleOrderVExtraVO.getTransportType()), JsonUtils.toJsonString(scoreRuleDO), 24L, TimeUnit.HOURS);
}
stringRedisTemplate.opsForValue().set(formatKey(scoreRuleDO.getType(), null), JsonUtils.toJsonString(scoreRuleDO), 24L, TimeUnit.HOURS);
}
......
......@@ -47,7 +47,7 @@ public class RegisterStrategy extends AbstractScoreRuleStrategy {
}
// 校验注册平台
ScoreRuleRegisterExtraVO scoreRuleRegisterExtraVO = JsonUtils.parseObject(scoreRuleDO.getExtra(), ScoreRuleRegisterExtraVO.class);
if (scoreRuleRegisterExtraVO != null && !"2,3".equals(scoreRuleRegisterExtraVO.getRegisterPlatform())) {
if (scoreRuleRegisterExtraVO != null) {
if (!scoreRuleRegisterExtraVO.getRegisterPlatform().contains(String.valueOf(message.getRegisterPlatform()))) {
log.info("Register listener: The register platform does not match,userID:{}", userId);
return;
......
......@@ -34,4 +34,9 @@ public interface ScoreRuleShareRecordService extends IService<ScoreRuleShareReco
* @return 分享记录分页
*/
PageResult<ScoreRuleShareRecordPageVO> getRuleShareRecordPage(ScoreRuleShareRecordQueryVO query);
/**
* 分享规则触发ip校验
*/
boolean verifyTriggerIp(Long userId, Long ruleId, String ipAddr);
}
......@@ -4,14 +4,21 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord.ScoreRuleShareFailTriggerDO;
import cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord.ScoreRuleShareRecordDO;
import cn.iocoder.yudao.module.member.dal.dataobject.scoreLog.MemberUserScoreLogDO;
import cn.iocoder.yudao.module.member.dal.mysql.ScoreRuleShareRecord.ScoreRuleShareFailTriggerMapper;
import cn.iocoder.yudao.module.member.dal.mysql.ScoreRuleShareRecord.ScoreRuleShareRecordMapper;
import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum;
import cn.iocoder.yudao.module.member.service.scoreLog.MemberUserScoreLogService;
import cn.iocoder.yudao.module.member.util.ScoreRuleGenCodeUtils;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
......@@ -21,12 +28,17 @@ import java.util.List;
*/
@Service
@Validated
@Slf4j
public class ScoreRuleShareRecordServiceImpl extends AbstractService<ScoreRuleShareRecordMapper, ScoreRuleShareRecordDO> implements ScoreRuleShareRecordService {
@Resource
private ScoreRuleShareRecordMapper scoreRuleShareRecordMapper;
@Resource
private ScoreRuleGenCodeUtils scoreRuleGenCodeUtils;
@Resource
private MemberUserScoreLogService logService;
@Resource
private ScoreRuleShareFailTriggerMapper scoreRuleShareFailTriggerMapper;
@Override
public Long createRuleShareRecord(ScoreRuleShareRecordCreateReqVO createReqVO) {
......@@ -51,15 +63,22 @@ public class ScoreRuleShareRecordServiceImpl extends AbstractService<ScoreRuleSh
public PageResult<ScoreRuleShareRecordDetailVO> getRuleShareRecordDetail(ScoreRuleShareRecordDetailReqVO reqVO) {
int size = reqVO.getRows();
int start = (reqVO.getPage() - 1) * size;
List<ScoreRuleShareRecordDetailVO> list = scoreRuleShareRecordMapper.getRuleShareRecordDetail(start, size, reqVO.getId());
List<ScoreRuleShareRecordDetailVO> list = scoreRuleShareRecordMapper.getRuleShareRecordDetail(start, size, reqVO);
if (list.isEmpty()) {
return PageResult.empty();
}
list.stream().forEach(item -> {
list.forEach(item -> {
// 有效记录中ip取的是积分记录中的幂等key,需要提取出ip
if (item.getIpAddress().contains("SHARE")) {
String[] split = item.getIpAddress().split("_");
item.setIpAddress(split[split.length - 1]);
} else if (item.getIpAddress().contains("RECOMMEND")) {
item.setIpAddress("-");
}
item.setTypeZh(DictFrameworkUtils.getDictDataFromCache("score_rule_type", item.getType().toString()).getLabel());
item.setTypeEn(DictFrameworkUtils.getDictDataFromCache("score_rule_type", item.getType().toString()).getLabelEn());
});
int total = scoreRuleShareRecordMapper.countScoreRuleShareRecordDetail(reqVO.getId());
int total = scoreRuleShareRecordMapper.countScoreRuleShareRecordDetail(reqVO);
return new PageResult<>(list, total, size, reqVO.getPage(), (total + size - 1) / size);
}
......@@ -78,4 +97,26 @@ public class ScoreRuleShareRecordServiceImpl extends AbstractService<ScoreRuleSh
int total = scoreRuleShareRecordMapper.countScoreRuleShareRecord(query);
return new PageResult<>(list, total, size, query.getPage(), (total + size - 1) / size);
}
}
@Override
public boolean verifyTriggerIp(Long userId, Long ruleId, String ipAddr) {
// 根据分享人和规则id获取分享记录
ScoreRuleShareRecordDO scoreRuleShareRecordDO = selectOne("member_id", userId, "rule_id", ruleId);
if (scoreRuleShareRecordDO == null) {
log.info("Share listener: The user not share the activity,userId:{},ruleId:{}", userId, ruleId);
return false;
}
String uniqueId = userId + "_" + ruleId + "_" + ipAddr;
MemberUserScoreLogDO memberUserScoreLogDO = logService.getByUniqueId(ScoreSourceTypeEnum.SHARE + "_" + uniqueId);
if (memberUserScoreLogDO != null) {
// 增加触发失败记录
ScoreRuleShareFailTriggerDO failTriggerDO = new ScoreRuleShareFailTriggerDO();
failTriggerDO.setShareRecordId(scoreRuleShareRecordDO.getId());
failTriggerDO.setIpAddress(ipAddr);
failTriggerDO.setTriggerTime(new Date());
scoreRuleShareFailTriggerMapper.insert(failTriggerDO);
return false;
}
return true;
}
}
\ No newline at end of file
......@@ -22,7 +22,7 @@ public interface MemberAuthService extends SecurityAuthFrameworkService {
* @param userAgent 用户 UA
* @return 身份令牌,使用 JWT 方式
*/
String reg(@Valid AppAuthRegReqVO reqVO, String userIp, String userAgent);
String reg(@Valid AppAuthRegReqVO reqVO, String userIp, String userAgent, Boolean isAutoLogin);
/**
* 检查号码是否唯一
......
......@@ -111,7 +111,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
}
@Override
public String reg(@Valid AppAuthRegReqVO reqVO, String userIp, String userAgent) {
public String reg(@Valid AppAuthRegReqVO reqVO, String userIp, String userAgent, Boolean isAutoLogin) {
// 校验验证码
smsCodeApi.useSmsCode(AuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.MEMBER_REG.getScene(), userIp));
......@@ -134,6 +134,9 @@ public class MemberAuthServiceImpl implements MemberAuthService {
.setContent("手机注册成功");
userOperationLogService.createUserOperationLog(userOperationLogCreateReqVO);
if (!isAutoLogin) {
return null;
}
// 执行登陆
this.createLoginLog(user.getMobile(), LoginLogTypeEnum.LOGIN_USERNAME, LoginResultEnum.SUCCESS);
LoginUser loginUser = AuthConvert.INSTANCE.convert(user);
......
......@@ -19,7 +19,6 @@ import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQu
import cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleBackDetailVO;
import cn.iocoder.yudao.module.reward.api.reward.RedeemRewardApi;
import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemDetailForUserDTO;
import cn.iocoder.yudao.module.system.service.dict.DictTypeService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
......@@ -30,6 +29,8 @@ import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.addDays;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.getNextNDayStart;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.MEMBER_ID_IS_NULL;
/**
......@@ -56,6 +57,11 @@ public class MemberUserScoreLogServiceImpl extends AbstractService<MemberUserSco
int start = (query.getPageNo() - 1) * query.getPageSize();
int size = query.getPageSize();
List<MemberUserScoreLogBackVO> list = userScoreLogMapper.getPageRecordList(start, size, query);
list.forEach(vo->{
if (vo.getScorePeriod() != null) {
vo.setExpireTime(addDays(getNextNDayStart(vo.getCreateTime(), 1), vo.getScorePeriod()));
}
});
int total = userScoreLogMapper.getPageCount(query);
return new PageResult<>(list, total, query.getPageSize(), query.getPageNo(), (total + query.getPageSize() - 1) / query.getPageSize());
}
......
......@@ -109,20 +109,12 @@ public interface ScoreRuleService extends IService<ScoreRuleDO> {
ScoreRuleDO getEnabledOrderVScoreRuleByTransportType(Integer transportType);
/**
* 根据类型获取已启用积分规则
* 根据类型获取已启用积分规则(仅推荐和注册)
* @param scoreRuleType
* @return
*/
ScoreRuleDO getEnableScoreRuleByType(ScoreRuleTypeEnum scoreRuleType);
/**
* 根据类型获取已启用积分规则(带运输类型)
* @param scoreRuleType
* @param transportType
* @return
*/
ScoreRuleDO getEnableScoreRuleByType(ScoreRuleTypeEnum scoreRuleType, TransportTypeEnum transportType);
List<WarehouseTreeRegionSimpleVO> getWarehouseTreeRegionListSimple();
/**
......@@ -151,4 +143,10 @@ public interface ScoreRuleService extends IService<ScoreRuleDO> {
* @return
*/
Boolean setScoreRuleSwitch(SwitchReqVo switchReqVo);
/**
* 获取当前时间已启用的订单V值规则
* @return
*/
List<ScoreRuleDO> getEnableOrderVRule();
}
......@@ -236,7 +236,7 @@ public class MemberUserServiceImpl implements MemberUserService {
clientInternalMessageApi.createInternalMessage(dto);
//关联或创建后端客户
customerApi.associateCustomerAuto(areacode, mobile, user.getId(), englishName);
customerApi.associateCustomerAuto(areacode, mobile, user.getId(), englishName, user.getCode());
applicationContext.publishEvent(new MemberRegEvent(user.getId()));
......
......@@ -65,6 +65,7 @@ public class ScoreRuleGenCodeUtils {
}
}
// 获得5位序列号,不足位前面补0
codeNum = codeNum % 100000;
code.append(String.format("%05d", codeNum));
return code.toString();
}
......@@ -91,7 +92,7 @@ public class ScoreRuleGenCodeUtils {
if (currentMaxShareRecordCode == null){
codeNum = 1L;
} else {
codeNum = Long.parseLong(currentMaxShareRecordCode.substring(3)) + 1;
codeNum = Long.parseLong(currentMaxShareRecordCode.substring(5)) + 1;
}
redisHelper.set(key, String.valueOf(codeNum),10, TimeUnit.SECONDS);
} catch (InterruptedException e) {
......@@ -100,7 +101,8 @@ public class ScoreRuleGenCodeUtils {
lock.unlock();
}
}
// 获得5位序列号,不足位前面补0
// 获得5位序列号
codeNum = codeNum % 100000;
code.append(String.format("%05d", codeNum));
return code.toString();
}
......
package cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import lombok.EqualsAndHashCode;
@Data
@ApiModel("管理后台 - 分享记录详情查询 VO")
public class ScoreRuleShareRecordDetailReqVO extends PageVO {
@EqualsAndHashCode(callSuper = true)
public class ScoreRuleShareRecordDetailReqVO extends ScoreRuleShareRecordQueryVO {
@ApiModelProperty(value = "分享记录id")
@NotNull(message = "分享记录id不能为空")
private Long id;
}
......@@ -53,4 +53,7 @@ public class ScoreRuleShareRecordDetailVO {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "点击时间")
private Date triggerTime;
@ApiModelProperty(value = "点击ip")
private String ipAddress;
}
......@@ -9,9 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import java.util.Collections;
import java.util.Date;
import java.util.Map;
/**
* @author zhaobiyan
......@@ -50,6 +48,11 @@ public class MemberUserScoreLogBackVO {
private Date createTime;
@ApiModelProperty(value = "扩展参数")
private String extParam;
@ApiModelProperty(value = "积分有效期")
private Integer scorePeriod;
@ApiModelProperty(value = "积分过期时间")
private Date expireTime;
......
......@@ -22,7 +22,7 @@ public class ScoreRuleOrderVExtraVO {
@ApiModelProperty(value = "提货点列表(第一级提货点,第二级国家,城市,仓库id)", required = true)
private List<List<Long>> receiveAddrList;
@ApiModelProperty(value = "渠道,运输方式选择海运时,渠道隐藏,可多选,逗号拼接")
private String channel;
private List<Long> channel;
@ApiModelProperty(value = "积分规则列表", required = true)
private List<OrderVRule> orderVRule;
@ApiModelProperty(value = "订单入口(1后台,2APP,3WEB)可多选,逗号拼", required = true)
......
......@@ -18,6 +18,7 @@
sr.desc_en as ruleDescEn,
sr.cover_image_zh as coverImageZh,
sr.cover_image_en as coverImageEn,
sr.score_period as scorePeriod,
musl.create_time as createTime,
musl.ext_param as extParam
from member_user_score_log musl
......@@ -39,7 +40,7 @@
<sql id="pageCondition">
<if test="query.key !=null and query.key != ''">
and (mu.nickname like '%${query.key}%' or mu.mobile like '%${query.key}%')
and (mu.nickname like '%${query.key}%' or mu.mobile like '%${query.key}%' or mu.code like '%${query.key}%')
</if>
<if test="query.sourceType !=null">
and musl.source_type = #{query.sourceType}
......
......@@ -41,6 +41,7 @@
srsr.create_time AS createTime,
msul.score_count AS score,
msul.create_time AS triggerTime,
msul.unique_id AS ipAddress,
mu.nickname AS memberName,
sr.type,
sr.title_zh AS titleZh,
......@@ -50,17 +51,62 @@
LEFT JOIN score_rule_share_record srsr ON msul.member_id = srsr.member_id AND msul.rule_id = srsr.rule_id
LEFT JOIN member_user mu ON srsr.member_id = mu.id
LEFT JOIN score_rule sr ON srsr.rule_id = sr.id
where srsr.deleted = 0 AND srsr.id = #{id}
order by srsr.create_time desc
where srsr.deleted = 0
<if test="query.id != null">
AND srsr.id = #{query.id}
</if>
<include refid="shareRecordDetailCondition"/>
<if test="query.id == null">
UNION
SELECT
srsr.id,
srsr.code,
srsr.create_time AS createTime,
0 AS score,
srsf.trigger_time AS triggerTime,
srsf.ip_address AS ipAddress,
mu.nickname AS memberName,
sr.type,
sr.title_zh AS titleZh,
sr.title_en AS titleEn
FROM
score_rule_share_fail_trigger srsf
LEFT JOIN score_rule_share_record srsr ON srsf.share_record_id = srsr.id
LEFT JOIN member_user mu ON srsr.member_id = mu.id
LEFT JOIN score_rule sr ON srsr.rule_id = sr.id
where srsr.deleted = 0
<include refid="shareRecordFailDetailCondition"/>
</if>
order by createTime desc, triggerTime desc
limit #{start}, #{size}
</select>
<select id="countScoreRuleShareRecordDetail" resultType="java.lang.Integer">
SELECT
count(*)
FROM
member_user_score_log msul
LEFT JOIN score_rule_share_record srsr ON msul.member_id = srsr.member_id AND msul.rule_id = srsr.rule_id
where srsr.deleted = 0 AND srsr.id = #{id}
FROM (
SELECT srsr.id
FROM member_user_score_log msul
LEFT JOIN score_rule_share_record srsr ON msul.member_id = srsr.member_id AND msul.rule_id = srsr.rule_id
LEFT JOIN member_user mu ON srsr.member_id = mu.id
LEFT JOIN score_rule sr ON srsr.rule_id = sr.id
where srsr.deleted = 0
<if test="query.id != null">
AND srsr.id = #{query.id}
</if>
<include refid="shareRecordDetailCondition"/>
<if test="query.id == null">
UNION ALL
SELECT srsr.id
FROM score_rule_share_fail_trigger srsf
LEFT JOIN score_rule_share_record srsr ON srsf.share_record_id = srsr.id
LEFT JOIN member_user mu ON srsr.member_id = mu.id
LEFT JOIN score_rule sr ON srsr.rule_id = sr.id
where srsr.deleted = 0
<include refid="shareRecordFailDetailCondition"/>
</if>
) subquery
</select>
<select id="getCurrentMaxShareRecordCode" resultType="java.lang.String">
SELECT code FROM score_rule_share_record ORDER BY code desc LIMIT 1
......@@ -94,4 +140,62 @@
</if>
</if>
</sql>
<sql id="shareRecordDetailCondition">
<if test="query.memberName != null and query.memberName != ''">
AND mu.nickname = #{query.memberName}
</if>
<if test="query.type != null">
AND sr.type = #{query.type}
</if>
<if test="query.title != null and query.title != ''">
AND ( sr.title_zh LIKE concat('%', #{query.title}, '%') OR sr.title_en LIKE concat('%', #{query.title}, '%') )
</if>
<if test="query.code != null and query.code != ''">
AND srsr.code = #{query.code}
</if>
<if test="query.beginCreateTime != null and query.endCreateTime != null">
AND ( srsr.create_time BETWEEN #{query.beginCreateTime} AND #{query.endCreateTime} )
</if>
<if test="query.relationSymbol != null and query.totalScore != null">
<!--1:大于 2:等于 3:小于-->
<if test="query.relationSymbol == 1">
AND sr.get_score_once &gt; #{query.totalScore}
</if>
<if test="query.relationSymbol == 2">
AND sr.get_score_once = #{query.totalScore}
</if>
<if test="query.relationSymbol == 3">
AND sr.get_score_once &lt; #{query.totalScore}
</if>
</if>
</sql>
<sql id="shareRecordFailDetailCondition">
<if test="query.memberName != null and query.memberName != ''">
AND mu.nickname = #{query.memberName}
</if>
<if test="query.type != null">
AND sr.type = #{query.type}
</if>
<if test="query.title != null and query.title != ''">
AND ( sr.title_zh LIKE concat('%', #{query.title}, '%') OR sr.title_en LIKE concat('%', #{query.title}, '%') )
</if>
<if test="query.code != null and query.code != ''">
AND srsr.code = #{query.code}
</if>
<if test="query.beginCreateTime != null and query.endCreateTime != null">
AND ( srsr.create_time BETWEEN #{query.beginCreateTime} AND #{query.endCreateTime} )
</if>
<if test="query.relationSymbol != null and query.totalScore != null">
<!--1:大于 2:等于 3:小于-->
<if test="query.relationSymbol == 1">
AND 0 &gt; #{query.totalScore}
</if>
<if test="query.relationSymbol == 2">
AND 0 = #{query.totalScore}
</if>
<if test="query.relationSymbol == 3">
AND 0 &lt; #{query.totalScore}
</if>
</if>
</sql>
</mapper>
package cn.iocoder.boot.module.order.api;
import cn.iocoder.boot.module.order.api.dto.OrderItemRespDTO;
import cn.iocoder.boot.module.order.api.dto.OrderOperateLogDTO;
import cn.iocoder.boot.module.order.api.dto.OrderRespDTO;
import java.util.List;
......@@ -14,11 +15,24 @@ public interface OrderApi {
*/
OrderRespDTO getOrder(Long id, String orderNo);
/**
* 判断是否用户首单
* 判断客户是否首单
*/
boolean isFirstOrder(Long userId);
boolean isFirstOrder(Long customerId);
/**
* 根据订单id获取所有订单项
*/
List<OrderItemRespDTO> getOrderItemsByOrderId(Long orderId);
/**
* 添加订单操作日志
*/
void createOrderOperateLog(OrderOperateLogDTO orderId);
/**
* 合并订单
* @param customerIdSaved 保留客户id
* @param customerIdDeleted 删除客户id
* @return 是否合并成功
*/
boolean mergeOrder(Long customerIdSaved, Long customerIdDeleted);
}
package cn.iocoder.boot.module.order.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 订单操作日志 DTO
*/
@Data
public class OrderOperateLogDTO {
@ApiModelProperty(value = "订单ID", required = true)
@NotNull(message = "订单ID不能为空")
private Long orderId;
@ApiModelProperty(value = "变更后订单详情数据")
private String body;
@ApiModelProperty(value = "请求地址")
private String requestUrl;
@ApiModelProperty(value = "变更类型")
private String type;
@ApiModelProperty(value = "变更描述")
private String msg;
@ApiModelProperty(value = "备注说明")
private String note;
@ApiModelProperty(value = "操作人类型:1 会员 2 管理员")
private Integer userType;
@ApiModelProperty(value = "创建者")
private String creator;
@ApiModelProperty(value = "创建者名称")
private String creatorName;
}
package cn.iocoder.boot.module.order.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@Data
......
......@@ -3,33 +3,43 @@ package cn.iocoder.yudao.module.order.api;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.boot.module.order.api.OrderApi;
import cn.iocoder.boot.module.order.api.dto.*;
import cn.iocoder.yudao.module.order.convert.orderConsignor.OrderConsignorConvert;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignee.OrderConsigneeDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignor.OrderConsignorDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderObjective.OrderObjectiveDO;
import cn.iocoder.yudao.module.order.service.order.OrderConsigneeService;
import cn.iocoder.yudao.module.order.service.order.OrderConsignorService;
import cn.iocoder.yudao.module.order.service.order.OrderObjectiveService;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import cn.iocoder.yudao.module.order.service.order.*;
import cn.iocoder.yudao.module.order.service.order.impl.OrderItemServiceImpl;
import cn.iocoder.yudao.module.order.service.orderOperateLog.OrderOperateLogService;
import cn.iocoder.yudao.module.order.vo.orderOperateLog.OrderOperateLogCreateReqVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.base.Joiner;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_IS_APPROVAL_IN_PROCESS_WITH_ORDERNOS;
@Service
@Validated
public class OrderApiImpl implements OrderApi {
@Resource
private OrderService orderService;
@Resource
private OrderBusinessService orderBusinessService;
@Resource
private CustomerService customerService;
@Resource
private OrderObjectiveService objectiveService;
@Resource
private OrderConsigneeService orderConsigneeService;
......@@ -37,6 +47,8 @@ public class OrderApiImpl implements OrderApi {
private OrderItemServiceImpl orderItemService;
@Resource
private OrderConsignorService orderConsignorService;
@Resource
private OrderOperateLogService orderOperateLogService;
@Override
public OrderRespDTO getOrder(Long id, String orderNo) {
......@@ -79,9 +91,9 @@ public class OrderApiImpl implements OrderApi {
}
@Override
public boolean isFirstOrder(Long userId) {
Long count = orderService.selectCount(new LambdaQueryWrapper<OrderDO>().eq(OrderDO::getUserId, userId));
return count <= 0;
public boolean isFirstOrder(Long customerId) {
// 只要发过货或者收过货都不算首单
return orderConsignorService.selectCount("customer_id", customerId) <= 1 && orderConsigneeService.selectCount("customer_id", customerId) <= 1;
}
@Override
......@@ -92,4 +104,72 @@ public class OrderApiImpl implements OrderApi {
}
return null;
}
@Override
public void createOrderOperateLog(OrderOperateLogDTO orderOperateLogDTO) {
OrderOperateLogCreateReqVO createReqVO = new OrderOperateLogCreateReqVO();
BeanUtils.copyProperties(orderOperateLogDTO, createReqVO);
orderOperateLogService.createOrderAsyncOperateLog(createReqVO);
}
@Override
public boolean mergeOrder(Long customerIdSaved, Long customerIdDeleted) {
CustomerDO customerDeleted = customerService.getById(customerIdDeleted);
CustomerDO customerSaved = customerService.getById(customerIdSaved);
// 将customerId=customerIdDeleted的订单的customerId更新为customerIdSaved
List<OrderDO> list = orderService.selectList(new LambdaQueryWrapperX<OrderDO>().eq(OrderDO::getCustomerId, customerIdDeleted));
if (CollectionUtil.isNotEmpty(list)) {
// 订单有审核中,则不允许合并
List<String> auditingOrderNoList = list.stream().filter(t -> t.getAuditType() != 0).map(OrderDO::getOrderNo).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(auditingOrderNoList)) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS_WITH_ORDERNOS, Joiner.on(",").join(auditingOrderNoList));
}
for (OrderDO order : list) {
order.setCustomerId(customerIdSaved);
order.setUpdateTime(new Date());
orderService.updateById(order);
// 保存操作日志
orderBusinessService.addOrderOperateLog(order.getOrderId(), "合并客户-归属人",
String.format("将此订单的客户由【%d-%s-%s】合并为【%d-%s-%s】", customerDeleted.getId(), customerDeleted.getNumber(), customerDeleted.getName(),
customerSaved.getId(), customerSaved.getNumber(), customerSaved.getName()));
}
}
// 修改收货人
List<OrderConsigneeDO> orderConsigneeDOList = orderConsigneeService.selectList(new LambdaQueryWrapperX<OrderConsigneeDO>().eq(OrderConsigneeDO::getCustomerId, customerIdDeleted));
if (CollectionUtil.isNotEmpty(orderConsigneeDOList)) {
for (OrderConsigneeDO orderConsigneeDO : orderConsigneeDOList) {
orderConsigneeDO.setCustomerId(customerIdSaved);
orderConsigneeDO.setCustomerNumber(customerSaved.getNumber());
orderConsigneeService.updateById(orderConsigneeDO);
// 保存操作日志
orderBusinessService.addOrderOperateLog(orderConsigneeDO.getOrderId(), "合并客户-收货人",
String.format("将此订单的收货人客户由【%d-%s-%s】合并为【%d-%s-%s】", customerDeleted.getId(), customerDeleted.getNumber(), customerDeleted.getName(),
customerSaved.getId(), customerSaved.getNumber(), customerSaved.getName()));
}
}
// 修改发货人
List<OrderConsignorDO> orderConsignorDOList = orderConsignorService.selectList(new LambdaQueryWrapperX<OrderConsignorDO>().eq(OrderConsignorDO::getCustomerId, customerIdDeleted));
if (CollectionUtil.isNotEmpty(orderConsignorDOList)) {
for (OrderConsignorDO orderConsignorDO : orderConsignorDOList) {
orderConsignorDO.setCustomerId(customerIdSaved);
orderConsignorDO.setCustomerNumber(customerSaved.getNumber());
orderConsignorService.updateById(orderConsignorDO);
// 保存操作日志
orderBusinessService.addOrderOperateLog(orderConsignorDO.getOrderId(), "合并客户-发货人",
String.format("将此订单的发货人客户由【%d-%s-%s】合并为【%d-%s-%s】", customerDeleted.getId(), customerDeleted.getNumber(), customerDeleted.getName(),
customerSaved.getId(), customerSaved.getNumber(), customerSaved.getName()));
}
}
return false;
}
}
......@@ -2988,6 +2988,25 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
})
BigDecimal getOrderTotalVolumeByDeliveryDate(@Param("deliveryDate") Date deliveryDate, @Param("prodId") Long prodId, @Param("orderItemId") Long orderItemId);
@ResultType(BigDecimal.class)
@Select({
"<script>",
"SELECT",
"IFNULL(sum(oi.weight),0)",
"FROM",
"ecw_order_item oi ",
"LEFT JOIN ecw_order o ",
"on o.order_id = oi.order_id ",
"WHERE",
"o.delivery_date = #{deliveryDate}",
"AND oi.prod_id = #{prodId}",
"<when test = 'orderItemId != null '>",
"AND oi.order_item_id != #{orderItemId}",
"</when>",
"</script>"
})
BigDecimal getOrderTotalWeightByDeliveryDate(@Param("deliveryDate") Date deliveryDate, @Param("prodId") Long prodId, @Param("orderItemId") Long orderItemId);
@ResultType(OrderDO.class)
@Select({
"<script>",
......
......@@ -84,6 +84,7 @@ public interface OrderCargoControlMapper extends AbstractMapper<OrderCargoContro
"o.parent_number, ",
"o.container_number, ",
"o.marks, ",
"o.type, ",
"o.`status`, ",
"o.abnormal_state, ",
"o.in_warehouse_state, ",
......
......@@ -111,6 +111,10 @@ public interface OrderCargoControlPickMapper extends AbstractMapper<OrderCargoCo
"o.sum_volume, ",
"o.sum_weight, ",
"o.create_time, ",
"o.`unload_time`, ",
"o.`is_limit_update_consignee`, ",
"o.`lock_consignee_time`, ",
"o.`lock_consignee_day`, ",
"nee.name as consignee_name, ",
"nee.name_en as consignee_name_en, ",
"nee.phone as consignee_phone, ",
......
......@@ -5,8 +5,6 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderException.OrderExceptionDO;
import cn.iocoder.yudao.module.order.vo.order.OrderBackPageVO;
import cn.iocoder.yudao.module.order.vo.order.OrderQueryVO;
import cn.iocoder.yudao.module.order.vo.order.StatisticsOrderVO;
import cn.iocoder.yudao.module.order.vo.orderException.OrderBackVO;
import cn.iocoder.yudao.module.order.vo.orderException.OrderExceptionBackVO;
......@@ -17,7 +15,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import java.util.List;
......@@ -40,7 +37,7 @@ public interface OrderExceptionMapper extends AbstractMapper<OrderExceptionDO> {
//.eqIfPresent(OrderExceptionDO::getOrderExceptionRemark, vo.getOrderExceptionRemark())
//.eqIfPresent(OrderExceptionDO::getOrderExceptionAmount, vo.getOrderExceptionAmount())
//.eqIfPresent(OrderExceptionDO::getOrderExceptionAttr, vo.getOrderExceptionAttr())
.eqIfPresent(OrderExceptionDO::getOrderExceptionStatus, vo.getOrderExceptionStatus())
.eqIfPresent(OrderExceptionDO::getOrderExceptionStatus, vo.getOrderExceptionStatusList())
.betweenIfPresent(OrderExceptionDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(OrderExceptionDO::getId));
}
......@@ -56,7 +53,7 @@ public interface OrderExceptionMapper extends AbstractMapper<OrderExceptionDO> {
.eqIfPresent(OrderExceptionDO::getOrderId, vo.getOrderId())
//.eqIfPresent(OrderExceptionDO::getOrderNumber, vo.getOrderNumber())
.eqIfPresent(OrderExceptionDO::getOrderExceptionType, vo.getOrderExceptionType())
.eqIfPresent(OrderExceptionDO::getOrderExceptionStatus, vo.getOrderExceptionStatus())
.eqIfPresent(OrderExceptionDO::getOrderExceptionStatus, vo.getOrderExceptionStatusList())
.betweenIfPresent(OrderExceptionDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(OrderExceptionDO::getId));
}
......
......@@ -33,6 +33,10 @@ public class OrderCargoControlReleaseInfoDto {
@ApiModelProperty(value = "唛头")
private String marks;
@ApiModelProperty(value = "增值服务(多个使用','连接):1 集运服务 2 海外仓")
private String type;
@ApiModelProperty(value = "货柜自编号")
private String containerNumber;
......
......@@ -39,6 +39,8 @@ public enum CustomDraweeEnum {
documentDeclarationFee("documentDeclarationFee","单证报关费","Document customs declaration fee",14),
warehouseRent("warehouseRent","仓租费","Warehouse rental fee",15),
magneticInspectionFee("magneticInspectionFee","磁检费","Magnetic inspection fee",16),
additionalTaxFee("additionalTaxFee","附加税","Additional Tax",17),
// TODO 待补充...
......
......@@ -152,7 +152,6 @@ public interface ErrorCodeConstants {
ErrorCode YOUR_CUSTOMER_INFO_IS_INCOMPLETE = new ErrorCode(1004020105, "your.customer.information.is.incomplete");
ErrorCode ORDER_IS_APPROVAL_IN_PROCESS = new ErrorCode(1004020106, "order.is.approval.in.process");
ErrorCode MODIFY_APPROVAL_NOT_UPDATE_OR_DELETE_WAREHOUSE_IN = new ErrorCode(1004020107, "modify.approval.not.update.warehouse.in");
ErrorCode WAREHOUSE_IN_ITEM_EXPRESS_NO_LIMIT = new ErrorCode(1004020108, "warehouse.in.item.expressno.limit");
......@@ -404,4 +403,26 @@ public interface ErrorCodeConstants {
ErrorCode ORDER_CARGO_CONTROL_LIMIT_UPDATE_CONSIGNEE_INFO = new ErrorCode(1004001156, "order.cargo.control.limit.update.consignee.info");
ErrorCode ORDER_CARGO_CONTROL_CONSIGNEE_LIMIT_UPDATE_APPLYING = new ErrorCode(1004001157, "order.cargo.control.consignee.limit.update.applying");
ErrorCode ORDER_CARGO_CONTROL_OVERSEAS_WAREHOUSE_UPDATE_APPLYING = new ErrorCode(1004001158, "order.cargo.control.overseas.warehouse.update.applying");
ErrorCode ORDER_EXISTS_PICKUP_NOT_CARGO_CONTROL = new ErrorCode(1004001159, "order.exists.pickup.not.cargo.control");
ErrorCode ORDER_EXISTS_PICK_NOT_CANCEL_CARGO_CONTROL = new ErrorCode(1004001160, "order.exists.pick.not.cancel.cargo.control");
ErrorCode ORDER_OVERSEAS_WAREHOUSE_UPDATE_NEED_APPLY = new ErrorCode(1004001161, "order.overseas.warehouse.update.need.applying");
ErrorCode NOT_UPDATE_DEST_COUNTRY = new ErrorCode(1004001162, "order.not.update.dest.country");
ErrorCode NOT_UPDATE_DEPARTURE = new ErrorCode(1004001163, "order.not.update.departure");
ErrorCode NOT_UPDATE_TRANSPORT = new ErrorCode(1004001164, "order.not.update.transport");
ErrorCode ORDER_PRE_INSTALLATION_UNPACKAGED_CONTAINER_NOT_UPDATE = new ErrorCode(1004001165, "order.pre.installation.unpackaged.container.not.update");
// /空运订单分拣未出货, 锁定订单信息无法修改
ErrorCode ORDER_SORTING_NOT_SHIPMENT_NOT_UPDATE = new ErrorCode(1004001166, "order.sorting.not.shipment.not.update");
ErrorCode ORDER_IS_APPROVAL_IN_PROCESS_WITH_ORDERNOS = new ErrorCode(1004001167, "order.is.approval.in.process.with.ordernos");
// 请选择订单海外仓修改是或否
ErrorCode ORDER_OVERSEAS_WAREHOUSE_UPDATE_IS_OR_NO = new ErrorCode(1004001168, "order.overseas.warehouse.update.is.or.no");
// 该订单已经是海外仓订单
ErrorCode ORDER_IS_OVERSEAS_WAREHOUSE_ORDER = new ErrorCode(1004001169, "order.is.overseas.warehouse.order");
// 该订单已经是非海外仓订单
ErrorCode ORDER_NOT_IS_OVERSEAS_WAREHOUSE_ORDER = new ErrorCode(1004001170, "order.not.is.overseas.warehouse.order");
}
......@@ -28,14 +28,19 @@ public enum OrderStatusMsgEnum {
adjust_applying(5, 10112, 212, 0, "调仓中", "order.status.adjust", "order.status.adjust"),
ADJUST_WAREHOUSE(5, 10113, 215, 0, "调仓已到仓", "order.status.adjust.arrived.warehouse", "order.status.adjust.arrived.warehouse"),
ADJUST_WAREHOUSE_PRE_INSTALLED(5, 10113, 215, 304, "调仓已到仓", "order.status.adjust.arrived.warehouse", "order.status.adjust.arrived.warehouse"),
EXIT_WAREHOUSE(5, 10114, 216, 0, "报关退场已入仓", "order.status.adjust.demobilized.warehoused", "order.status.warehousing"),
PREINSTALL_EXAMINE(5, 10115, 0, 305, "预装审核中", "order.status.pre.install.review", "order.status.pre.install.review"),
PRE_INSTALLED_PROGRESS(5, 10115, 202, 304, "已入仓", "order.status.warehousing", "order.status.warehousing"),
// PRE_INSTALLED_PROGRESS(5, 10115, 202, 304, "预装中", "order.status.pre.install", "order.status.pre.install"),
PREINSTALL_EXAMINE(5, 10116, 0, 305, "预装审核中", "order.status.pre.install.review", "order.status.pre.install.review"),
WAREHOUSE_ADJUSTMENT_PRE_INSTALLED(8, 10203, 214, 304, "调仓待入仓", "order.status.adjust.wait.in.warehouse", "order.status.adjust"),
WITHDRAWN(7, 0, 0, 0, "已退仓", "Withdrawn", "order.status.draft"),
adjust_wait_out(8, 10202, 213, 0, "调仓待出仓", "order.status.adjust.wait.out.warehouse", "order.status.adjust"),
WAREHOUSE_ADJUSTMENT(8, 10203, 214, 0, "调仓待入仓", "order.status.adjust.wait.in.warehouse", "order.status.adjust"),
MERGED_ORDER(9, 10204, 210, 0, "已合单", "order.status.closed", "order.status.closed"),
MERGED_ORDER_PRE_INSTALLED(9, 10204, 210, 304, "已合单", "order.status.closed", "order.status.closed"),
MERGED_ORDER_FINISH(9, 10205, 211, 0, "已合单归档", "order.status.closed", "order.status.closed"),
SPLIT_ORDER(10, 10206, 208, 0, "已拆单", "order.status.split.succeeded", "order.status.warehousing"),
......@@ -106,6 +111,7 @@ public enum OrderStatusMsgEnum {
AIR_TO_BE_PREPARED(502, 10105, 202, 0, "仓库待备货", "air.to.be.prepared", "air.to.be.prepared"),
AIR_IN_STOCK(503, 10105, 202, 0, "仓库备货中", "air.in.stock", "air.in.stock"),
AIR_READY_STOCK_AND_WAITING_TO_BE_ARRANGED(504, 10105, 202, 0, "待排单", "air.ready.stock.and.waiting.to.be.arranged", "air.ready.stock.and.waiting.to.be.arranged"),
AIR_READY_STOCK_AND_WAITING_TO_BE_ARRANGED_SORTING(504, 10105, 202, 304, "待排单", "air.ready.stock.and.waiting.to.be.arranged", "air.ready.stock.and.waiting.to.be.arranged"),
;
......@@ -219,5 +225,4 @@ public enum OrderStatusMsgEnum {
return 99999;
}
}
......@@ -390,7 +390,7 @@ public interface OrderBusinessService extends IService<OrderDO> {
* @param orderItemDOList 订单商品项列表
* @param type 类型 : 1 新增 2 修改 3 实测入仓信息 4 合单 5 拆单 6 处理未报价异常 7 特价申请 8 订单货值修改
* 9 处理重泡货异常 10 已入仓订单修改重订价 11 处理渠道异常 12 处理单询异常 13 处理超重异常 14 批量加价 15 完成入仓
* 16 分拣完成锁定价格 20 强制重订价格 30 空运订单每日定时更新价格 40 订单异常处理完成更新计价 50 更新订单优惠信息
* 16 分拣完成锁定价格 17 分拣反审解除锁定价格 18 出货入仓修改 20 强制重订价格 30 空运订单每日定时更新价格 40 订单异常处理完成更新计价 50 更新订单优惠信息
**/
void costCalculation(String userId, OrderDO orderDO, Long consignorCustomerId, Long consigneeCustomerId,
Long consignorCustomerContactsId, Long consigneeCustomerContactsId,
......
......@@ -41,19 +41,27 @@ public interface OrderService extends IService<OrderDO> {
OrderDO createOrder(OrderCreateReqVO createReqVO, MemberUserDO memberUserDO);
/**
* 更新订单
* 更新编辑下单或草稿订单
*
* @param updateReqVO 更新信息
*/
void updateOrder(@Valid OrderUpdateReqVO updateReqVO, MemberUserDO memberUserDO);
/**
* 更新订单
* 更新入仓订单
*
* @param updateReqVO 更新信息
* @param memberUserDO 会员信息
*/
void updateOrderApply(@Valid OrderUpdateReqVO updateReqVO, MemberUserDO memberUserDO);
/**
* 更新出货订单
*
* @param updateReqVO 更新信息
*/
void shipmentOrderApplyUpdate(@Valid OrderUpdateReqVO updateReqVO, MemberUserDO memberUserDO);
/**
* 订单入仓
......@@ -62,6 +70,14 @@ public interface OrderService extends IService<OrderDO> {
*/
OrderDO orderInWarehouse(@Valid OrderWarehouseInVO orderWarehouseInVO);
/**
* 出货订单入仓
*
* @param orderWarehouseInVO 入仓信息
*/
OrderDO shipmentOrderInWarehouse(@Valid OrderWarehouseInVO orderWarehouseInVO);
/**
* 合单-创建合并订单
*
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment